From 3f39cb0c0355e54f902ad07ba6bdab8ec2e5582e Mon Sep 17 00:00:00 2001 From: Michael Armijo Date: Mon, 12 Dec 2022 15:21:48 -0500 Subject: [PATCH] jobs/build: add support for variant value in cosa init --- docs/config.yaml | 2 ++ jobs/build-arch.Jenkinsfile | 3 ++- jobs/build.Jenkinsfile | 3 ++- jobs/bump-lockfile.Jenkinsfile | 7 +++++-- jobs/cloud-replicate.Jenkinsfile | 3 ++- jobs/kola-aws.Jenkinsfile | 5 ++++- jobs/kola-azure.Jenkinsfile | 5 ++++- jobs/kola-gcp.Jenkinsfile | 5 ++++- jobs/kola-kubernetes.Jenkinsfile | 5 ++++- jobs/kola-openstack.Jenkinsfile | 5 ++++- jobs/release.Jenkinsfile | 3 ++- 11 files changed, 35 insertions(+), 11 deletions(-) diff --git a/docs/config.yaml b/docs/config.yaml index 09fe74db0..0dfb865d3 100644 --- a/docs/config.yaml +++ b/docs/config.yaml @@ -58,6 +58,8 @@ streams: source_config_ref: main # OPTIONAL: implement the yumrepos branch workaround for this stream yumrepos_branch_rhcos_hack: true + # OPTIONAL: override OS variant to use for this stream + variant: rhcos-9.0 stable: type: production # OPTIONAL: override cosa image to use for this stream diff --git a/jobs/build-arch.Jenkinsfile b/jobs/build-arch.Jenkinsfile index 58f617d24..667ee1f12 100644 --- a/jobs/build-arch.Jenkinsfile +++ b/jobs/build-arch.Jenkinsfile @@ -172,8 +172,9 @@ lock(resource: "build-${params.STREAM}-${basearch}") { """) } else { def yumrepos = pipecfg.source_config.yumrepos ? "--yumrepos ${pipecfg.source_config.yumrepos}" : "" + def variant = stream_info.variant ? "--variant ${stream_info.variant}" : "" shwrap(""" - cosa init --force --branch ${ref} --commit=${src_config_commit} ${yumrepos} ${pipecfg.source_config.url} + cosa init --force --branch ${ref} --commit=${src_config_commit} ${yumrepos} ${variant} ${pipecfg.source_config.url} """) } diff --git a/jobs/build.Jenkinsfile b/jobs/build.Jenkinsfile index bacb8ca71..208750a71 100644 --- a/jobs/build.Jenkinsfile +++ b/jobs/build.Jenkinsfile @@ -156,8 +156,9 @@ lock(resource: "build-${params.STREAM}") { """) } else { def yumrepos = pipecfg.source_config.yumrepos ? "--yumrepos ${pipecfg.source_config.yumrepos}" : "" + def variant = stream_info.variant ? "--variant ${stream_info.variant}" : "" shwrap(""" - cosa init --force --branch ${ref} --commit=${src_config_commit} ${yumrepos} ${pipecfg.source_config.url} + cosa init --force --branch ${ref} --commit=${src_config_commit} ${yumrepos} ${variant} ${pipecfg.source_config.url} """) } diff --git a/jobs/bump-lockfile.Jenkinsfile b/jobs/bump-lockfile.Jenkinsfile index b0e636d3e..e7c428865 100644 --- a/jobs/bump-lockfile.Jenkinsfile +++ b/jobs/bump-lockfile.Jenkinsfile @@ -44,6 +44,8 @@ cosa_img = cosa_img ?: pipeutils.get_cosa_img(pipecfg, params.STREAM) echo "Waiting for bump-${params.STREAM} lock" currentBuild.description = "[${params.STREAM}] Waiting" +def stream_info = pipecfg.streams[params.STREAM] + def getLockfileInfo(lockfile) { def pkgChecksum, pkgTimestamp if (utils.pathExists(lockfile)) { @@ -83,7 +85,8 @@ lock(resource: "bump-${params.STREAM}") { def forceTimestamp = false def haveChanges = false def src_config_commit = shwrapCapture("git ls-remote https://github.com/${repo} ${branch} | cut -d \$'\t' -f 1") - shwrap("cosa init --branch ${branch} --commit=${src_config_commit} https://github.com/${repo}") + def variant = stream_info.variant ? "--variant ${stream_info.variant}" : "" + shwrap("cosa init --branch ${branch} ${variant} --commit=${src_config_commit} https://github.com/${repo}") def lockfile, pkgChecksum, pkgTimestamp def skip_tests_arches = params.SKIP_TESTS_ARCHES.split() @@ -109,7 +112,7 @@ lock(resource: "bump-${params.STREAM}") { """) withEnv(["COREOS_ASSEMBLER_REMOTE_SESSION=${archinfo[arch]['session']}"]) { shwrap(""" - cosa init --branch ${branch} --commit=${src_config_commit} https://github.com/${repo} + cosa init --branch ${branch} ${variant} --commit=${src_config_commit} https://github.com/${repo} """) } } diff --git a/jobs/cloud-replicate.Jenkinsfile b/jobs/cloud-replicate.Jenkinsfile index 2fc73334a..0317b3b75 100644 --- a/jobs/cloud-replicate.Jenkinsfile +++ b/jobs/cloud-replicate.Jenkinsfile @@ -87,8 +87,9 @@ lock(resource: "cloud-replicate-${params.VERSION}") { // Fetch metadata files for the build we are interested in stage('Fetch Metadata') { def ref = pipeutils.get_source_config_ref_for_stream(pipecfg, params.STREAM) + def variant = stream_info.variant ? "--variant ${stream_info.variant}" : "" pipeutils.shwrapWithAWSBuildUploadCredentials(""" - cosa init --branch ${ref} ${pipecfg.source_config.url} + cosa init --branch ${ref} ${variant} ${pipecfg.source_config.url} cosa buildfetch --build=${params.VERSION} \ --arch=all --url=s3://${s3_stream_dir}/builds \ --aws-config-file \${AWS_BUILD_UPLOAD_CONFIG} diff --git a/jobs/kola-aws.Jenkinsfile b/jobs/kola-aws.Jenkinsfile index 9a80f4e23..14f7fd35e 100644 --- a/jobs/kola-aws.Jenkinsfile +++ b/jobs/kola-aws.Jenkinsfile @@ -43,6 +43,8 @@ currentBuild.description = "[${params.STREAM}][${params.ARCH}] - ${params.VERSIO def s3_stream_dir = pipeutils.get_s3_streams_dir(pipecfg, params.STREAM) +def stream_info = pipecfg.streams[params.STREAM] + timeout(time: 90, unit: 'MINUTES') { cosaPod(memory: "512Mi", kvm: false, image: params.COREOS_ASSEMBLER_IMAGE, @@ -57,8 +59,9 @@ timeout(time: 90, unit: 'MINUTES') { withCredentials([file(variable: 'AWS_CONFIG_FILE', credentialsId: 'aws-build-upload-config')]) { def ref = pipeutils.get_source_config_ref_for_stream(pipecfg, params.STREAM) + def variant = stream_info.variant ? "--variant ${stream_info.variant}" : "" shwrap(""" - cosa init --branch ${ref} ${commitopt} ${pipecfg.source_config.url} + cosa init --branch ${ref} ${commitopt} ${variant} ${pipecfg.source_config.url} cosa buildfetch --artifact=ostree --build=${params.VERSION} \ --arch=${params.ARCH} --url=s3://${s3_stream_dir}/builds """) diff --git a/jobs/kola-azure.Jenkinsfile b/jobs/kola-azure.Jenkinsfile index a90095548..43cf304e6 100644 --- a/jobs/kola-azure.Jenkinsfile +++ b/jobs/kola-azure.Jenkinsfile @@ -41,6 +41,8 @@ properties([ currentBuild.description = "[${params.STREAM}][${params.ARCH}] - ${params.VERSION}" +def stream_info = pipecfg.streams[params.STREAM] + // Use eastus region for now def region = "eastus" @@ -66,8 +68,9 @@ timeout(time: 75, unit: 'MINUTES') { withCredentials([file(variable: 'AWS_CONFIG_FILE', credentialsId: 'aws-build-upload-config')]) { def ref = pipeutils.get_source_config_ref_for_stream(pipecfg, params.STREAM) + def variant = stream_info.variant ? "--variant ${stream_info.variant}" : "" shwrap(""" - cosa init --branch ${ref} ${commitopt} ${pipecfg.source_config.url} + cosa init --branch ${ref} ${commitopt} ${variant} ${pipecfg.source_config.url} cosa buildfetch --build=${params.VERSION} --arch=${params.ARCH} \ --url=s3://${s3_stream_dir}/builds --artifact=azure """) diff --git a/jobs/kola-gcp.Jenkinsfile b/jobs/kola-gcp.Jenkinsfile index 5e1659710..a1c0330d8 100644 --- a/jobs/kola-gcp.Jenkinsfile +++ b/jobs/kola-gcp.Jenkinsfile @@ -43,6 +43,8 @@ currentBuild.description = "[${params.STREAM}][${params.ARCH}] - ${params.VERSIO def s3_stream_dir = pipeutils.get_s3_streams_dir(pipecfg, params.STREAM) +def stream_info = pipecfg.streams[params.STREAM] + timeout(time: 30, unit: 'MINUTES') { cosaPod(memory: "512Mi", kvm: false, image: params.COREOS_ASSEMBLER_IMAGE, @@ -57,8 +59,9 @@ timeout(time: 30, unit: 'MINUTES') { withCredentials([file(variable: 'AWS_CONFIG_FILE', credentialsId: 'aws-build-upload-config')]) { def ref = pipeutils.get_source_config_ref_for_stream(pipecfg, params.STREAM) + def variant = stream_info.variant ? "--variant ${stream_info.variant}" : "" shwrap(""" - cosa init --branch ${ref} ${commitopt} ${pipecfg.source_config.url} + cosa init --branch ${ref} ${commitopt} ${variant} ${pipecfg.source_config.url} cosa buildfetch --artifact=ostree --build=${params.VERSION} \ --arch=${params.ARCH} --url=s3://${s3_stream_dir}/builds """) diff --git a/jobs/kola-kubernetes.Jenkinsfile b/jobs/kola-kubernetes.Jenkinsfile index 8a467b01f..d652ea573 100644 --- a/jobs/kola-kubernetes.Jenkinsfile +++ b/jobs/kola-kubernetes.Jenkinsfile @@ -39,6 +39,8 @@ currentBuild.description = "[${params.STREAM}][${params.ARCH}] - ${params.VERSIO def s3_stream_dir = pipeutils.get_s3_streams_dir(pipecfg, params.STREAM) +def stream_info = pipecfg.streams[params.STREAM] + timeout(time: 60, unit: 'MINUTES') { cosaPod(memory: "512Mi", kvm: false, image: params.COREOS_ASSEMBLER_IMAGE, @@ -53,8 +55,9 @@ timeout(time: 60, unit: 'MINUTES') { withCredentials([file(variable: 'AWS_CONFIG_FILE', credentialsId: 'aws-build-upload-config')]) { def ref = pipeutils.get_source_config_ref_for_stream(pipecfg, params.STREAM) + def variant = stream_info.variant ? "--variant ${stream_info.variant}" : "" shwrap(""" - cosa init --branch ${ref} ${commitopt} ${pipecfg.source_config.url} + cosa init --branch ${ref} ${commitopt} ${variant} ${pipecfg.source_config.url} cosa buildfetch --build=${params.VERSION} \ --arch=${params.ARCH} --url=s3://${s3_stream_dir}/builds """) diff --git a/jobs/kola-openstack.Jenkinsfile b/jobs/kola-openstack.Jenkinsfile index 25ba2c744..05ee77408 100644 --- a/jobs/kola-openstack.Jenkinsfile +++ b/jobs/kola-openstack.Jenkinsfile @@ -41,6 +41,8 @@ properties([ currentBuild.description = "[${params.STREAM}][${params.ARCH}] - ${params.VERSION}" +def stream_info = pipecfg.streams[params.STREAM] + // Use ca-ymq-1 for everything right now since we're having trouble with // image uploads to ams1. def region = "ca-ymq-1" @@ -68,8 +70,9 @@ lock(resource: "kola-openstack-${params.ARCH}") { withCredentials([file(variable: 'AWS_CONFIG_FILE', credentialsId: 'aws-build-upload-config')]) { def ref = pipeutils.get_source_config_ref_for_stream(pipecfg, params.STREAM) + def variant = stream_info.variant ? "--variant ${stream_info.variant}" : "" shwrap(""" - cosa init --branch ${ref} ${commitopt} ${pipecfg.source_config.url} + cosa init --branch ${ref} ${commitopt} ${variant} ${pipecfg.source_config.url} cosa buildfetch --build=${params.VERSION} --arch=${params.ARCH} \ --url=s3://${s3_stream_dir}/builds --artifact=openstack """) diff --git a/jobs/release.Jenkinsfile b/jobs/release.Jenkinsfile index fa6990dd9..d6f9e1e23 100644 --- a/jobs/release.Jenkinsfile +++ b/jobs/release.Jenkinsfile @@ -96,8 +96,9 @@ lock(resource: "release-${params.STREAM}", extra: locks) { // Fetch metadata files for the build we are interested in stage('Fetch Metadata') { def ref = pipeutils.get_source_config_ref_for_stream(pipecfg, params.STREAM) + def variant = stream_info.variant ? "--variant ${stream_info.variant}" : "" pipeutils.shwrapWithAWSBuildUploadCredentials(""" - cosa init --branch ${ref} ${pipecfg.source_config.url} + cosa init --branch ${ref} ${variant} ${pipecfg.source_config.url} cosa buildfetch --build=${params.VERSION} \ --arch=all --url=s3://${s3_stream_dir}/builds \ --aws-config-file \${AWS_BUILD_UPLOAD_CONFIG}