How to generate "credentialsId" for stash notifier using principal and password

78 views
Skip to first unread message

David Karr

unread,
Nov 25, 2016, 4:10:39 PM11/25/16
to Jenkins Users
I'm using Bitbucket server and Jenkins.

I've defined a pipeline job that will be spawned from bitbucket when commits are pushed to a branch, either from the main webhook or a pull request notification.

The pipeline job has to use the stash notifier plugin to notify bitbucket/stash of the results of the build.

Looking at the examples of using "StashNotifier", I'm wondering whether I have more options for providing the "credentialsId" value.  I'm guessing I could generate this value in the snippet generator and then paste it into my pipeline job, or I could define a job parameter and paste that value in as the default value.

I don't really like either option.  I'd really like to be able to configure a credentials object in the job configuration, where I only specified a principal and password, and then simply generate the credentialsId in the pipeline job.  Alternatively, I could specify separate principal and password job parameters, but still generate the credentialsId within the pipeline code.  Are either of these possible/practical?

David Karr

unread,
Nov 25, 2016, 4:45:41 PM11/25/16
to Jenkins Users
Never mind.  I didn't notice the "Credentials Parameter" until now.  It looks like that will be all that I need.

However, now I'm wondering about another place where I had to hardcode a hash into my pipeline script, being a file id for a Maven settings.xml file. I'll pursue that separately.
Reply all
Reply to author
Forward
0 new messages