diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2017-06-03 12:04:32 -0400 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2017-06-03 06:04:32 -1000 |
commit | 42b25718476e80647d4c3a6d1691f280139bd078 (patch) | |
tree | b864089f326aaac23cb75c7f8499f6b1a68174d5 | |
parent | 26fcc5c24d7ef7e905181ba044447ed15746c73b (diff) | |
download | cryptography-42b25718476e80647d4c3a6d1691f280139bd078.tar.gz cryptography-42b25718476e80647d4c3a6d1691f280139bd078.tar.bz2 cryptography-42b25718476e80647d4c3a6d1691f280139bd078.zip |
Fixes #3653 -- attempt to retry git clones up to 3 times (#3660)
-rw-r--r-- | Jenkinsfile | 58 |
1 files changed, 30 insertions, 28 deletions
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 """ |