I'm a nubie to jenkins dsl. I'm trying to set credentials as an environment variable in order to use it in my fabfile . I first determine the credentials I want to use in a step context, than bind it in a wrapper block. The problem I so was that the wrapper block is executed before the steps block, thus creating an error of credentials not found. I'm not sure how I can set the values in a different way. any ideas? Added my code:
steps{
shell('if [ "$my-variable" == "new" ]; then\n\
cred="new"\n\
echo "set cred to new" \n\
else\n\
cred="old"\n\
echo "set cred to old"\n\
fi;')
}
wrappers{
credentialsBinding{
usernamePassword('userVar', 'passwordVar', '${cred}')
}
}
steps {
shell(fab ${envName} start')
}