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: add support for reading variant from stream/pipeline config #787

Merged
merged 1 commit into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions docs/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion jobs/build-arch.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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}
jlebon marked this conversation as resolved.
Show resolved Hide resolved
""")
}

Expand Down
3 changes: 2 additions & 1 deletion jobs/build.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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}
""")
}

Expand Down
7 changes: 5 additions & 2 deletions jobs/bump-lockfile.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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()
Expand All @@ -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}
""")
}
}
Expand Down
3 changes: 2 additions & 1 deletion jobs/cloud-replicate.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
5 changes: 4 additions & 1 deletion jobs/kola-aws.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
""")
Expand Down
5 changes: 4 additions & 1 deletion jobs/kola-azure.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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
""")
Expand Down
5 changes: 4 additions & 1 deletion jobs/kola-gcp.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
""")
Expand Down
5 changes: 4 additions & 1 deletion jobs/kola-kubernetes.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
""")
Expand Down
5 changes: 4 additions & 1 deletion jobs/kola-openstack.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
""")
Expand Down
3 changes: 2 additions & 1 deletion jobs/release.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down