Issue
-
Want to inject the secret settings.xml at folder level to have it available for the jobs inside the folder
Environment
-
CloudBees Jenkins Enterprise
This does not work in CloudBees Jenkins Operations Center. This only works with CloudBees Jenkins Enterprise and Jenkins LTS/OSS releases. |
Resolution
Following plugins need to be installed in your CloudBees Jenkins Enterprise instance:
Then, let’s say you have a folder called maven-folder in your instance.
![folder.png](../../../common-kb/latest/_images/folder.fe6b0f6.png)
As you might already know, you are able to use the credential plugin at folder level. So all you need to inject a secret file.
![folder-credentials.png](../../../common-kb/latest/_images/folder-credentials.7976749.png)
Now, at job level you need to create a bind in which you will specify the variable you would like to use.
![binding.png](../../../common-kb/latest/_images/binding.d9d731a.png)
Finally, the only thing we still need to do is to tell maven to use the secret file.
![mvn-setup.png](../../../common-kb/latest/_images/mvn-setup.77a4449.png)
Now, when you build you can see the secret file is correctly injected.
![console-output.png](../../../common-kb/latest/_images/console-output.112bd59.png)