Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 22 additions & 9 deletions jobs/build.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,17 @@ lock(resource: "build-${params.STREAM}") {
// 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) {
// config commit that was used. But only do this if there isn't
// already outstanding work in progress for that build ID. Skip if
// not uploading since it's required for multi-arch.
if (uploading && !buildid_has_work_pending(buildID, additional_arches)) {
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}"
// Run the mArch jobs and wait. We wait here because if they fail
// we don't want to bother running the release job again since the
// goal is to get a complete build.
Expand Down Expand Up @@ -541,3 +543,14 @@ def run_release_job(buildID) {
]
}
}

def buildid_has_work_pending(buildID, arches) {
def locked = true
// these locks match the ones in the release job
def locks = arches.collect{[resource: "release-${buildID}-${it}"]}
lock(resource: "release-${params.STREAM}", extra: locks, skipIfLocked: true) {
// NB: `return` here wouldn't actually return from the function
locked = false
}
return locked
}