From 5d74bd7ef90a1c552b31191390baecc20bc827ea Mon Sep 17 00:00:00 2001 From: Peter Salvatore Date: Tue, 3 Sep 2019 15:26:21 -0400 Subject: [PATCH] Jenkinsfile hack for auto-cancellation. This change will cause Jenkins to only build the latest HEAD of a PR branch, cancelling any previous builds that may already be in progress. This will decrease feedback time and help mitigate resource contention. Signed-off-by: Peter Salvatore (cherry picked from commit 85bcc524eaa86ea5dde0c7214d15658587863a4c) Signed-off-by: Sebastiaan van Stijn --- Jenkinsfile | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 64f44f6208..a3325ac77a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -26,12 +26,23 @@ pipeline { TIMEOUT = '120m' } stages { + stage('pr-hack') { + when { changeRequest() } + steps { + script { + echo "Workaround for PR auto-cancel feature. Borrowed from https://issues.jenkins-ci.org/browse/JENKINS-43353" + def buildNumber = env.BUILD_NUMBER as int + if (buildNumber > 1) milestone(buildNumber - 1) + milestone(buildNumber) + } + } + } stage('DCO-check') { when { beforeAgent true expression { !params.skip_dco } } - agent { label 'linux' } + agent { label 'amd64 && ubuntu-1804 && overlay2' } steps { sh ''' docker run --rm \