From ceea4d8154c603e3d9c685928c643b1cf6b61584 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 14 Sep 2021 09:54:29 +0100 Subject: [PATCH 1/2] [CI][release] Use stable as default branch --- .ci/release/Jenkinsfile | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.ci/release/Jenkinsfile b/.ci/release/Jenkinsfile index 50ced7a8df..1146a26adc 100644 --- a/.ci/release/Jenkinsfile +++ b/.ci/release/Jenkinsfile @@ -15,6 +15,7 @@ pipeline { PATH = "${env.JAVA_HOME}/bin:${env.PATH}" SLACK_CHANNEL = '#apm-agent-java' NOTIFY_TO = 'build-apm+apm-agent-java@elastic.co' + BRANCH_SPECIFIER = "${params.branch_specifier}" } options { timeout(time: 3, unit: 'HOURS') @@ -25,8 +26,8 @@ pipeline { } parameters { - string(name: 'branch_specifier', defaultValue: 'master') - booleanParam(name: 'check_branch_ci_status', defaultValue: true, description: "Check for failing tests in the master branch?") + string(name: 'branch_specifier', defaultValue: 'stable', description: "What branch to release from?") + booleanParam(name: 'check_branch_ci_status', defaultValue: true, description: "Check for failing tests in the given branch?") } stages { @@ -37,7 +38,7 @@ pipeline { steps { gitCheckout( basedir: "${BASE_DIR}", - branch: 'master', + branch: "${BRANCH_SPECIFIER}", repo: 'git@github.com:elastic/apm-agent-java.git', credentialsId: 'f6c7695a-671e-4f4f-a331-acdce44ff9ba', shallow: false @@ -84,12 +85,12 @@ pipeline { } } } - stage('Check master build status') { + stage('Check build status') { when { expression { params.check_branch_ci_status } } steps { - // If this build is not green: https://apm-ci.elastic.co/job/apm-agent-java/job/apm-agent-java-mbp/job/master/ - whenTrue(!buildStatus(host: 'apm-ci.elastic.co', job: ['apm-agent-java', 'apm-agent-java-mbp', 'master'], return_boolean: true)) { - input(message: "WARNING! The master build is not passing. Do you wish to continue?") + // If this build is not green: https://apm-ci.elastic.co/job/apm-agent-java/job/apm-agent-java-mbp/job/"${BRANCH_SPECIFIER}"/ + whenTrue(!buildStatus(host: 'apm-ci.elastic.co', job: ['apm-agent-java', 'apm-agent-java-mbp', "${BRANCH_SPECIFIER}"], return_boolean: true)) { + input(message: "WARNING! The ${BRANCH_SPECIFIER} build is not passing. Do you wish to continue?") } } } From 1556e9e991b66efe57f72672214fbc41b3787563 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Tue, 14 Sep 2021 10:01:09 +0100 Subject: [PATCH 2/2] stable branch does not require to validate the test results stable branch gets updated only when all the stages in the master build were successfully executed --- .ci/release/Jenkinsfile | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.ci/release/Jenkinsfile b/.ci/release/Jenkinsfile index 1146a26adc..18fa545d42 100644 --- a/.ci/release/Jenkinsfile +++ b/.ci/release/Jenkinsfile @@ -27,9 +27,8 @@ pipeline { } parameters { string(name: 'branch_specifier', defaultValue: 'stable', description: "What branch to release from?") - booleanParam(name: 'check_branch_ci_status', defaultValue: true, description: "Check for failing tests in the given branch?") + booleanParam(name: 'check_branch_ci_status', defaultValue: true, description: "Check for failing tests in the given branch (if no stable branch)?") } - stages { stage('Initializing'){ options { skipDefaultCheckout() } @@ -86,13 +85,18 @@ pipeline { } } stage('Check build status') { - when { expression { params.check_branch_ci_status } } - steps { - // If this build is not green: https://apm-ci.elastic.co/job/apm-agent-java/job/apm-agent-java-mbp/job/"${BRANCH_SPECIFIER}"/ - whenTrue(!buildStatus(host: 'apm-ci.elastic.co', job: ['apm-agent-java', 'apm-agent-java-mbp', "${BRANCH_SPECIFIER}"], return_boolean: true)) { - input(message: "WARNING! The ${BRANCH_SPECIFIER} build is not passing. Do you wish to continue?") - } - } + when { + allOf { + expression { params.check_branch_ci_status } + not { branch 'stable' } + } + } + steps { + // If this build is not green: https://apm-ci.elastic.co/job/apm-agent-java/job/apm-agent-java-mbp/job/"${BRANCH_SPECIFIER}"/ + whenTrue(!buildStatus(host: 'apm-ci.elastic.co', job: ['apm-agent-java', 'apm-agent-java-mbp', "${BRANCH_SPECIFIER}"], return_boolean: true)) { + input(message: "WARNING! The ${BRANCH_SPECIFIER} build is not passing. Do you wish to continue?") + } + } } stage('Require confirmation that CHANGELOG.asciidoc has been updated') { steps {