-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
I have an XML template that contains a single publisher XML snippet that I want to dynamically expand to multiple instances of the same snippet, but of course with different configuration for each.
While I figured out that I can easily add new nodes via the leftShift operator on the projectXml, I don't seem to be able to override the child elements of the just copied nodes, because they're not yet visible.
I came up with the following workaround, but I found that rather ugly:
jenkins {
templates {
hockeyupload_bare {
xml file('path/to/hockeyupload.xml')
}
hockeyupload_multiplied {
xml jenkins.templates.hockeyupload_bare.override { projectXml ->
if (project.ext.hockeyAppIds.size() > 1) {
(1..project.ext.hockeyAppIds.size() - 1).each {
projectXml.publishers << projectXml.publishers["hockeyapp.HockeyappRecorder"]
}
}
}
}
hockeyupload {
xml templates.hockeyupload_multiplied.override { projectXml ->
def item = 0
project.ext.hockeyAppIds.each { hockeyAppid ->
projectXml.publishers["hockeyapp.HockeyappRecorder"][item].applications["hockeyapp.HockeyappApplication"].with {
// specific overrides ..
}
++item
}
}
}
}
}
Am I missing something or should this plugin somehow gain "flush" support to avoid these kind of hacks?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels