Adam Bien's Weblog

Yes/NO User Input in Jenkinsfile

The method input within the Jenkinsfile suspends the build and waits infinitely for the user input with configurable options.

A Yes / No dialog waits for user input and returns true / false with the following code snippet:


def doesJavaRock = input(message: 'Do you like Java?', ok: 'Yes', 
                        parameters: [booleanParam(defaultValue: true, 
                        description: 'If you like Java, just push the button',name: 'Yes?')])

echo "Java rocks?:" + doesJavaRock

See you at Java EE Workshops at MUC Airport, particularly at the Java EE CI/CD, Testing and Quality workshop


NEW workshop: HTML 5 and JavaScript Essentials, Three days in April 2017: from Java EE 7 Architectures over Microservices to Performance, Troubleshooting and Monitoring
On demand workshops: Java EE 7: Bootstrap, Effective, Testing and Microservices available for streaming.

Newsletter: airhacks.news

A book about rethinking Java EE Patterns

Comments:

I'd suggest to never do that without enclosing it inside a 'timeout' block ; or you have chances to block your server/build nodes ; can be problematic on an enterprise installation.

In order to have a default handling on timeout follow instructions on this support ticket https://support.cloudbees.com/hc/en-us/articles/226554067-Pipeline-How-to-add-an-input-step-with-timeout-that-continues-if-timeout-is-reached-using-a-default-value

A good hint also would be to send an email/SMS/notification to people who have to act/react before blocking the pipeline.

Posted by Matthieu Brouillard on March 20, 2017 at 03:29 PM CET #

Post a Comment:
  • HTML Syntax: NOT allowed
realworldpatterns.com
Online Workshops
...the last 150 posts
...the last 10 comments
License