Skip to content

Commit 0664cd6

Browse files
dustymabejlebon
authored andcommitted
jobs/build: wait when re-running mArch jobs
In the case that we are re-running a mArch job I'd prefer we "wait" so that if the mArch job fails we don't re-run the release job.
1 parent 3a94202 commit 0664cd6

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

jobs/build.Jenkinsfile

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,10 @@ lock(resource: "build-${params.STREAM}") {
275275
def rev = meta["coreos-assembler.config-gitrev"]
276276
currentBuild.description = "${build_description} 🔨 ${buildID}"
277277
if (uploading) {
278-
run_multiarch_jobs(missing_arches, rev, buildID, cosa_img)
278+
// Run the mArch jobs and wait. We wait here because if they fail
279+
// we don't want to bother running the release job again since the
280+
// goal is to get a complete build.
281+
run_multiarch_jobs(missing_arches, rev, buildID, cosa_img, true)
279282
if (stream_info.type != "production") {
280283
run_release_job(buildID)
281284
}
@@ -337,7 +340,7 @@ lock(resource: "build-${params.STREAM}") {
337340
// If desired let's go ahead and archive+fork the multi-arch jobs
338341
if (params.EARLY_ARCH_JOBS && uploading) {
339342
archive_ostree(newBuildID, basearch, s3_stream_dir)
340-
run_multiarch_jobs(additional_arches, src_config_commit, newBuildID, cosa_img)
343+
run_multiarch_jobs(additional_arches, src_config_commit, newBuildID, cosa_img, false)
341344
}
342345

343346
// Build the remaining artifacts
@@ -375,7 +378,7 @@ lock(resource: "build-${params.STREAM}") {
375378
// jobs let's go ahead and do those pieces now
376379
if (!params.EARLY_ARCH_JOBS && uploading) {
377380
archive_ostree(newBuildID, basearch, s3_stream_dir)
378-
run_multiarch_jobs(additional_arches, src_config_commit, newBuildID, cosa_img)
381+
run_multiarch_jobs(additional_arches, src_config_commit, newBuildID, cosa_img, false)
379382
}
380383

381384
stage('Archive') {
@@ -502,13 +505,13 @@ def archive_ostree(version, basearch, s3_stream_dir) {
502505
}
503506
}
504507

505-
def run_multiarch_jobs(arches, src_commit, version, cosa_img) {
508+
def run_multiarch_jobs(arches, src_commit, version, cosa_img, wait) {
506509
stage('Fork Multi-Arch Builds') {
507510
parallel arches.collectEntries{arch -> [arch, {
508511
// We pass in FORCE=true here since if we got this far we know
509512
// we want to do a build even if the code tells us that there
510513
// are no apparent changes since the previous commit.
511-
build job: 'build-arch', wait: false, parameters: [
514+
build job: 'build-arch', wait: wait, parameters: [
512515
booleanParam(name: 'FORCE', value: true),
513516
booleanParam(name: 'ALLOW_KOLA_UPGRADE_FAILURE', value: params.ALLOW_KOLA_UPGRADE_FAILURE),
514517
string(name: 'SRC_CONFIG_COMMIT', value: src_commit),
@@ -519,14 +522,16 @@ def run_multiarch_jobs(arches, src_commit, version, cosa_img) {
519522
string(name: 'PIPECFG_HOTFIX_REPO', value: params.PIPECFG_HOTFIX_REPO),
520523
string(name: 'PIPECFG_HOTFIX_REF', value: params.PIPECFG_HOTFIX_REF)
521524
]
522-
// Wait until the locks taken by the `build-arch` jobs are taken
523-
// before continuing. This closes a potential race in which once we
524-
// trigger the `release` job afterwards, it could end up taking the
525-
// locks before the multi-arch jobs.
526-
// This really should never take more than 5 minutes. Having a
527-
// timeout ensures we don't wait for a long time if we somehow
528-
// missed the transition.
529-
wait_until_locked_or_continue("release-${version}-${arch}", 5)
525+
if (!wait) {
526+
// Wait until the locks taken by the `build-arch` jobs are taken
527+
// before continuing. This closes a potential race in which once we
528+
// trigger the `release` job afterwards, it could end up taking the
529+
// locks before the multi-arch jobs.
530+
// This really should never take more than 5 minutes. Having a
531+
// timeout ensures we don't wait for a long time if we somehow
532+
// missed the transition.
533+
wait_until_locked_or_continue("release-${version}-${arch}", 5)
534+
}
530535
}]}
531536
}
532537
}

0 commit comments

Comments
 (0)