Created
October 29, 2014 22:40
-
-
Save retronym/0cd43825b03b42f5128f to your computer and use it in GitHub Desktop.
jenkins job cloning
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
def projects = [ | |
"scala-nightly-checkinit", | |
"scala-nightly-main", | |
"scala-nightly-rangepos", | |
"scala-nightly-windows" | |
] | |
inst = jenkins.model.Jenkins.instance; | |
def oldVersion = "2.10.x" | |
def newVersion = "2.11.x" | |
for (p in projects) { | |
def templateProject = inst.getItem(p + "-" + oldVersion); | |
def newProject = inst.copy(templateProject, p + "-" + newVersion); | |
println("created " + newProject); | |
def branchParam = newProject.actions.find{ it instanceof ParametersDefinitionProperty }?.getParameterDefinition("branch"); | |
if (branchParam != null) { | |
branchParam.setDefaultValue(newVersion) ; | |
println("found and updated branch parameter"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment