Skip to content

Commit

Permalink
jobs/build: rerun build-arch if previous build is incomplete
Browse files Browse the repository at this point in the history
Currently, if the x86_64 build succeeds, but not e.g. the aarch64 build,
a rerun of the `build` job will no-op. Salvaging the build requires
rerunning just the `build-arch` job for aarch64, and then rerunning the
`release` job. This is relatively easy for a human, but isn't very
automation-friendly.

With this patch, if we no-op but the latest build is missing builds for
some of the architectures, we automatically rerun the `build-arch` job
for those missing arches and then rerun the `release` job. This allows
the interface for automation to solely be the `build` job, and allows
transparently salvaging up-to-date but incomplete builds rather than
paying for a much costlier full rebuild on all arches.
  • Loading branch information
jlebon committed Feb 22, 2023
1 parent 4133144 commit 973bcf9
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions jobs/build.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,27 @@ lock(resource: "build-${params.STREAM}") {
if (prevBuildID == buildID) {
currentBuild.result = 'SUCCESS'
currentBuild.description = "${build_description} 💤 (no new build)"

// Nothing changed since the latest build. Check if it's missing
// some arches and retrigger `build-arch` only for the missing
// arches, and the follow-up `release` job. Match the exact src
// config commit that was used.
def builds = readJSON file: "builds/builds.json"
assert buildID == builds.builds[0].id
def missing_arches = additional_arches - builds.builds[0].arches
if (missing_arches) {
def meta = readJSON(text: shwrapCapture("cosa meta --build=${buildID} --dump"))
def rev = meta["coreos-assembler.config-gitrev"]
currentBuild.description = "${build_description} 🔨 ${buildID}"
if (uploading) {
run_multiarch_jobs(missing_arches, rev, buildID, cosa_img)
if (stream_info.type != "production") {
run_release_job(buildID)
}
}
}

// And we're done!
return
}

Expand Down

0 comments on commit 973bcf9

Please sign in to comment.