-
Notifications
You must be signed in to change notification settings - Fork 829
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1232 from jamietanna/defect/credentials-on-folders
Fix: Don't destroy credentials when re-creating folders
- Loading branch information
Showing
5 changed files
with
103 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/DslItemConfigurer.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package javaposse.jobdsl.plugin | ||
|
||
import com.cloudbees.hudson.plugins.folder.AbstractFolderProperty | ||
import hudson.model.Items | ||
import javaposse.jobdsl.dsl.Item | ||
|
||
class DslItemConfigurer { | ||
private static final String XML_HEADER = "<?xml version='1.1' encoding='UTF-8'?>" | ||
|
||
/** | ||
* Merge an {@link AbstractFolderProperty} into a new {@link Item}'s properties. | ||
* | ||
* @param item the property to merge | ||
* @param dslItem the DSL item to merge the properties into | ||
*/ | ||
static void mergeCredentials(AbstractFolderProperty<?> property, Item dslItem) { | ||
String xml = Items.XSTREAM2.toXML(property) | ||
Node node = new XmlParser().parseText(XML_HEADER + xml) | ||
dslItem.configure { p -> p / 'properties' << node } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<com.cloudbees.hudson.plugins.folder.Folder> | ||
</com.cloudbees.hudson.plugins.folder.Folder> |