For multiple usages of withCredentials:

node {
                withCredentials([[$class: 'UsernamePasswordMultiBinding',
                                  credentialsId: "TokenID_1",
                                  usernameVariable: 'USERNAME_1',
                                  passwordVariable: 'PASSWORD_1']]) {
                                
                                  stage('stage1'){
                                
                                  <YOUR TASKS>
                                
                                  }

                }
                withCredentials([[$class: 'UsernamePasswordMultiBinding',
                                  credentialsId: "TokenID_2",
                                  usernameVariable: 'USERNAME_2',
                                  passwordVariable: 'PASSWORD_2']]) {
                                
                                  stage('stage2'){
                                
                                  <YOUR TASKS>
                                
                                  }

                }
}




On Fri, Apr 13, 2018 at 6:12 PM, <srivathsa.puliy...@gmail.com> wrote:

> You can use *withCredentials*
>
> https://jenkins.io/doc/pipeline/steps/credentials-binding/
>
>
> On Thursday, April 12, 2018 at 3:06:19 PM UTC-4, krish wrote:
>>
>> Hi,
>>
>> how can we use the multiple credentials into jenkins pipeline, in our
>> environment diff applications have diff userid and password, is their a
>> smarter way to define this in jenkins pipeline
>>
>> thank you
>>
> --
> 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-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/jenkinsci-users/d8855c70-3343-4fce-862c-1293ffb3ce1a%40googlegroups.
> com
> <https://groups.google.com/d/msgid/jenkinsci-users/d8855c70-3343-4fce-862c-1293ffb3ce1a%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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAFB%2B0W6VLjZc5NTkgoEgW6OBWw7Q2WZjn%3DFD%2BwOGkXD8S5pxeQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to