Skip to content

Commit 25c03a1

Browse files
authored
Merge pull request #1221 from jbtrystram/import_stream_param_match
build: oci import follow-ups
2 parents 55534c1 + f9503e8 commit 25c03a1

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

docs/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ streams:
6767
skip_disk_images: true
6868
# OPTIONAL: Whether to skip building ostree in the build pipeline.
6969
# The build would be imported using `cosa import` with the specified image uri.
70-
source_oci_image: quay.io/coreos-devel/fedora-coreos:rawhide
70+
import_oci_image: quay.io/coreos-devel/fedora-coreos:rawhide
7171
# OPTIONAL: make the release job trigger build-node-image for the
7272
# following OCP releases once successful
7373
build_node_images: ["4.19-9.6"]

jobs/build.Jenkinsfile

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ properties([
1717
choice(name: 'STREAM',
1818
choices: pipeutils.get_streams_choices(pipecfg),
1919
description: 'CoreOS stream to build'),
20-
string(name: 'SOURCE_OCI_IMAGE',
21-
description: 'Override source_oci_image image to use. If set, the STREAM parameter will be ignored.',
20+
string(name: 'IMPORT_OCI_IMAGE',
21+
description: 'Override import_oci_image image to use. If set, the STREAM parameter must match the image labels.',
2222
defaultValue: "",
2323
trim: true),
2424
string(name: 'VERSION',
@@ -114,8 +114,8 @@ def cosa_memory_request_mb = 10.5 * 1024 as Integer
114114
// cleaner
115115
def ncpus = ((cosa_memory_request_mb - 512) / 1536) as Integer
116116

117-
def source_oci_image = params.SOURCE_OCI_IMAGE ?: stream_info.get("source_oci_image", "")
118-
boolean import_oci = source_oci_image != ""
117+
def import_oci_image = params.IMPORT_OCI_IMAGE ?: stream_info.get("import_oci_image", "")
118+
boolean import_oci = import_oci_image != ""
119119

120120
echo "Waiting for build-${params.STREAM} lock"
121121
currentBuild.description = "${build_description} Waiting"
@@ -186,10 +186,8 @@ lock(resource: "build-${params.STREAM}") {
186186

187187
def (url, ref) = pipeutils.get_source_config_for_stream(pipecfg, params.STREAM)
188188
def src_config_commit = ""
189-
if (source_oci_image != "") {
190-
// TODO: use standard label 'org.opencontainers.image.revision' once available instead of 'vcs-ref' one
191-
// c.f https://github.com/konflux-ci/build-definitions/pull/2770
192-
src_config_commit = shwrapCapture("skopeo inspect --retry-times 3 docker://$source_oci_image | jq -r '.Labels.\"vcs-ref\"'")
189+
if (import_oci) {
190+
src_config_commit = shwrapCapture("skopeo inspect -n --retry-times 3 docker://$import_oci_image | jq -r '.Labels.\"org.opencontainers.image.revision\"'")
193191
} else {
194192
src_config_commit = shwrapCapture("git ls-remote ${url} refs/heads/${ref} | cut -d \$'\t' -f 1")
195193
}
@@ -345,8 +343,8 @@ lock(resource: "build-${params.STREAM}") {
345343
newBuildID = buildID
346344
} else {
347345
stage("Import OCI image") {
348-
echo "Skipping build : Importing OCI : $source_oci_image"
349-
shwrap("cosa import docker://${source_oci_image} --skip-prune")
346+
echo "Skipping build : Importing OCI : $import_oci_image"
347+
shwrap("cosa import docker://${import_oci_image} --skip-prune")
350348
def builds = readJSON file: "builds/builds.json"
351349
newBuildID = builds.builds[0].id
352350
}

0 commit comments

Comments
 (0)