Coulemelle
Coulemelle

Reputation: 361

How Can I have job scope Credentials in Jenkins?

First sorry if this question and its solution exist somewhere but I cannot find it.

I would like to be able to create credentials inside a job and only usable inside this job, a kind of job scope credential.

For the moment Credential plugins only propose Global and System scope so the credentials are avaialble to all jobs.

The Credentials Binding Plugin does not seem to solve my problem either but to be fair, I am not sure to understand all its features and I would prefer not use text or file provider.

I use jenkins 1.589 Credential Plugin 1.18

Regards

Upvotes: 11

Views: 19835

Answers (2)

RRT
RRT

Reputation: 156

Using the Folders plugin in conjunction with the Credentials Binding plugin:

The Credentials plugin is folder-aware and will enhance the Configure page for Folders with a Credentials section. Credentials defined on a folder can only be used by builds within that folder.

You can further secure access to credentials to only specific users in your organization by combining the Credentials and Folder plugins with the Role Based Access Control plugin.

Source: https://support.cloudbees.com/hc/en-us/articles/203802500-Injecting-Secrets-into-Jenkins-Build-Jobs#usingfolderstocontrolcredentialusage

Upvotes: 8

Coulemelle
Coulemelle

Reputation: 361

The only think I found for the moment is to add in my profile credentials

either by going to
http://jenkinsHostname/user/myuser/credential-store/ or
http://jenkinsHostname/user/myuser/configure

and hope that the plugins which needs credentials accept credentials with USER scope.
It is not really JOB scope but USER scope. At least it is not GLOBAL or SYSTEM, so not accessible by other jobs from other user.

If another user wants to trigger a build, he will need to configure the job and put his credentials.

It works for the plugins I have implemented on my own but not for subversion plugin for instance which needs system or global credentials.

Upvotes: 0

Related Questions