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

Refactor Jenkinsfiles #13344

Merged
merged 13 commits into from
Nov 21, 2018
Merged

Conversation

marcoabreu
Copy link
Contributor

@marcoabreu marcoabreu commented Nov 20, 2018

This PR refactors our Jenkinsfiles that are used in the PR stage for the following reasons:

  1. Work around issues with Jenkinsfiles being too large: https://issues.jenkins-ci.org/browse/JENKINS-37984
  2. Improve the readability of the Jenkinsfiles. Now you can clearly tell which jobs are being run while implementation details are hidden in another file. Also, this allows code re-usage.
  3. Increase the speed of the PR pipeline. We will now have multiple pipelines which run in parallel. This reduces the critical path since a stage no longer has to wait for the slowest job before being able to move forward.

Test jobs to validate these changes are available at http://jenkins.mxnet-ci-dev.amazon-ml.com/view/test-marco-mxnet/

The status report would then look as follows:
image

So far, I have not refactored other pipelines. This would be done in a follow-up PR.

@stu1130
Copy link
Contributor

stu1130 commented Nov 20, 2018

@mxnet-label-bot add [pr-awaiting-review]
This really helps! @marcoabreu

@marcoabreu marcoabreu added the pr-awaiting-review PR is waiting for code review label Nov 20, 2018
@marcoabreu marcoabreu force-pushed the split-jenkins-pipeline branch from a4d5d69 to cdb4b80 Compare November 20, 2018 20:29
@marcoabreu marcoabreu added pr-work-in-progress PR is still work in progress and removed pr-awaiting-review PR is waiting for code review labels Nov 20, 2018
@marcoabreu marcoabreu force-pushed the split-jenkins-pipeline branch from 28fee7f to 8cb25fa Compare November 20, 2018 21:13
@marcoabreu marcoabreu added pr-awaiting-review PR is waiting for code review and removed pr-work-in-progress PR is still work in progress labels Nov 20, 2018
@marcoabreu marcoabreu force-pushed the split-jenkins-pipeline branch from 0305879 to 95dd04a Compare November 20, 2018 22:04
utils = load('ci/Jenkinsfile_utils.groovy')
custom_steps = load('ci/jenkins/Jenkins_steps.groovy')
}
utils.assign_node_labels(linux_cpu: 'mxnetlinux-cpu', linux_gpu: 'mxnetlinux-gpu', linux_gpu_p3: 'mxnetlinux-gpu-p3', windows_cpu: 'mxnetwindows-cpu', windows_gpu: 'mxnetwindows-gpu')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as discussed offline with @marcoabreu, it would be nice to abstract away the need to have windows node labeling in test files that are testing centos or arm, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

@ThomasDelteil ThomasDelteil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed offline with @marcoabreu, we could have a common failure handler for the Jenkins files that would make it more maintainable. This is left for a future work. LGTM.

@marcoabreu marcoabreu added pr-awaiting-merge Review and CI is complete. Ready to Merge and removed pr-awaiting-review PR is waiting for code review labels Nov 20, 2018
@marcoabreu marcoabreu merged commit d8030c5 into apache:master Nov 21, 2018
// Credit to https://plugins.jenkins.io/github
def get_repo_url() {
checkout scm
sh "git config --get remote.origin.url > .git/remote-url"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not .execute() writing a file doesn't seem the best way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no way to directly access shell output in Jenkins https://stackoverflow.com/questions/36507410/is-it-possible-to-capture-the-stdout-from-the-sh-dsl-command-in-the-pipeline

I could've used other methods, but that would then have triggered the security mechanisms of Jenkins due to the sandboxing mechanism. Execute (although I don't know exactly which function you're referring to) sounds like it would probably trigger that restriction.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, they've recently added a redirect parameter. I've replaced it at #13355. Thanks for the heads up!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr-awaiting-merge Review and CI is complete. Ready to Merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants