Skip to content

Commit b5669dd

Browse files
committed
build-node-image: label images with io.openshift.os.streamclass
Append a stream class label to both the node and extensions images derived from the RHEL major version of the release (e.g. `rhel-9`, `rhel-10`). The MCO can then match on that label to pick the correctly tagged payload with either RHEL9 or RHEL10 content when operating in a dual stream environment.
1 parent 46f8ef7 commit b5669dd

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

jobs/build-node-image.Jenkinsfile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ def basearches = params.ARCHES.split() as Set
5353
def timeout_mins = 300
5454

5555
def cosa_img = params.COREOS_ASSEMBLER_IMAGE
56+
// Derive the stream class once so both node and extensions builds use
57+
// the `io.openshift.os.streamclass` label. The streamclass is based on
58+
// the rhel major version and is used by the MCO to later select the right
59+
// image stream when multiple RHEL versions coexist.
60+
def rhel_segment = params.RELEASE.split('-')[1]
61+
def rhel_major = rhel_segment.split('\\.')[0]
62+
def stream_class = "rhel-${rhel_major}"
63+
def stream_class_label = "io.openshift.os.streamclass=${stream_class}"
5664

5765
// Get the tag that's unique
5866
def unique_tag = ""
@@ -122,8 +130,11 @@ lock(resource: "build-node-image") {
122130
withCredentials([file(credentialsId: 'oscontainer-push-registry-secret', variable: 'REGISTRY_AUTH_FILE')]) {
123131
def build_from = params.FROM ?: stream_info.from
124132
def label_args = []
133+
if (stream_class_label) {
134+
label_args += ["--label", "${stream_class_label}"]
135+
}
125136
if (unique_tag != "") {
126-
label_args = ["--label", "coreos.build.manifest-list-tag=${unique_tag}"]
137+
label_args += ["--label", "coreos.build.manifest-list-tag=${unique_tag}"]
127138
}
128139

129140
node_image_manifest_digest = pipeutils.build_and_push_image(arches: arches,
@@ -144,8 +155,11 @@ lock(resource: "build-node-image") {
144155
// Use the node image as from
145156
def build_from = "${registry_staging_repo}@${node_image_manifest_digest}"
146157
def label_args = []
158+
if (stream_class_label) {
159+
label_args += ["--label", "${stream_class_label}"]
160+
}
147161
if (unique_tag != "") {
148-
label_args = ["--label", "coreos.build.manifest-list-tag=${unique_tag}-extensions"]
162+
label_args += ["--label", "coreos.build.manifest-list-tag=${unique_tag}-extensions"]
149163
}
150164
extensions_image_manifest_digest = pipeutils.build_and_push_image(arches: arches,
151165
src_commit: commit,

0 commit comments

Comments
 (0)