diff options
author | Matt Rendina <mrendina@stsci.edu> | 2017-08-29 14:47:23 -0400 |
---|---|---|
committer | Matt Rendina <mrendina@stsci.edu> | 2017-08-29 14:47:23 -0400 |
commit | 4a27427963ad9de3cbbbd9e8f56d2e0751a53daf (patch) | |
tree | a1f92518869dd0801c9838374d1e0d31dfe9971f | |
parent | 87e85f194b7906a48cafa865ff4196f92bdc916b (diff) | |
download | build_control-4a27427963ad9de3cbbbd9e8f56d2e0751a53daf.tar.gz |
Propagate branch and tag information
-rw-r--r-- | jenkins/dispatch.groovy | 6 | ||||
-rw-r--r-- | jenkins/generator_DSL.groovy | 12 | ||||
-rw-r--r-- | jenkins/job-suite-generator.groovy | 9 |
3 files changed, 24 insertions, 3 deletions
diff --git a/jenkins/dispatch.groovy b/jenkins/dispatch.groovy index fcf67d3..fcad873 100644 --- a/jenkins/dispatch.groovy +++ b/jenkins/dispatch.groovy @@ -64,6 +64,12 @@ node(LABEL) { // Get the manifest and build control files git branch: BUILD_CONTROL_BRANCH, url: BUILD_CONTROL_REPO + // If a tag was specified in the job-suite-generator configuration, + // explicitly check out that tag after cloning the (master) branch, + // since the 'git' pipeline step does not yet support accessing tags. + if (BUILD_CONTROL_TAG != "") { + sh(script: "git checkout tags/${BUILD_CONTROL_TAG}") + } this.manifest = readYaml file: "manifests/${MANIFEST_FILE}" if (this.manifest.channel_URL[-1..-1] == "/") { diff --git a/jenkins/generator_DSL.groovy b/jenkins/generator_DSL.groovy index 7dd10ea..36f65d5 100644 --- a/jenkins/generator_DSL.groovy +++ b/jenkins/generator_DSL.groovy @@ -13,9 +13,13 @@ this.script = "dispatch.groovy" this.build_control_repo = readFileFromWorkspace("VAR-build_control_repo") this.build_control_repo = this.build_control_repo.trim() + this.build_control_branch = readFileFromWorkspace("VAR-build_control_branch") this.build_control_branch= this.build_control_branch.trim() +this.build_control_tag = readFileFromWorkspace("VAR-build_control_tag") +this.build_control_tag = this.build_control_tag.trim() + // For each label (OS) in the list provided by the 'labels' job parameter, iterate // over each python version provided by the 'py_versions' job parameter, to obtain // every combination of OS and python version. Generate a separate job suite for @@ -30,7 +34,8 @@ for (label in labels.trim().tokenize()) { folder(suite_name) { description("Build suite generated: ${job_def_generation_time}\n" + "build control repo: ${build_control_repo}\n" + - "build control branch/tag: ${build_control_branch}\n" + + "build control branch: ${build_control_branch}\n" + + "build control tag: ${build_control_tag}\n" + "conda version: ${conda_version}\n" + "conda-build version: ${conda_build_version}\n" + "utils_repo: ${utils_repo}") @@ -55,6 +60,7 @@ for (label in labels.trim().tokenize()) { "PY_VERSION: ${py_version}\n" + "BUILD_CONTROL_REPO: ${build_control_repo}\n" + "BUILD_CONTROL_BRANCH: ${build_control_branch}\n" + + "BUILD_CONTROL_TAG: ${build_control_tag}\n" + "CONDA_VERSION: ${conda_version}\n" + "CONDA_BUILD_VERSION: ${conda_build_version}\n" + "CONDA_BASE_URL: ${conda_base_URL}\n" + @@ -67,6 +73,7 @@ for (label in labels.trim().tokenize()) { env("PY_VERSION", py_version) env("BUILD_CONTROL_REPO", build_control_repo) env("BUILD_CONTROL_BRANCH", build_control_branch) + env("BUILD_CONTROL_TAG", build_control_tag) env("CONDA_VERSION", conda_version) env("CONDA_BUILD_VERSION", conda_build_version) env("CONDA_BASE_URL", conda_base_URL) @@ -100,6 +107,9 @@ for (label in labels.trim().tokenize()) { stringParam("build_control_branch", "build_control_branch-DEFAULTVALUE", "Branch checked out to obtain build system scripts.") + stringParam("build_control_tag", + "build_control_tag-DEFAULTVALUE", + "Tag checked out to obtain build system scripts.") stringParam("py_version", "py_version-DEFAULTVALUE", "python version to use") diff --git a/jenkins/job-suite-generator.groovy b/jenkins/job-suite-generator.groovy index 1015d02..3be3428 100644 --- a/jenkins/job-suite-generator.groovy +++ b/jenkins/job-suite-generator.groovy @@ -38,6 +38,7 @@ node("master") { // Both 'scm.getUserRemoteConfigs' and 'getUrl' require script approval build_control_repo = scm.getUserRemoteConfigs()[0].getUrl() + build_control_tag = "" sh "echo ${build_control_repo} > VAR-build_control_repo" // Get branch spec component after last '/' character. @@ -45,11 +46,13 @@ node("master") { // when specified in the job-suite-generator job configuration. // This may also describe a tag, rather than a branch. if (build_control_branch.find("tags") != null) { - build_control_branch = scm.branches[0].toString() - } else { + build_control_branch = "master" + build_control_tag = build_control_branch.tokenize("/") + } else { // a branch, including */master build_control_branch = scm.branches[0].toString().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 @@ -61,12 +64,14 @@ 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" + "py_versions: ${this.py_versions}\n" + "conda_version: ${this.conda_version}\n" + "conda_build_version: ${this.conda_build_version}\n" + + "conda_build_tag: ${this.conda_build_tag}\n" + "conda_base_URL: ${this.conda_base_URL}\n" + "utils_repo: ${this.utils_repo}\n" + "old_jobs_action: ${this.old_jobs_action}\n" + |