Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync output of parallel make tasks in CI #1503

Merged
merged 2 commits into from
Jan 17, 2020
Merged
Changes from all 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
21 changes: 15 additions & 6 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ node {
try {
env.CI_BUILD_TAG = env.BUILD_TAG.replaceAll('%2f','').replaceAll("[^A-Za-z0-9]+", "").toLowerCase()
env.SAFEBRANCH_NAME = env.BRANCH_NAME.replaceAll('%2f','-').replaceAll("[^A-Za-z0-9]+", "-").toLowerCase()
env.SYNC_MAKE_OUTPUT = 'target'
// make/tests will synchronise (buffer) output by default to avoid interspersed
// lines from multiple jobs run in parallel. However this means that output for
// each make target is not written until the command completes.
//
// See `man -P 'less +/-O' make` for more information about this option.
//
// Uncomment the line below to disable output synchronisation.
//env.SYNC_MAKE_OUTPUT = 'none'

stage ('env') {
sh "env"
Expand All @@ -23,7 +32,7 @@ node {
}

stage ('build images') {
sh "make build -j6"
sh "make -O${SYNC_MAKE_OUTPUT} -j6 build"
}

openshift_versions.each { openshift_version ->
Expand Down Expand Up @@ -51,7 +60,7 @@ node {
stage ('push images to amazeeiolagoon/*') {
withCredentials([string(credentialsId: 'amazeeiojenkins-dockerhub-password', variable: 'PASSWORD')]) {
sh 'docker login -u amazeeiojenkins -p $PASSWORD'
sh "make publish-amazeeiolagoon-baseimages publish-amazeeiolagoon-serviceimages BRANCH_NAME=${SAFEBRANCH_NAME} -j4"
sh "make -O${SYNC_MAKE_OUTPUT} -j4 publish-amazeeiolagoon-baseimages publish-amazeeiolagoon-serviceimages BRANCH_NAME=${SAFEBRANCH_NAME}"
}
}
}
Expand All @@ -66,9 +75,9 @@ node {
"_tests_${openshift_version}": {
stage ('run tests') {
try {
sh "make push-minishift -j5"
sh "make -O${SYNC_MAKE_OUTPUT} -j5 push-minishift"
sh "make up"
sh "make tests -j2"
sh "make -O${SYNC_MAKE_OUTPUT} -j2 tests"
} catch (e) {
echo "Something went wrong, trying to cleanup"
cleanup()
Expand All @@ -89,14 +98,14 @@ node {
stage ('publish-amazeeio') {
withCredentials([string(credentialsId: 'amazeeiojenkins-dockerhub-password', variable: 'PASSWORD')]) {
sh 'docker login -u amazeeiojenkins -p $PASSWORD'
sh "make publish-amazeeio-baseimages -j4"
sh "make -O${SYNC_MAKE_OUTPUT} -j4 publish-amazeeio-baseimages"
}
}
}

if (env.BRANCH_NAME == 'master') {
stage ('save-images-s3') {
sh "make s3-save -j8"
sh "make -O${SYNC_MAKE_OUTPUT} -j8 s3-save"
}
}

Expand Down