Pipeline Input Step

172 views
Skip to first unread message

Lukas Resch

unread,
Aug 2, 2019, 10:51:47 AM8/2/19
to Jenkins Users
Hi,

I am trying to use the input step and send the name of the person
accepting the change to an email address. Unfortunately the name in the
variable is always "null". The name and link in the console output is
working fine.

There are 2 issues in Jira that are both marked as resolved [0], [1].
Also setting an parameter did not change the behaviour for me. I also
tried a different docker image or setting a submitter for the input step.

While I would understand that there is a scope problem if the name in
the post stage would be null it is also null when I echo it in the same
stage.

Is anyone using this successfully and can tell me where I am wrong or
confirm that the behaviour is not as intended?

Versions:
Jenkins 2.187
Pipeline: Input Step 2.10

Minimal pipeline for reproduction:

pipeline {
agent {
docker {
image 'alpine'
}
}

stages {
stage('input') {
steps {
input message: 'Apply changes', submitterParameter:
'COMMITTER'//, parameters: [string(defaultValue: 'herp', description:
'', name: 'derp')]
echo "${env.COMMITTER}"
}
}
}
post {
success {
emailext body: "Changes were applied by ${env.COMMITTER}",
subject: 'Changes', to: 'te...@example.com'
}
}
}

Regards,
Lukas

[0] https://issues.jenkins-ci.org/browse/JENKINS-40594
[1] https://issues.jenkins-ci.org/browse/JENKINS-41421

Lukas Resch

unread,
Aug 2, 2019, 11:13:49 AM8/2/19
to Jenkins Users
Using

stages {
stage('input') {
input {
message 'Apply changes'
submitterParameter 'COMMITTER'
}//, parameters: [string(defaultValue: 'herp', description:
'', name: 'derp')]
steps {
echo "${env.COMMITTER}"
}
}
}

I at least get the variable set within my stage, but still not in post.
In my production file I would like to send out an email to request the
approval from the team, so moving the input out of the stage is not
really nice, as the mail would have to be sent from a different stage.

Regards,
Lukas
Reply all
Reply to author
Forward
0 new messages