Skip to content

Commit

Permalink
jobs/build: don't start new build until previous build completes
Browse files Browse the repository at this point in the history
Since 973bcf9 ("jobs/build: rerun `build-arch` if previous build is
incomplete"), there is a race possible where the `build` job rerun logic
could kick in before the `release` jobs initially triggered for that
build has finished. We don't want to queue builds in that case.

Let's just prevent starting up the build job at all if there are
remaining pieces from another build for this stream running.
  • Loading branch information
jlebon authored and dustymabe committed Feb 23, 2023
1 parent c2ad35d commit a3f861f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 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 += ["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

0 comments on commit a3f861f

Please sign in to comment.