How to use multiple credentials in withCredentials in Jenkins Pipeline

后端 未结 2 1095
小蘑菇
小蘑菇 2021-02-02 05:05

I have the following step in my declarative jenkins pipeline: I create script which comes from my resources/ folder using libraryResource. This script contains cred

2条回答
  •  梦如初夏
    2021-02-02 05:50

    Sure, you can use one withCredentials block to assign multiple credentials to different variables.

    withCredentials([
        usernamePassword(credentialsId: credsId1, usernameVariable: 'USER1', passwordVariable: 'PASS1'),
        usernamePassword(credentialsId: credsId2, usernameVariable: 'USER2', passwordVariable: 'PASS2')
    ]){
        //...
    }
    

提交回复
热议问题