How to get username password stored in Jenkins credentials separately in jenkinsfile

前端 未结 2 648
抹茶落季
抹茶落季 2021-02-12 17:28

I\'ve stored username and password as credentials in jenkins. Now I would like to use them in my Jenkinsfile.

I am using withCredentials DSL, however, I\'m

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-12 18:21

    Here is a tiny bit simpler version of StephenKing's answer

    withCredentials([usernamePassword(credentialsId: 'mycreds', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
      sh 'cf login some.awesome.url -u $USERNAME -p $PASSWORD'
    
    }
    

提交回复
热议问题