folder() wipes folder-specific credentials if the folder already exists

94 views
Skip to first unread message

gujenkin

unread,
Jun 6, 2017, 5:16:25 PM6/6/17
to job-dsl-plugin
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")?

gujenkin

unread,
Jul 5, 2017, 1:12:37 PM7/5/17
to job-dsl-plugin
Anyone knows why folder("some existing folder") erases the credentials inside that folder?

Michael Kobit

unread,
Jul 13, 2017, 10:23:54 PM7/13/17
to job-dsl-plugin
This happens to us as well when using the OrganizationFolderJob - we havent found a good way around it yet, so we have to reload them after every job DSL execution right now.
Reply all
Reply to author
Forward
0 new messages