Skip to content

Commit 973bcf9

Browse files
committed
jobs/build: rerun build-arch if previous build is incomplete
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.
1 parent 4133144 commit 973bcf9

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

jobs/build.Jenkinsfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,27 @@ lock(resource: "build-${params.STREAM}") {
261261
if (prevBuildID == buildID) {
262262
currentBuild.result = 'SUCCESS'
263263
currentBuild.description = "${build_description} 💤 (no new build)"
264+
265+
// Nothing changed since the latest build. Check if it's missing
266+
// some arches and retrigger `build-arch` only for the missing
267+
// arches, and the follow-up `release` job. Match the exact src
268+
// config commit that was used.
269+
def builds = readJSON file: "builds/builds.json"
270+
assert buildID == builds.builds[0].id
271+
def missing_arches = additional_arches - builds.builds[0].arches
272+
if (missing_arches) {
273+
def meta = readJSON(text: shwrapCapture("cosa meta --build=${buildID} --dump"))
274+
def rev = meta["coreos-assembler.config-gitrev"]
275+
currentBuild.description = "${build_description} 🔨 ${buildID}"
276+
if (uploading) {
277+
run_multiarch_jobs(missing_arches, rev, buildID, cosa_img)
278+
if (stream_info.type != "production") {
279+
run_release_job(buildID)
280+
}
281+
}
282+
}
283+
284+
// And we're done!
264285
return
265286
}
266287

0 commit comments

Comments
 (0)