Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jobs/build: don't start new build until previous build completes #823

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
28 changes: 19 additions & 9 deletions jobs/build.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,15 @@ if (params.WAIT_FOR_RELEASE_JOB) {
timeout_mins += timeout_mins + 30
}

// Before proceeding let's make sure no jobs for this stream are currently
// running. This includes multi-arch jobs and release jobs.
echo "Waiting for a clear runway for ${params.STREAM}"
def locks = additional_arches.collect{[resource: "build-${params.STREAM}-${it}"]}
locks += [resource: "release-${params.STREAM}"]
lock(resource: "build-${params.STREAM}", extra: locks) {
echo "The runway is clear for ${params.STREAM}"
}

lock(resource: "build-${params.STREAM}") {
timeout(time: timeout_mins, unit: 'MINUTES') {
cosaPod(cpu: "${ncpus}",
Expand Down Expand Up @@ -265,15 +274,16 @@ 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. Skip if not uploading since it's
// required for multi-arch.
if (uploading) {
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