Skip to content

Instantly share code, notes, and snippets.

@darkobits
darkobits / repl.groovy
Last active September 15, 2022 12:20
Jenkins Interactive Shell
script {
while (true) {
def cmd = input(message: 'Jenkins Interactive Shell', parameters: [
string(name: 'cmd', description: 'Enter a command or leave blank to continue job.', defaultValue: '')
], ok: 'Execute')
if (cmd == '') { print 'Continuing job...'; break; }
try { sh cmd } catch (err) { }
}
}
@darkobits
darkobits / example.sh
Created August 14, 2022 07:51
Add $(npm bin) to $PATH
# Ensures that a locally-installed version of an NPM package will always be
# preferred over a globally installed version, and that we can run that
# package's executable like any other binary. To ensure a rogue package cannot
# install an executable that could shadow another binary (ie: 'ssh') make sure
# that $(npm bin) is appended rather than prepended to your existing $PATH.
export PATH="$PATH:$(npm bin)"