-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
Job DSL Plugin 1.39
Jenkins ver. 1.636
Ubuntu 14.04 GNU/Linux
Let's say you have a simple job dsl script which creates a folder.
folder("myfolder") {}
One might notice the "Credentials" menu item is not available when an admin enters said folder. This is because Job DSL is not creating an appropriate XML block to account for credentials.
If you want to see the credentials then one would have to:
- Configure the folder.
- Save the settings.
Now the Credentials menu item shows up. One could then create a diff before/after modifying config.xml of that folder to see what is missing. I did that and to include the credentials link you must add a little bit of extra XML via the advanced Job DSL Configure block. Here's an example of a properly generated folder with Credentials menu item included.
folder("myfolder") { configure { node -> def credentials_folder = node / 'properties' / 'com.cloudbees.hudson.plugins.folder.properties.FolderCredentialsProvider_-FolderCredentialsProperty' def entry = credentials_folder / 'domainCredentialsMap'(class: 'hudson.util.CopyOnWriteMap$Hash') / 'entry' entry / 'com.cloudbees.plugins.credentials.domains.Domain'(plugin: 'credentials') { 'specifications' } entry.appendNode('java.util.concurrent.CopyOnWriteArrayList') } }
I believe that creating a folder() should do this automatically for any user. Otherwise, it is creating a folder with reduced functionality and options. The Credentials menu item is provided by the credentials plugin which comes with Jenkins by default.