In groovy, variable substitution is only done in double quoted strings, not single quoted strings. Try replacing the single quotes with double quotes.
On Tue, Jun 14, 2016, 07:52 Jerry Steele <[email protected]> wrote: > Hello again. So, my Jenkinsfile now looks like this, and I'm having some > success: > > def git_url = "[email protected]:myorg/my_project.git" > def git_branch > > node { > stage "Check out from git" > checkout scm > > > stage "Make sure our git branch var is accessible" > > > sh 'git rev-parse --abbrev-ref HEAD > GIT_BRANCH' > git_branch = readFile('GIT_BRANCH').trim() > echo git_branch > > > stage 'Use build_tool to build the branch' > sh 'sudo -Hs build_tool dist '${env.git_url}' hark_web '{env.git_branch} > '' > } > > However, the variable substitution does not appear to work, and the job > fails at the build_tool stage with: > > + sudo -Hs build_tool dist > usage: build_tool usage.... > > > Obviously, the variables are not being substituted. I've also tried > "$git_url", "git_url" and "${git_url}" with similar results. Does anyone > see where I might be going wrong? > > Thanks > > > >> -- >> --- >> >> Jerry Steele >> Telephone: +44 (0)7492 910225 >> http://www.ticktockhouse.co.uk >> GPG: 43A3A8C6 >> >> -- > You received this message because you are subscribed to the Google Groups > "Jenkins Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-users/ae4572c3-1aa5-47c6-91b7-c29fe7ee5ee0%40googlegroups.com > <https://groups.google.com/d/msgid/jenkinsci-users/ae4572c3-1aa5-47c6-91b7-c29fe7ee5ee0%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfiDH9dzkuU0QzitF7CZYWHZ%2BGwBMedhkgL_WaMi3RhnQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
