aboutsummaryrefslogtreecommitdiff
path: root/jenkins/job-suite-generator.groovy
diff options
context:
space:
mode:
Diffstat (limited to 'jenkins/job-suite-generator.groovy')
-rw-r--r--jenkins/job-suite-generator.groovy15
1 files changed, 13 insertions, 2 deletions
diff --git a/jenkins/job-suite-generator.groovy b/jenkins/job-suite-generator.groovy
index c53ec2e..7a2546d 100644
--- a/jenkins/job-suite-generator.groovy
+++ b/jenkins/job-suite-generator.groovy
@@ -37,15 +37,25 @@ node("master") {
// value to the jobDSL script.
// Both 'scm.getUserRemoteConfigs' and 'getUrl' require script approval
- build_control_repo= scm.getUserRemoteConfigs()[0].getUrl()
+ build_control_repo = scm.getUserRemoteConfigs()[0].getUrl()
+ build_control_tag = ""
sh "echo ${build_control_repo} > VAR-build_control_repo"
+ build_control_bt_spec = scm.branches[0].toString()
// Get branch spec component after last '/' character.
// Branch names themselves shall not have slashes in them
// when specified in the job-suite-generator job configuration.
// This may also describe a tag, rather than a branch.
- build_control_branch = scm.branches[0].toString().tokenize("/")[-1]
+ // Requires in-process script approval for:
+ // java.lang.String java.lang.String (.find method)
+ if (build_control_bt_spec.find("tags") != null) {
+ build_control_branch = "master"
+ build_control_tag = build_control_bt_spec.tokenize("/")[-1]
+ } else { // a branch, including */master
+ build_control_branch = build_control_bt_spec.tokenize("/")[-1]
+ }
sh "echo ${build_control_branch} > VAR-build_control_branch"
+ sh "echo ${build_control_tag} > VAR-build_control_tag"
// 'Parameters' variables are provided by the execution of the
// generator build task with parameters. Each is populated by a
@@ -57,6 +67,7 @@ node("master") {
println(" From job config:\n" +
"build_control_repo: ${build_control_repo}\n" +
"build_control_branch: ${build_control_branch}\n" +
+ "build_control_tag: ${build_control_tag}\n" +
" Parameters:\n" +
"manifest_file: ${this.manifest_file}\n" +
"labels: ${this.labels}\n" +