withCredentials([usernamePassword(credentialsId: 'creds',
usernameVariable: 'myuser', passwordVariable: 'mypass')]) {
sh "some command --username ${svnuser} --password ${mypass}"
}
--
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 jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/16bfd2b1-ad71-4326-ac3c-7693b9c71331%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVf9g8GN2BPSGdt9jSR1t%2Bj7%2BzoC%2B711cPQzOO1duu6WYQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtGpVxCy1LzOh2KATKNktvnWCYUDEzRnXeQyjN3VAW0iDA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
environment{
CRED = credentials('mycreds')
}
steps {
sh "some command blahb blah blah" +
//This works, because i guess bash is smart enough to escape $ in environment variables?
'--username ${CRED_USR} --password ${CRED_PSW}'
// ====== OR ======
sh "some command blahb blah blah" +
//Passing in the var directly, like you said, requires I tell bash this is a literal string
"--username '${CRED_USR}' --password '${CRED_PSW}'"