diff options
author | Matt Rendina <mrendina@stsci.edu> | 2017-04-07 14:34:56 -0400 |
---|---|---|
committer | Matt Rendina <mrendina@stsci.edu> | 2017-04-07 14:34:56 -0400 |
commit | 58a590aa4995d4ab005a0d25a4e6e914d0460c30 (patch) | |
tree | 05a41496625a573990d7b6a9a2bad823328791bc /jenkins/package_builder.groovy | |
parent | 33f69dbeda8eb277f8485b9d8a3113c41a3e33ad (diff) | |
download | build_control-58a590aa4995d4ab005a0d25a4e6e914d0460c30.tar.gz |
Build granularity implementation
Diffstat (limited to 'jenkins/package_builder.groovy')
-rw-r--r-- | jenkins/package_builder.groovy | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/jenkins/package_builder.groovy b/jenkins/package_builder.groovy new file mode 100644 index 0000000..2391abf --- /dev/null +++ b/jenkins/package_builder.groovy @@ -0,0 +1,68 @@ +node(this.label) { + + dir(this.parent_workspace) { + + println("inherited workspace: ${this.parent_workspace}") + println("Nodelabel: ${this.label}") + println("${env.JOB_NAME}") + println("${env.JOB_BASE_NAME}") + println("${env.BUILD_NUMBER}") + println("${env.NODE_NAME}") + println("${env.WORKSPACE}") + println("${env.JENKINS_HOME}") + println(currentBuild.buildVariables) + println("parameter py_version: ${this.py_version}") + + env.PATH = "${this.parent_workspace}/miniconda/bin/:" + "${env.PATH}" + + // Make the log files a bit more deterministic + env.PYTHONUNBUFFERED = "true" + + this.OSname = null + uname = sh(script: "uname", returnStdout: true).trim() + if (uname == "Darwin") { + this.OSname = "MacOSX" + env.PATH = "${env.PATH}:/sw/bin" + this.CONDA_BLD_OUTPUT_DIR = "osx-64" + } + if (uname == "Linux") { + this.OSname = uname + this.CONDA_BLD_OUTPUT_DIR = "linux-64" + } + assert uname != null + println("${this.CONDA_BLD_OUTPUT_DIR}") + + // In directory common to all package build jobs, run conda build for this + // package. + dir("conda-recipes") { + + build_cmd = "conda build" + + stage("Build") { + build_args = "--no-test --no-anaconda-upload --python=${this.py_version}" + + " --numpy=${this.numpy_version} --skip-existing" + stat = 999 + + stat = sh(script: "${build_cmd} ${build_args} ${env.JOB_BASE_NAME}", + returnStatus: true) + println("Shell call returned status: ${stat}") + if (stat != 0) { + currentBuild.result = "FAILURE" + } + } + + stage("Test") { + build_args = "--test --no-anaconda-upload --python=${this.py_version}" + + " --numpy=${this.numpy_version} --skip-existing" + stat = sh(script: "${build_cmd} ${build_args} ${env.JOB_BASE_NAME}", + returnStatus: true) + println("Shell call returned status: ${stat}") + if (stat != 0) { + currentBuild.result = "UNSTABLE" + } + } + + } // end dir + } + +} //end node |