aboutsummaryrefslogtreecommitdiff
path: root/jenkins
diff options
context:
space:
mode:
authorMatt Rendina <mrendina@stsci.edu>2017-12-20 12:20:46 -0500
committerMatt Rendina <mrendina@stsci.edu>2017-12-21 10:29:24 -0500
commitc79da534cb9e490139d7dfc6df4d2f3e3bc6b875 (patch)
tree59b25343ebd38c34116833733166add52572fc90 /jenkins
parentd2de26fd3ee9ec9156a1e64b1f28c6ae23157529 (diff)
downloadbuild_control-c79da534cb9e490139d7dfc6df4d2f3e3bc6b875.tar.gz
Allow supplemental environment variables to be applied to jobs.
Allow recipe repository branch specification in manifest.
Diffstat (limited to 'jenkins')
-rw-r--r--jenkins/dispatch.groovy16
-rw-r--r--jenkins/generator_DSL.groovy10
-rw-r--r--jenkins/package_builder.groovy10
-rw-r--r--jenkins/scheduled_trigger.groovy10
4 files changed, 39 insertions, 7 deletions
diff --git a/jenkins/dispatch.groovy b/jenkins/dispatch.groovy
index b537f7c..ed3639f 100644
--- a/jenkins/dispatch.groovy
+++ b/jenkins/dispatch.groovy
@@ -33,8 +33,18 @@ this.publication_lock_wait_s = 10
// Packages that appear in this file will be pinned to the version indicated.
this.version_pins_file = "version_pins.yml"
+
node(LABEL) {
+ // Add any supplemental environment vars to the build environment.
+ for (env_var in this.supp_env_vars.trim().tokenize()) {
+ def key = env_var.tokenize("=")[0]
+ def val = env_var.tokenize("=")[1]
+ // env[] assignment requires in-process script approval for signature:
+ // org.codehaus.groovy.runtime.DefaultGroovyMethods putAt java.lang.Object
+ env[key] = val
+ }
+
// Delete any existing job workspace directory contents.
// The directory deleted is the one named after the jenkins pipeline job.
deleteDir()
@@ -74,6 +84,7 @@ 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.
@@ -151,7 +162,7 @@ node(LABEL) {
// Get conda recipes
dir(this.recipes_dir) {
- git url: this.manifest.repository
+ git branch: this.manifest.git_ref_spec, url: this.manifest.repository
}
// Get build utilities
@@ -224,7 +235,7 @@ node(LABEL) {
println("${this.version_pins_file} has no packages list, skipping pin environment creation.")
this.use_version_pins = "false"
}
-
+
// (conda-build 3.x only)
// Create and populate environment to be used for pinning reference when
// building packages via the --bootstrap flag. Environment creation is done
@@ -294,6 +305,7 @@ node(LABEL) {
string(name: "cull_manifest", value: this.cull_manifest),
string(name: "channel_URL", value: this.manifest.channel_URL),
string(name: "use_version_pins", value: this.use_version_pins),
+ text(name: "supp_env_vars", value: this.supp_env_vars)
],
propagate: false
}
diff --git a/jenkins/generator_DSL.groovy b/jenkins/generator_DSL.groovy
index b9a3967..cace2f5 100644
--- a/jenkins/generator_DSL.groovy
+++ b/jenkins/generator_DSL.groovy
@@ -41,7 +41,6 @@ for (label in labels.trim().tokenize()) {
//-----------------------------------------------------------------------
// Create a folder to contain the jobs which are created below.
-
suite_name = "${manifest_file.tokenize(".")[0]}_${label}_py${py_version}_np${numpy_version}"
folder(suite_name) {
description("Build suite generated: ${job_def_generation_time}\n" +
@@ -65,6 +64,10 @@ for (label in labels.trim().tokenize()) {
"Whether or not package recipes that would generate a " +
"package file name that already exists in the manfest's" +
" channel archive are removed from the build list.")
+ textParam("supp_env_vars",
+ "",
+ "List of supplemental environment variables to define " +
+ "in the build envioronment.")
}
logRotator {
numToKeep(this.num_builds_to_keep)
@@ -108,7 +111,6 @@ for (label in labels.trim().tokenize()) {
//-----------------------------------------------------------------------
// Generate the series of actual package building jobs.
-
for(pkg in config.packages) {
pipelineJob("${suite_name}/${pkg}") {
@@ -153,6 +155,10 @@ for (label in labels.trim().tokenize()) {
stringParam("use_version_pins",
"false",
"Whether or not to use global version pins.")
+ textParam("supp_env_vars",
+ "",
+ "List of supplemental environment variables to define " +
+ "in the build environment.")
}
definition {
cps {
diff --git a/jenkins/package_builder.groovy b/jenkins/package_builder.groovy
index c4ec473..51ff9c8 100644
--- a/jenkins/package_builder.groovy
+++ b/jenkins/package_builder.groovy
@@ -6,6 +6,15 @@ this.build_status_file = "${this.parent_workspace}/propagated_build_status"
node(this.label) {
+ // Add any supplemental environment vars to the build environment.
+ for (env_var in this.supp_env_vars.trim().tokenize()) {
+ def key = env_var.tokenize("=")[0]
+ def val = env_var.tokenize("=")[1]
+ // env[] assignment requires in-process script approval for signature:
+ // org.codehaus.groovy.runtime.DefaultGroovyMethods putAt java.lang.Object
+ env[key] = val
+ }
+
dir(this.parent_workspace) {
env.PATH = "${this.parent_workspace}/miniconda/bin/:" + "${env.PATH}"
@@ -40,6 +49,7 @@ node(this.label) {
"parameter cull_manifest: ${this.cull_manifest}\n" +
"parameter channel_URL: ${this.channel_URL}\n" +
"parameter use_version_pins: ${this.use_version_pins}\n" +
+ "parameter supp_env_vars: ${this.supp_env_vars}\n" +
"PATH: ${env.PATH}\n" +
"PYTHONPATH: ${env.PYTHONPATH}\n" +
"PYTHONUNBUFFERED: ${env.PYTHONUNBUFFERED}\n")
diff --git a/jenkins/scheduled_trigger.groovy b/jenkins/scheduled_trigger.groovy
index e8a3bdd..d1a5296 100644
--- a/jenkins/scheduled_trigger.groovy
+++ b/jenkins/scheduled_trigger.groovy
@@ -38,7 +38,7 @@ node("master") {
// to parameters used to control the behavior of this job). Compose
// the URL string used to pass those parameter values to the jobs
// being triggered via the REST API.
- params_url = "?"
+ params_url = ""
params.each {
key = it.key.toString()
val = it.value.toString()
@@ -47,7 +47,8 @@ node("master") {
index = this.job_param_id.size()
param_name = key[index..-1].trim()
println(param_name)
- params_url = "${params_url}${param_name}=${val}"
+ params_url = "${params_url}${param_name}=${val}\\&"
+ println("LOOP params_url: ${params_url}")
}
}
@@ -62,8 +63,11 @@ node("master") {
println("Platforms:\n${PLATFORMS}")
for (platform in PLATFORMS.tokenize()) {
println("Triggering _dispatch job for ${platform}...")
+ //trigger_url = "http://${url_base}/job/${abs_jobs_folder}/job/${platform}/" +
+ // "job/_dispatch/buildWithParameters${params_url} " +
+ // "-u ${USERNAME}:${PASSWORD}"
trigger_url = "http://${url_base}/job/${abs_jobs_folder}/job/${platform}/" +
- "job/_dispatch/buildWithParameters${params_url} " +
+ "job/_dispatch/buildWithParameters?${params_url} " +
"-u ${USERNAME}:${PASSWORD}"
println(trigger_url)
sh (script: "curl -s -S -X POST -H ${CRUMB} ${trigger_url}")