Skip to content
This repository has been archived by the owner on Feb 9, 2022. It is now read-only.

Commit

Permalink
ci: retry failed stages only once after a failure
Browse files Browse the repository at this point in the history
Retrying failed build stages 3 times is excessive and wasteful in most
cases. To account for transient cluster creation failures, one
additional retry should be sufficient to overcome issues coming from
cluster creation issues.

Additionally we have added a 3 minute wait before retrying.
  • Loading branch information
Sameer Naik committed Mar 22, 2019
1 parent 8f119f7 commit 5c4cda5
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ spec:
}, failFast: true
)

def maxRetries = 3
def maxRetries = 2
def platforms = [:]

// See:
Expand All @@ -291,11 +291,16 @@ spec:
platforms[platform] = {
stage(platform) {
def retryNum = 0

retry(maxRetries) {
def clusterName = ("${env.BRANCH_NAME}".take(8) + "-${env.BUILD_NUMBER}-" + UUID.randomUUID().toString().take(5) + "-${platform}").replaceAll(/[^a-zA-Z0-9-]/, '-').replaceAll(/--/, '-').toLowerCase()
def adminEmail = "${clusterName}@${parentZone}"
def dnsZone = "${clusterName}.${parentZone}"

if (retryNum > 0) {
sleep 180
}

retryNum++
dir("${env.WORKSPACE}/${clusterName}") {
withEnv(["KUBECONFIG=${env.WORKSPACE}/.kubecfg-${clusterName}"]) {
Expand Down Expand Up @@ -385,6 +390,10 @@ spec:
def adminEmail = "${clusterName}@${parentZone}"
def dnsZone = "${clusterName}.${parentZone}"

if (retryNum > 0) {
sleep 180
}

retryNum++
dir("${env.WORKSPACE}/${clusterName}") {
withEnv(["KUBECONFIG=${env.WORKSPACE}/.kubecfg-${clusterName}"]) {
Expand Down Expand Up @@ -502,6 +511,10 @@ spec:
def adminEmail = "${clusterName}@${parentZone}"
def dnsZone = "${clusterName}.${parentZone}"

if (retryNum > 0) {
sleep 180
}

retryNum++
dir("${env.WORKSPACE}/${clusterName}") {
withEnv([
Expand Down

0 comments on commit 5c4cda5

Please sign in to comment.