How can I configure a global jenkins credential?

From the documentation I can set it up per project or repository, but I'd like to set the credential globally, because I will have so many projects and repos. 

1 answer

Unfortunately Stash does not currently have any way to set a global SSH access key, however SSH keys are manageable via REST, so you could script adding the Jenkins SSH key to all projects (which would then apply to all repositories).

For example to add an Access Key to the PROJECT project:

curl -u user:pass \
	-X POST \
	-H "Accept: application/json" \
	-H "Content-Type: application/json" \
	http://stash.server/rest/keys/1.0/projects/PROJECT/ssh \
	-d '{"key": { "text": "ssh-rsa ...." }, "permission": "PROJECT_READ"}'

You could create a script that used the Projects resource to get a list of all Projects in Stash, and then POST the Jenkins SSH key for each of those. Duplicate keys are handled gracefully, so there wouldn't be any harm running this for a project that had already had that key added.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

1,929 views 1 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you