diff options
author | Matt Rendina <rendinam@users.noreply.github.com> | 2018-01-12 10:19:56 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-12 10:19:56 -0500 |
commit | 2a12e683a0742d5624f8280f89758ccf03dea129 (patch) | |
tree | 49cc3545e91acc586bb3ed00de60837c1b9e8075 | |
parent | a3ffcc4338d57d70b333afce507b53a916cf6c12 (diff) | |
download | build_control-2a12e683a0742d5624f8280f89758ccf03dea129.tar.gz |
Manifest data propagation correction (#52)
* Adjust propagation of manifest data
* Test propagation of manifest data
-rw-r--r-- | jenkins/dispatch.groovy | 10 | ||||
-rw-r--r-- | jenkins/generator_DSL.groovy | 18 |
2 files changed, 19 insertions, 9 deletions
diff --git a/jenkins/dispatch.groovy b/jenkins/dispatch.groovy index e02b0cc..fa293a6 100644 --- a/jenkins/dispatch.groovy +++ b/jenkins/dispatch.groovy @@ -1,6 +1,7 @@ // Parameters inherited from the calling script via environment injection. //---------------------------------------------------------------------------- // MANIFEST_FILE - The "release" type; list of recipes/packages to build +// MANIFEST_DATA - Content of manifest file used in creating this job. // LABEL - Node or logical group of build nodes // PY_VERSION - Python version hosted by conda to support the build // NUMPY_VERSION - numpy version used to support the build @@ -97,10 +98,11 @@ node(LABEL) { sh(script: "git checkout tags/${BUILD_CONTROL_TAG}") } - this.manifest = readYaml file: "manifests/${MANIFEST_FILE}" - if (this.manifest.channel_URL[-1..-1] == "/") { - this.manifest.channel_URL = this.manifest.channel_URL[0..-2] - } + // Turn multi-line env var delimiters into simple newlines for + // correct parsing by readYaml. + manifest_data = MANIFEST_DATA.replaceAll(" \\\\n", "\n") + println("\nmanifest_data:\n${manifest_data}") + this.manifest = readYaml text: manifest_data this.pins_file = readYaml file: "jenkins/${this.version_pins_file}" diff --git a/jenkins/generator_DSL.groovy b/jenkins/generator_DSL.groovy index e181455..c18085c 100644 --- a/jenkins/generator_DSL.groovy +++ b/jenkins/generator_DSL.groovy @@ -1,13 +1,20 @@ -// Job generator script. Uses Job-DSL plugin API. - -// Third party YAML parsing class. Obtain from URL below before use. +// Job generator script. Uses Job-DSL plugin API. // Third party YAML parsing class. Obtain from URL below before use. // https://repo1.maven.org/maven2/org/yaml/snakeyaml/1.17/snakeyaml-1.17.jar import org.yaml.snakeyaml.Yaml def yaml = new Yaml() -def config = yaml.load(readFileFromWorkspace("manifests/${manifest_file}")) -def job_def_generation_time = new Date() +this.manifest_data_raw = readFileFromWorkspace("manifests/${manifest_file}") +println("\n\nmanifest_data_raw:\n ${this.manifest_data_raw}") +def config = yaml.load(manifest_data_raw) +// Add delimiters so that multi-line data may be incorporated into downstream +// build jobs as an environment variable value. +this.manifest_data = "" +for (line in this.manifest_data_raw.tokenize('\n')) { + this.manifest_data = "${this.manifest_data}${line} \\\\n" //works +} + +def job_def_generation_time = new Date() this.script = "dispatch.groovy" @@ -91,6 +98,7 @@ for (label in labels.trim().tokenize()) { env("JOB_DEF_GENERATION_TIME", job_def_generation_time) env("SCRIPT", this.script) env("MANIFEST_FILE", manifest_file) + env("MANIFEST_DATA", this.manifest_data) env("LABEL", label) env("PY_VERSION", py_version) env("NUMPY_VERSION", numpy_version) |