mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-05 11:48:33 +08:00
wrap checkouts in retry(5)
Avoid failing jobs due to temporary errors when checking out from Pagure. This should help work around transient DNS/network failures.
This commit is contained in:
@@ -57,20 +57,22 @@ pipeline {
|
||||
script {
|
||||
// check out specified branch/commit
|
||||
def srcRef = env.MBS_GIT_REF.startsWith('pull/') ? env.MBS_GIT_REF : "heads/${env.MBS_GIT_REF}"
|
||||
checkout([$class: 'GitSCM',
|
||||
branches: [[name: params.MBS_GIT_REF]],
|
||||
userRemoteConfigs: [
|
||||
[
|
||||
name: 'origin',
|
||||
url: params.MBS_GIT_REPO,
|
||||
refspec: "+refs/${srcRef}:refs/remotes/origin/${env.MBS_GIT_REF}",
|
||||
retry(5) {
|
||||
checkout([$class: 'GitSCM',
|
||||
branches: [[name: params.MBS_GIT_REF]],
|
||||
userRemoteConfigs: [
|
||||
[
|
||||
name: 'origin',
|
||||
url: params.MBS_GIT_REPO,
|
||||
refspec: "+refs/${srcRef}:refs/remotes/origin/${env.MBS_GIT_REF}",
|
||||
],
|
||||
],
|
||||
],
|
||||
extensions: [
|
||||
[$class: 'CleanBeforeCheckout'],
|
||||
[$class: 'CloneOption', noTags: true, shallow: true, depth: 2, honorRefspec: true],
|
||||
],
|
||||
])
|
||||
extensions: [
|
||||
[$class: 'CleanBeforeCheckout'],
|
||||
[$class: 'CloneOption', noTags: true, shallow: true, depth: 2, honorRefspec: true],
|
||||
],
|
||||
])
|
||||
}
|
||||
|
||||
// get current commit ID
|
||||
// FIXME: Due to a bug discribed in https://issues.jenkins-ci.org/browse/JENKINS-45489,
|
||||
|
||||
@@ -58,21 +58,23 @@ pipeline {
|
||||
def srcRef = params.MBS_GIT_REF.startsWith('pull/') ? params.MBS_GIT_REF : 'heads/master'
|
||||
def localRef = params.MBS_GIT_REF.startsWith('pull/') ? params.MBS_GIT_REF : 'master'
|
||||
def cloneDepth = params.MBS_GIT_REF.startsWith('pull/') ? 2 : 10
|
||||
// check out specified branch/commit
|
||||
checkout([$class: 'GitSCM',
|
||||
branches: [[name: params.MBS_GIT_REF]],
|
||||
userRemoteConfigs: [
|
||||
[
|
||||
name: 'origin',
|
||||
url: params.MBS_GIT_REPO,
|
||||
refspec: "+refs/${srcRef}:refs/remotes/origin/${localRef}",
|
||||
retry(5) {
|
||||
// check out specified branch/commit
|
||||
checkout([$class: 'GitSCM',
|
||||
branches: [[name: params.MBS_GIT_REF]],
|
||||
userRemoteConfigs: [
|
||||
[
|
||||
name: 'origin',
|
||||
url: params.MBS_GIT_REPO,
|
||||
refspec: "+refs/${srcRef}:refs/remotes/origin/${localRef}",
|
||||
],
|
||||
],
|
||||
],
|
||||
extensions: [
|
||||
[$class: 'CleanBeforeCheckout'],
|
||||
[$class: 'CloneOption', noTags: true, shallow: true, depth: cloneDepth, honorRefspec: true],
|
||||
],
|
||||
])
|
||||
extensions: [
|
||||
[$class: 'CleanBeforeCheckout'],
|
||||
[$class: 'CloneOption', noTags: true, shallow: true, depth: cloneDepth, honorRefspec: true],
|
||||
],
|
||||
])
|
||||
}
|
||||
|
||||
// get current commit ID
|
||||
// FIXME: Due to a bug discribed in https://issues.jenkins-ci.org/browse/JENKINS-45489,
|
||||
|
||||
@@ -151,20 +151,23 @@ objects:
|
||||
// checking out the polled branch
|
||||
def polledBranch = env.PAGURE_POLLING_FOR_PR == 'true' ? 'origin/pull/*/head' : "origin/${PAGURE_POLLED_BRANCH}"
|
||||
def srcRef = env.PAGURE_POLLING_FOR_PR == 'true' ? 'pull/*/head' : "heads/${PAGURE_POLLED_BRANCH}"
|
||||
def scmVars = checkout([$class: 'GitSCM',
|
||||
branches: [[name: polledBranch]],
|
||||
userRemoteConfigs: [
|
||||
[
|
||||
name: 'origin',
|
||||
url: env.GIT_URL,
|
||||
refspec: "+refs/${srcRef}:refs/remotes/${polledBranch}",
|
||||
def scmVars
|
||||
retry(5) {
|
||||
scmVars = checkout([$class: 'GitSCM',
|
||||
branches: [[name: polledBranch]],
|
||||
userRemoteConfigs: [
|
||||
[
|
||||
name: 'origin',
|
||||
url: env.GIT_URL,
|
||||
refspec: "+refs/${srcRef}:refs/remotes/${polledBranch}",
|
||||
],
|
||||
],
|
||||
],
|
||||
extensions: [
|
||||
[$class: 'CleanBeforeCheckout'],
|
||||
[$class: 'CloneOption', noTags: true, shallow: true, depth: 2, honorRefspec: true],
|
||||
],
|
||||
])
|
||||
extensions: [
|
||||
[$class: 'CleanBeforeCheckout'],
|
||||
[$class: 'CloneOption', noTags: true, shallow: true, depth: 2, honorRefspec: true],
|
||||
],
|
||||
])
|
||||
}
|
||||
env.MBS_GIT_COMMIT = scmVars.GIT_COMMIT
|
||||
// setting build display name
|
||||
def prefix = 'origin/'
|
||||
@@ -204,20 +207,22 @@ objects:
|
||||
}
|
||||
}
|
||||
steps {
|
||||
checkout([$class: 'GitSCM',
|
||||
branches: [[name: env.MBS_GIT_BRANCH]],
|
||||
userRemoteConfigs: [
|
||||
[
|
||||
name: 'origin',
|
||||
url: env.GIT_URL,
|
||||
refspec: "+refs/heads/${env.MBS_GIT_BRANCH}:refs/remotes/origin/${env.MBS_GIT_BRANCH}",
|
||||
retry(5) {
|
||||
checkout([$class: 'GitSCM',
|
||||
branches: [[name: env.MBS_GIT_BRANCH]],
|
||||
userRemoteConfigs: [
|
||||
[
|
||||
name: 'origin',
|
||||
url: env.GIT_URL,
|
||||
refspec: "+refs/heads/${env.MBS_GIT_BRANCH}:refs/remotes/origin/${env.MBS_GIT_BRANCH}",
|
||||
],
|
||||
],
|
||||
],
|
||||
extensions: [
|
||||
[$class: 'CleanBeforeCheckout'],
|
||||
[$class: 'CloneOption', noTags: true, shallow: true, depth: 2, honorRefspec: true],
|
||||
],
|
||||
])
|
||||
extensions: [
|
||||
[$class: 'CleanBeforeCheckout'],
|
||||
[$class: 'CloneOption', noTags: true, shallow: true, depth: 2, honorRefspec: true],
|
||||
],
|
||||
])
|
||||
}
|
||||
script {
|
||||
dir('openshift/integration/koji/pipelines') {
|
||||
sh '''
|
||||
|
||||
Reference in New Issue
Block a user