Hi,
trying to get started with pipelines and am having difficulties combining "input" and "stage" steps.
If I wrap a stage around the output node, it still works as intended but the UI is a little cludgy as I need to go to the build's dropdown menu to provide the input.
The user interface becomes much nicer if I also wrap the input in a separate stage so it shows up in the Stage View, but then the output stage breaks. It looks like the information is lost between stages, can this somehow be circumvented?
If I run this pipeline (no, the default values are not real ones):
stage('input') {
def userInput = input(
id: 'userInput', message: 'AWS Credentials?', parameters: [
[$class: 'TextParameterDefinition', defaultValue: 'ASIAILTN6HUOSJUT5NRA', description: 'AWS Access Key ID', name: 'AWS_ACCESS_KEY_ID'],
[$class: 'TextParameterDefinition', defaultValue: 'z4aiU9IALIahLhY0nX2tzzj2RO6DvObWD0LDf6V9', description: 'AWS Secret Access Key', name: 'AWS_SECRET_ACCESS_KEY']
])
}
stage('output') {
node {
sh 'export'
echo ("AWS Acess Key ID: "+userInput['AWS_ACCESS_KEY_ID'])
echo ("AWS Secret Access Key: "+userInput['AWS_SECRET_ACCESS_KEY'])
}
}
then the output fails, and the console output contains this:
export USER="jenkins"
export WORKSPACE="/var/lib/jenkins/workspace/test"
export XFILESEARCHPATH="/usr/dt/app-defaults/%L/Dt"
export _="/var/lib/jenkins/workspace/test@tmp/durable-5928a78d/script.sh"
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // stage
[Pipeline] End of Pipeline
groovy.lang.MissingPropertyException: No such property: userInput for class: groovy.lang.Binding
at groovy.lang.Binding.getVariable(Binding.java:63)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:224)
at org.kohsuke.groovy.sandbox.impl.Checker$4.call(Checker.java:241)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:238)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:221)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:221)
at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:28)
at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:20)
with kind regards,
Bent Terp