I don't have time to build a test of this at the moment, but I am pretty
sure you could build your credentials ID in code, based off of your
${env.REGION}, and pass that to the withCredentials like this:
withCredentials([
string(credentialsId: "$REGION_CRED", variable: 'PW').
]} { ... }
On Thursday, September 21, 2017 at 8:36:24 AM UTC-6, Mike Zupan wrote:
>
> 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.
>
--
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/1b28b9ff-d358-4cb9-9d7d-a9761d1e40b5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.