Hello,
I'm not sure whether this is a bug or is by design.
Environment and other plugins:
Jenkins 2.19.4
Credentials Plugin
Credentials Binding Plugin
Plain Credentials Plugin
CloudBees Folders Plugin
Problem:
When we generate a build folder using folder("foo") in our .groovy file, and then manually add credentials to that folder, subsequent calls to folder("foo") in the generator build result in the credentials being lost.
Exact repro steps
I have a job definition .groovy script with the following:
...
folder("test_folder")
...
The folder gets generated correctly when it doesn't exist.
Then I do the following:
- Navigate to the newly created "test_folder" folder
- Add some secret to the folder's global credentials
- Click "Credentials" on the left navigation menu
- Click "Folder" under Credentials
- Click "Global credentials (unrestricted)"
- Click "Add Credentials"
- Add some dummy secret text
- Trigger a new run of the .groovy file to generate the build definition again
Result: The "test_folder" folder is still there, but if I look under "test_folder" > "Credentials" > "Folder" > "Global credentials", the secret text I previously added is gone.
Question:
Is this intended? If yes, how can I make it so "foo" folder's credentials are not wiped by subsequent calls to folder("foo")?