Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
[CD] switch CD_RELEASE_JOB_NAME from global env var to job argument (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
szha committed Mar 13, 2020
1 parent 18c2a26 commit 34010ea
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
11 changes: 6 additions & 5 deletions cd/Jenkinsfile_cd_pipeline
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pipeline {
script {
cd_utils = load('cd/Jenkinsfile_utils.groovy')
// Update release job state in Jenkins
cd_utils.update_release_job_state()
cd_utils.update_release_job_state(params.CD_RELEASE_JOB_NAME)
}
}
}
Expand All @@ -58,27 +58,28 @@ pipeline {

"Static libmxnet based release": {
stage("Build") {
cd_utils.trigger_release_job("Build static libmxnet", "mxnet_lib/static", params.MXNET_VARIANTS)
cd_utils.trigger_release_job(params.CD_RELEASE_JOB_NAME, "Build static libmxnet", "mxnet_lib/static", params.MXNET_VARIANTS)
}
stage("Releases") {
cd_utils.error_checked_parallel([
"PyPI Release": {
echo "Building PyPI Release"
cd_utils.trigger_release_job("Release PyPI Packages", "python/pypi", params.MXNET_VARIANTS)
cd_utils.trigger_release_job(params.CD_RELEASE_JOB_NAME, "Release PyPI Packages", "python/pypi", params.MXNET_VARIANTS)
},
"Python Docker Release": {
echo "Building Python Docker Release"
cd_utils.trigger_release_job("Release Python Docker Images", "python/docker", params.MXNET_VARIANTS)
cd_utils.trigger_release_job(params.CD_RELEASE_JOB_NAME, "Release Python Docker Images", "python/docker", params.MXNET_VARIANTS)
}
])
}
},

"Dynamic libmxnet based release": {
stage("Build") {
cd_utils.trigger_release_job("Build dynamic libmxnet", "mxnet_lib/dynamic", params.MXNET_VARIANTS)
cd_utils.trigger_release_job(params.CD_RELEASE_JOB_NAME, "Build dynamic libmxnet", "mxnet_lib/dynamic", params.MXNET_VARIANTS)
}
}

])
}
}
Expand Down
2 changes: 1 addition & 1 deletion cd/Jenkinsfile_release_job
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pipeline {
|Release Build: ${params.RELEASE_BUILD}
|Commit Id: ${env.GIT_COMMIT}
|Branch: ${env.GIT_BRANCH}
|Variants: ${env.MXNET_VARIANTS}""".stripMargin()
|Variants: ${params.MXNET_VARIANTS}""".stripMargin()
}
}
}
Expand Down
20 changes: 10 additions & 10 deletions cd/Jenkinsfile_utils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@

// Triggers a downstream jenkins job responsible for building, testing
// and publishing all the variants for a particular 'job_type'.
// The 'job_type' should be the name of the directory that contains the
// 'Jenkins_pipeline.groovy' file and has the pipeline definition for the
// The 'job_type' should be the name of the directory that contains the
// 'Jenkins_pipeline.groovy' file and has the pipeline definition for the
// artifact (docker image, binary, pypi or maven package, etc.) that should
// be published.

STATE_UPDATE="State Update"

def trigger_release_job(job_name, job_type, mxnet_variants) {
def trigger_release_job(cd_release_job, job_name, job_type, mxnet_variants) {
def run = build(
job: env.CD_RELEASE_JOB_NAME,
job: cd_release_job,
parameters: [
string(name: "RELEASE_JOB_NAME", value: "${job_name}"),
string(name: "RELEASE_JOB_TYPE", value: "${job_type}"),
Expand All @@ -49,7 +49,7 @@ def trigger_release_job(job_name, job_type, mxnet_variants) {
// continue with the pipeline and try to post as many releases as possible
// but mark it as unstable
if (result == "UNSTABLE" || result == "ABORTED") {
currentBuild.result = "UNSTABLE"
currentBuild.result = "UNSTABLE"
}

// Throw an exception on failure, because this would mean the whole
Expand All @@ -65,12 +65,12 @@ def trigger_release_job(job_name, job_type, mxnet_variants) {
// the configuration of the release job in jenkins
// to the configuration of release job as defined in the
// Jenkinsfile _release_job for env.GIT_COMMIT revision
def update_release_job_state() {
def update_release_job_state(cd_release_job) {
build(
job: env.CD_RELEASE_JOB_NAME,
job: cd_release_job,
parameters: [
string(name: "RELEASE_JOB_TYPE", value: STATE_UPDATE),

// Should be set to the current git commit
string(name: "COMMIT_ID", value: "${env.GIT_COMMIT}")
])
Expand Down Expand Up @@ -103,7 +103,7 @@ def wrap_variant_pipeline_fn(variant_pipeline, total_num_pipelines) {
// The outcome of the execution of each parallel step will affect
// the result (SUCCESS, FAILURE, ABORTED, UNSTABLE) of the overall job.
// If all steps fail or are aborted, the job will be set to failed.
// If some steps fail or are aborted, the job will be set to unstable.
// If some steps fail or are aborted, the job will be set to unstable.
def error_checked_parallel(variant_pipelines) {
pipelines = variant_pipelines.inject([:]) { mp, key, value ->
mp << ["${key}": wrap_variant_pipeline_fn(value, variant_pipelines.size())]
Expand Down Expand Up @@ -179,7 +179,7 @@ def restore_dynamic_libmxnet(variant) {
// NOTE: Be mindful of the expected time that a step should take. If it will take a long time,
// and it can be done in a CPU node, do it in a CPU node. We should avoid using GPU instances unless
// we *have* to.
// However, if it is only packaging libmxnet and that doesn't take long. Then, the pipeline can
// However, if it is only packaging libmxnet and that doesn't take long. Then, the pipeline can
// just run on a single node. As is done bellow.
// For examples of multi-node CD pipelines, see the the binary_release/static and binary_release/dynamic
// pipeline.
Expand Down

0 comments on commit 34010ea

Please sign in to comment.