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

[CD] Add COMMIT_ID param to release job #16202

Merged
merged 8 commits into from
Sep 24, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion cd/Jenkinsfile_release_job
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ pipeline {
parameters {
// Release parameters
string(defaultValue: "Generic release job", description: "Optional Job name", name: "RELEASE_JOB_NAME")
choice(choices: ["mxnet_lib/static", "mxnet_lib/dynamic"], description: "Pipeline to build", name: "RELEASE_JOB_TYPE")
string(defaultValue: "master", description: "Git Commit to Build", name: "COMMIT_ID")

// Using string instead of choice parameter to keep the changes to the parameters minimal to avoid
// any disruption caused by different COMMIT_ID values chaning the job parameter configuration on
// Jenkins.
string(defaultValue: "mxnet_lib/static", description: "Pipeline to build", name: "RELEASE_JOB_TYPE")
string(defaultValue: "cpu,mkl,cu90,cu90mkl,cu92,cu92mkl,cu100,cu100mkl,cu101,cu101mkl", description: "Comma separated list of variants", name: "MXNET_VARIANTS")
booleanParam(defaultValue: false, description: 'Whether this is a release build or not', name: "RELEASE_BUILD")
}
Expand Down
9 changes: 5 additions & 4 deletions cd/Jenkinsfile_utils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ def trigger_release_job(job_name, job_type, mxnet_variants) {
def run = build(
job: env.CD_RELEASE_JOB_NAME,
parameters: [
string(name: 'RELEASE_JOB_NAME', value: "${job_name}"),
string(name: 'RELEASE_JOB_TYPE', value: "${job_type}"),
string(name: 'MXNET_VARIANTS', value: "${mxnet_variants}"),
booleanParam(name: 'RELEASE_BUILD', value: "${env.RELEASE_BUILD}")
string(name: "RELEASE_JOB_NAME", value: "${job_name}"),
string(name: "RELEASE_JOB_TYPE", value: "${job_type}"),
string(name: "MXNET_VARIANTS", value: "${mxnet_variants}"),
booleanParam(name: "RELEASE_BUILD", value: "${env.RELEASE_BUILD}"),
string(name: "COMMIT_ID", value: "${env.GIT_COMMIT}")
],
// If propagate is true, any result other than successful will
// mark this call as failure (inc. unstable).
Expand Down
7 changes: 7 additions & 0 deletions cd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,16 @@ The [release job](Jenkinsfile_release_job) takes five parameters:
* **MXNET_VARIANTS**: A comma separated list of variants to build. Defaults to *all* variants.
* **RELEASE\_JOB\_NAME**: A name for this release job (Optional). Defaults to "Generic release job". It is used for debug output purposes.
* **RELEASE\_JOB\_TYPE**: Defines the release pipeline you want to execute.
* **COMMIT_ID**: The commit id to build

The release job executes, in parallel, the release pipeline for each of the variants (**MXNET_VARIANTS**) for the job type (**RELEASE\_JOB\_TYPE**). The job type the path to a directory (relative to the `cd` directory) that includes a `Jenkins_pipeline.groovy` file ([e.g.](mxnet_lib/static/Jenkins_pipeline.groovy)).

NOTE: The **COMMIT_ID** is a little tricky and we must be very careful with it. It is necessary to ensure that the same commit is built through out the pipeline, but at the same time, it has the potential to change the current state of the release job configuration - specifically the parameter configuration. Any changes to this configuration will require a "dry-run" of the release job to ensure Jenkins has the current (master) version. This is acceptable as there will be few changes to the parameter configuration for the job, if any at all. But, it's something to keep in mind.

It should be noted that the 'Pipeline' section of the configuration should use the *$COMMIT_ID* parameter as the specifier and 'lightweight checkout' unchecked. For example:

![job setup example](img/job_setup.png)

### Release Pipelines: Jenkins_pipeline.groovy

This file defines the release pipeline for a particular release channel. It defines a function `get_pipeline(mxnet_variant)`, which returns a closure with the pipeline to be executed. For instance:
Expand Down
Binary file added cd/img/job_setup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions ci/Jenkinsfile_utils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
// under the License.

// initialize source codes
def init_git(git_sha = '') {
def init_git() {
deleteDir()
retry(5) {
try {
Expand Down Expand Up @@ -80,8 +80,8 @@ return 0
}

// unpack libraries saved before
def unpack_and_init(name, libs, include_gcov_data = false, git_sha = '') {
init_git(git_sha)
def unpack_and_init(name, libs, include_gcov_data = false) {
init_git()
unstash name
sh returnStatus: true, script: """
set +e
Expand Down