Skip to content

Commit b9d3a04

Browse files
jlebondustymabe
authored andcommitted
jobs/build: don't start new build until previous build completes
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.
1 parent c2ad35d commit b9d3a04

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

jobs/build.Jenkinsfile

+9
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,15 @@ if (params.WAIT_FOR_RELEASE_JOB) {
121121
timeout_mins += timeout_mins + 30
122122
}
123123

124+
// Before proceeding let's make sure no jobs for this stream are currently
125+
// running. This includes multi-arch jobs and release jobs.
126+
echo "Waiting for a clear runway for ${params.STREAM}"
127+
def locks = additional_arches.collect{[resource: "build-${params.STREAM}-${it}"]}
128+
locks += [resource: "release-${params.STREAM}"]
129+
lock(resource: "build-${params.STREAM}", extra: locks) {
130+
echo "The runway is clear for ${params.STREAM}"
131+
}
132+
124133
lock(resource: "build-${params.STREAM}") {
125134
timeout(time: timeout_mins, unit: 'MINUTES') {
126135
cosaPod(cpu: "${ncpus}",

0 commit comments

Comments
 (0)