Jenkins Pipeline to be generic

67 views
Skip to first unread message

krish

unread,
Apr 12, 2018, 3:06:19 PM4/12/18
to Jenkins Users
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

srivathsa...@gmail.com

unread,
Apr 13, 2018, 7:11:57 PM4/13/18
to Jenkins Users

Srivathsa Reddy

unread,
Apr 14, 2018, 5:35:41 AM4/14/18
to jenkins...@googlegroups.com
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>
				  
				  }

		}
}



--
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+unsubscribe@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.
For more options, visit https://groups.google.com/d/optout.

krish

unread,
Apr 17, 2018, 10:10:27 AM4/17/18
to Jenkins Users
Thanks Guys. That works
Reply all
Reply to author
Forward
0 new messages