FOO = credentials('id') will create environment variables FOO_USR and
FOO_PWD

On Apr 6, 2017 8:42 AM, "Idan Adar" <[email protected]> wrote:

Perhaps Robert (CCed) can help?


On Thursday, April 6, 2017 at 6:26:00 PM UTC+3, Idan Adar wrote:
>
> In declarative pipeline, one can use credentials() instead
> of withCredentials, but I am not really sure how this works. In general,
> lots of examples are missing...
>
> Assuming I've created in Jenkins a credential for an access token, I can
> do this:
>
> stage ("Merge pull request") {
>     environment {
>          ACCESS_TOKEN = credentials('credentials_id')
>     }
>
>     steps {
>         ... $ACCESS_TOKEN
>     }
> }
>
> But how do I handle username/password variables with credentials()?
> Assuming I've created credentials for a username/password combination,
> previously it'd be like this:
>
> withCredentials([usernamePassword(credentialsId: 'credentials_id',
> usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
>
>     ... $USERNAME
>     ... $PASSWORD
> }
>
> --
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/f25e52a4-f28a-4738-8901-c3500bd1d952%40googlegroups.
com
<https://groups.google.com/d/msgid/jenkinsci-users/f25e52a4-f28a-4738-8901-c3500bd1d952%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/CAPbPdOaKbJ1MiZbX_N_NAGHcakJd2bOF6YdRuc92bOP8bbnCFA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to