How to use multiple credentials in withCredentials in Jenkins Pipeline

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')
]){
    //...
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)