Created
March 4, 2015 14:50
-
-
Save NicolasGeraud/0902dee65070d082152b to your computer and use it in GitHub Desktop.
JENKINS - add git branch and rename
This file contains hidden or 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
import hudson.model.* | |
import hudson.plugins.git.* | |
changeBranche(Jenkins.instance.items) | |
def changeBranche(items) { | |
println items.size | |
for (item in items) { | |
if (item =~ "Feature*") { | |
print(item.name) | |
println(item.scm.branches) | |
if(item.scm.branches.size() == 1) { | |
if(item.scm.branches[0].name != "*/master") { | |
println "rename " + item.scm.branches[0].name + " to */master" | |
item.scm.branches[0].name = "*/master" | |
} | |
item.scm.branches.add(new BranchSpec("*/tma/*")) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment