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: lock buildfetch to avoid simultaneous jobs race condition #1098

Open
wants to merge 1 commit 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
27 changes: 14 additions & 13 deletions jobs/build.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -225,26 +225,27 @@ lock(resource: "build-${params.STREAM}") {
}

// buildfetch previous build info
stage('BuildFetch') {
if (s3_stream_dir) {
pipeutils.shwrapWithAWSBuildUploadCredentials("""
cosa buildfetch --arch=${basearch} \
--url s3://${s3_stream_dir}/builds \
--aws-config-file \${AWS_BUILD_UPLOAD_CONFIG}
""")
if (parent_version != "") {
// also fetch the parent version; this is used by cosa to do the diff
lock(resource: "buildfetch") {
stage('BuildFetch') {
if (s3_stream_dir) {
pipeutils.shwrapWithAWSBuildUploadCredentials("""
cosa buildfetch --arch=${basearch} \
--build ${parent_version} \
--url s3://${s3_stream_dir}/builds \
--aws-config-file \${AWS_BUILD_UPLOAD_CONFIG}
""")
if (parent_version != "") {
// also fetch the parent version; this is used by cosa to do the diff
pipeutils.shwrapWithAWSBuildUploadCredentials("""
cosa buildfetch --arch=${basearch} \
--build ${parent_version} \
--url s3://${s3_stream_dir}/builds \
--aws-config-file \${AWS_BUILD_UPLOAD_CONFIG}
""")
}
}
}
}


def prevBuildID = null
if (utils.pathExists("builds/latest")) {
prevBuildID = shwrapCapture("readlink builds/latest")
Expand All @@ -259,7 +260,7 @@ lock(resource: "build-${params.STREAM}") {
shwrap("python3 /usr/lib/coreos-assembler/download-overrides.py")
overrides_fetch_param = "--with-cosa-overrides"
}
shwrap("cosa fetch ${overrides_fetch_param} ${strict_build_param}")
shwrap("cosa fetch ${overrides_fetch_param} ${strict_build_param}")
}

stage('Build OSTree') {
Expand Down Expand Up @@ -592,7 +593,7 @@ def run_release_job(buildID) {

def buildid_has_work_pending(buildID, arches) {
def locked = true
// these locks match the ones in the release job
// 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
Expand Down