How can I change the branch name using jenkins-cli ?

5 views
Skip to first unread message

user-dev

unread,
Sep 13, 2016, 10:23:43 AM9/13/16
to Jenkins Developers
I am trying to change the branch of git scm inside jenkins jobs using groovy scipt. But is always getting set to master no matter what values I pass.

for (project in all_jobs){
  
  scm = project.scm;
  //def oldScm = item.getScm()
    println("${project.name}: " +
            "repositories: ${scm.repositories.collectMany{ it.getURIs() }}")
 
  scm.branches = "some-branch"
  println "Test" + scm.branches
}

It prints the changed value but not getting saved
Reply all
Reply to author
Forward
0 new messages