From 42b25718476e80647d4c3a6d1691f280139bd078 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Sat, 3 Jun 2017 12:04:32 -0400 Subject: Fixes #3653 -- attempt to retry git clones up to 3 times (#3660) --- Jenkinsfile | 58 ++++++++++++++++++++++++++++++---------------------------- 1 file changed, 30 insertions(+), 28 deletions(-) (limited to 'Jenkinsfile') diff --git a/Jenkinsfile b/Jenkinsfile index 458edfb4..29f9a767 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -142,36 +142,38 @@ def downstreams = [ ] def checkout_git(label) { - def script = "" - if (env.BRANCH_NAME.startsWith('PR-')) { - script = """ - git clone --depth=1 https://github.com/pyca/cryptography - cd cryptography - git fetch origin +refs/pull/${env.CHANGE_ID}/merge: - git checkout -qf FETCH_HEAD - """ - if (label.contains("windows")) { - bat script - } else { - sh """#!/bin/sh - set -xe - ${script} + retry(3) { + def script = "" + if (env.BRANCH_NAME.startsWith('PR-')) { + script = """ + git clone --depth=1 https://github.com/pyca/cryptography + cd cryptography + git fetch origin +refs/pull/${env.CHANGE_ID}/merge: + git checkout -qf FETCH_HEAD """ + if (label.contains("windows")) { + bat script + } else { + sh """#!/bin/sh + set -xe + ${script} + """ + } + } else { + checkout([ + $class: 'GitSCM', + branches: [[name: "*/${env.BRANCH_NAME}"]], + doGenerateSubmoduleConfigurations: false, + extensions: [[ + $class: 'RelativeTargetDirectory', + relativeTargetDir: 'cryptography' + ]], + submoduleCfg: [], + userRemoteConfigs: [[ + 'url': 'https://github.com/pyca/cryptography' + ]] + ]) } - } else { - checkout([ - $class: 'GitSCM', - branches: [[name: "*/${env.BRANCH_NAME}"]], - doGenerateSubmoduleConfigurations: false, - extensions: [[ - $class: 'RelativeTargetDirectory', - relativeTargetDir: 'cryptography' - ]], - submoduleCfg: [], - userRemoteConfigs: [[ - 'url': 'https://github.com/pyca/cryptography' - ]] - ]) } if (label.contains("windows")) { bat """ -- cgit v1.2.3