当前位置:网站首页>Groovy obtains Jenkins credentials through withcredentials

Groovy obtains Jenkins credentials through withcredentials

2022-06-24 09:58:00 Operation and maintenance @ small soldier

One 、 Account and password credentials

Create credentials

 Insert picture description here
 Insert picture description here
 Insert picture description here

Script

#!groovy

withCredentials([usernamePassword(credentialsId: 'NODE',usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]){
    
	def password = URLEncoder.encode(PASSWORD, "UTF-8")		// When password is used in URL In the middle of the day , Coding is also required . Such as git clone
    println USERNAME
    println password
}
原网站

版权声明
本文为[Operation and maintenance @ small soldier]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/175/202206240732547802.html