I am creating a new job in Jenkins by copying a template job. For a template with single repository I am using the below code to change the branches to build section.
job('example') {
using('template_job')
configure { node ->
node / scm / branches / 'hudson.plugins.git.BranchSpec' {
name 'branchname'
}
}
}
But now my template job has multiple respositories and I have to change the branches to build for just one of the repositories using a Configure Block. How can I achieve this.
I have tried the below code as well.Its not working, no changes are done. Will any modification of this work?
configure {node ->
node / scm/ 'hudson.plugins.git.GitSCM'[1] / branches / 'hudson.plugins.git.BranchSpec'{
name branchName1
};
}