Skip to content

Instantly share code, notes, and snippets.

@darkobits
Last active September 15, 2022 12:20
Show Gist options
  • Save darkobits/edb29cf84e64d442cbf5d50832956860 to your computer and use it in GitHub Desktop.
Save darkobits/edb29cf84e64d442cbf5d50832956860 to your computer and use it in GitHub Desktop.
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) { }
}
}
@yinonavraham
Copy link

Very nice!
The Jenkins Pipeline Utilities library by ebay provides steps similar to this one, mainly:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment