-
Bug
-
Resolution: Not A Defect
-
Minor
-
None
-
Jenkins 2.71
Pipeline: Shared Groovy Libraries 2.3
If I have global library in vars/myGlobalLibrary.groovy and inside of that I ask for an input step, the input step breaks out of the method.
You'll see that the methods right after the def userInput = input are not executed.
The methods inside my pipeline after the call to the global library are executed so it isn't killing the whole pipeline, just breaking out of the global method release().
If the call to input is moved back out into the pipeline itself it works just fine and captures the response in the userInput variable.
Essentially I'm trying to use the global libraries to make my pipeline much shorter and in this case I'm trying to call out to steps like input inside that global var.
vars/myGlobalLibrary.groovy
@NonCPS def release() { def userInput = input( id: 'userInput', message: 'Proceed with release?', parameters: [ [$class: 'TextParameterDefinition', defaultValue: "1.0", description: 'Release Version', name: 'releaseVersion'] ]) echo "never gets here" echo "releaseversion: " + userInput['releaseversion'] }
My pipeline stage:
@Library('pipelinehelper@master') _ deployToProdStage() def deployToProdStage() { stage name:'PROD Deploy',concurrency: 1 myGlobalLibrary.release() echo "Makes it here just fine" }
- duplicates
-
JENKINS-31314 Running asynchronous code inside a @NonCPS method should fail cleanly
- Resolved