So I'm trying to use withCredentials() with unique variables and looking for the best way.
I have the following password that is unique per region which we call clients
client1 = foo
client2 = bar
client3 = baz
So i have a script that might look like
sh "./deploy -password <unique PW here from above>"
For one region its fine
withCredentials([
string(credentialsId: 'pw', variable: 'PW'),
]) {
sh "./deploy -password ${PW}"
}
We have a env that gets passed in like ${env.REGION}
Anyone have a good way with jenkins credentials to lookup a unique PW per region that would easily work for a scripted pipeline.