From 44b8c9f26d7d8009cc6c100a2ae32266b410a2ab Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 1 Jul 2021 11:32:59 +0100 Subject: [PATCH] [CI] fight the flakiness with some retry option in the CI only for the Pull Requests (#26617) (cherry picked from commit fb3bac9036ec8fa99a69996118b8dde9fd449308) --- Jenkinsfile | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2c50681d4fc..a04f7689eb4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,6 +2,12 @@ @Library('apm@current') _ +def numberOfRetries = 1 +// Only Pull Requests can rerun the build&test stages +if (env.CHANGE_ID?.trim()) { + numberOfRetries = 3 +} + pipeline { agent { label 'ubuntu-18 && immutable' } environment { @@ -101,7 +107,10 @@ pipeline { } } stage('Build&Test') { - options { skipDefaultCheckout() } + options { + skipDefaultCheckout() + retry(numberOfRetries) + } when { // Always when running builds on branches/tags // On a PR basis, skip if changes are only related to docs. @@ -120,7 +129,10 @@ pipeline { } } stage('Extended') { - options { skipDefaultCheckout() } + options { + skipDefaultCheckout() + retry(numberOfRetries) + } when { // Always when running builds on branches/tags // On a PR basis, skip if changes are only related to docs.