Reputation: 17676
How can I pass a variable e.g. buildNumber
sh 'gulp sometask --someOption="attribute=${env.BUILD_NUMBER}"'
to the sh
command using Jenkins workflow / pipeline?
My example unfortunately only yields a bad substitution error.
Upvotes: 0
Views: 1651
Reputation: 31
Could you try this command:
sh """gulp sometask --someOption='attribute=${env.BUILD_NUMBER}'"""
Upvotes: 1
Reputation: 524
could you please try this command here:
sh "gulp sometask --someOption='attribute=${env.BUILD_NUMBER}'"
The quotation marks are exchanged. I think the reason is, that you can templating with double quotes (using GString), which doesn't work with single quotes (using a plain String) in groovy.
for more information see the Groovy Documentation
Upvotes: 4
Reputation: 1243
Did you try
sh 'gulp sometask --someOption="attribute=${BUILD_NUMBER}"'
Upvotes: -1