@@ -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
115115def 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
120120echo "Waiting for build-${params.STREAM} lock"
121121currentBuild.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