问题
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
回答1:
Using the Folders and Credentials Binding plugin, you can define credentials on the folder level that are only available for the job(s) inside this folder. The folder level store becomes available once you made the folder.
Source: https://support.cloudbees.com/hc/en-us/articles/203802500-Injecting-Secrets-into-Jenkins-Build-Jobs
回答2:
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.
来源:https://stackoverflow.com/questions/27102634/how-can-i-have-job-scope-credentials-in-jenkins