Skip to content

COS-4051: tree: add labels.json and security OCI labels for Clair scanning#1919

Merged
openshift-merge-bot[bot] merged 3 commits intoopenshift:masterfrom
jlebon:pr/build-args-sec
Apr 29, 2026
Merged

COS-4051: tree: add labels.json and security OCI labels for Clair scanning#1919
openshift-merge-bot[bot] merged 3 commits intoopenshift:masterfrom
jlebon:pr/build-args-sec

Conversation

@jlebon
Copy link
Copy Markdown
Member

@jlebon jlebon commented Mar 30, 2026

As part of container-first reporting (KONFLUX-6210), security scanners like Clair expect metadata at the OCI level (as labels) and in the rootfs itself (as a JSON file at /usr/share/buildinfo/labels.json).

To accommodate this, each variant now has a build-args-*.conf file that specifies the image name and CPE, but also while we're here, the image FROM to use which nicely cleans up the building docs. For the architecture, we use buildah's built-in TARGETARCH.

This is only relevant on OCP, not OKD. So skip it there.

Once we start building the node image through Konflux, this should in theory no longer be necessary because the Konflux pipeline itself automatically adds this information (though there's still details there to figure out on where that information comes from/whether it's correct).

Closes: https://redhat.atlassian.net/browse/COS-4051
Assisted-by: OpenCode (Claude Opus 4.6)

OKD doesn't care about this anymore and we don't either. So this is
essentially dead code.

Nuke all c9s-related bits.

Assisted-by: OpenCode (Claude Opus 4.6)
@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 30, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Mar 30, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@jlebon
Copy link
Copy Markdown
Member Author

jlebon commented Mar 30, 2026

Let's hold this until coreos/fedora-coreos-pipeline#1325 and coreos/coreos-assembler#4512 are merged.

Also, this does imply that for ART to build the node image in Konflux, AIUI doozer would have to learn about build arg files when calling out to Konflux. cc @joepvd in case you have concerns there.

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 30, 2026
Comment thread Containerfile Outdated
Comment thread scripts/generate-labels
@jlebon
Copy link
Copy Markdown
Member Author

jlebon commented Mar 31, 2026

OK filed https://redhat.atlassian.net/browse/ART-14812 for the ART side of this. I didn't hear a "no, we don't want to support this" from Joep. :)

@jlebon jlebon force-pushed the pr/build-args-sec branch from f90e601 to 26d3f03 Compare April 21, 2026 20:16
@jlebon jlebon marked this pull request as ready for review April 21, 2026 20:16
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 21, 2026
@openshift-ci openshift-ci Bot requested review from aaradhak and jmarrero April 21, 2026 20:16
@jlebon
Copy link
Copy Markdown
Member Author

jlebon commented Apr 21, 2026

Requirements for this have merged now so I think we're unblocked on this!

@jlebon
Copy link
Copy Markdown
Member Author

jlebon commented Apr 21, 2026

Asked my agent to build all of RHCOS 9.8, RHCOS 10.2 and SCOS 10, and to give a final report of all values. Here it is.


RHCOS 9.8

OCI Labels:

Label Value
name openshift/ose-rhel-coreos-9
cpe cpe:/a:redhat:openshift:4.22::el9
architecture amd64

/usr/share/buildinfo/labels.json:

{
  "architecture": "amd64",
  "cpe": "cpe:/a:redhat:openshift:4.22::el9",
  "name": "openshift/ose-rhel-coreos-9",
  "org.opencontainers.image.created": "2026-04-21T20:11:58Z"
}

RHCOS 10.2

OCI Labels:

Label Value
name openshift/ose-rhel-coreos-10
cpe cpe:/a:redhat:openshift:4.22::el10
architecture amd64

/usr/share/buildinfo/labels.json:

{
  "architecture": "amd64",
  "cpe": "cpe:/a:redhat:openshift:4.22::el10",
  "name": "openshift/ose-rhel-coreos-10",
  "org.opencontainers.image.created": "2026-04-21T20:15:24Z"
}

SCOS (CentOS Stream 10)

OCI Labels:

Label Value
name (empty)
cpe (empty)
architecture amd64

/usr/share/buildinfo/labels.json: not present

@jlebon
Copy link
Copy Markdown
Member Author

jlebon commented Apr 21, 2026

So yeah, the name and cpe labels are still there even for the SCOS build, because you can't conditionalize labels from a Containerfile (except for the chunkah trick...), but I don't think it matters anyway for SCOS.

As part of container-first reporting (KONFLUX-6210), security scanners
like Clair expect metadata at the OCI level (as labels) _and_ in the
rootfs itself (as a JSON file at `/usr/share/buildinfo/labels.json`).

To accommodate this, each variant now has a `build-args-*.conf` file
that specifies the image name and CPE, but also while we're here, the
image `FROM` to use which nicely cleans up the building docs. For the
architecture, we use buildah's built-in `TARGETARCH`.

This is only relevant on OCP, not OKD. So skip it there.

Once we start building the node image through Konflux, this should
in theory no longer be necessary because the Konflux pipeline itself
automatically adds this information (though there's still details
there to figure out on where that information comes from/whether it's
correct).

Closes: https://redhat.atlassian.net/browse/COS-4051
Assisted-by: OpenCode (Claude Opus 4.6)
@jlebon
Copy link
Copy Markdown
Member Author

jlebon commented Apr 22, 2026

OK right, CI is failing here because OpenShift CI doesn't know about the build args. And looking at ci-operator, it looks like it doesn't support build args files. Sigh. The OpenShift CI vs Konflux thing is really awkward.

Anyway, just hacking around this for now by hardcoding values for ci-operator in openshift/release#78212. Not great, I know...

jlebon added a commit to jlebon/release that referenced this pull request Apr 22, 2026
In openshift/os#1919, we're changing the
openshift/os Containerfile to use ARG IMAGE_FROM=overridden instead of
a hardcoded FROM, and to require IMAGE_NAME/IMAGE_CPE build args for
RHCOS builds.

So we need to adapt the `as` substitution here accordingly.

Unfortunately, ci-operator (but really, Builds v1) doesn't support build
args files so here we're just hardcoding values for the parameter for
CI to build. This is something we'd be able to fix once CI also uses
Konflux.

Yes, the literal `${IMAGE_FROM}` is intended because the substitution
needs to match against the raw string in the Dockerfile AIUI.

Keep the old value too so that we can merge this
PR and not break openshift/os CI before merging
openshift/os#1919.

Assisted-by: OpenCode (Claude Opus 4.6)
openshift-merge-bot Bot pushed a commit to openshift/release that referenced this pull request Apr 23, 2026
In openshift/os#1919, we're changing the
openshift/os Containerfile to use ARG IMAGE_FROM=overridden instead of
a hardcoded FROM, and to require IMAGE_NAME/IMAGE_CPE build args for
RHCOS builds.

So we need to adapt the `as` substitution here accordingly.

Unfortunately, ci-operator (but really, Builds v1) doesn't support build
args files so here we're just hardcoding values for the parameter for
CI to build. This is something we'd be able to fix once CI also uses
Konflux.

Yes, the literal `${IMAGE_FROM}` is intended because the substitution
needs to match against the raw string in the Dockerfile AIUI.

Keep the old value too so that we can merge this
PR and not break openshift/os CI before merging
openshift/os#1919.

Assisted-by: OpenCode (Claude Opus 4.6)
@jlebon
Copy link
Copy Markdown
Member Author

jlebon commented Apr 24, 2026

/retest

tbuskey pushed a commit to tbuskey/release that referenced this pull request Apr 24, 2026
…shift#78212)

In openshift/os#1919, we're changing the
openshift/os Containerfile to use ARG IMAGE_FROM=overridden instead of
a hardcoded FROM, and to require IMAGE_NAME/IMAGE_CPE build args for
RHCOS builds.

So we need to adapt the `as` substitution here accordingly.

Unfortunately, ci-operator (but really, Builds v1) doesn't support build
args files so here we're just hardcoding values for the parameter for
CI to build. This is something we'd be able to fix once CI also uses
Konflux.

Yes, the literal `${IMAGE_FROM}` is intended because the substitution
needs to match against the raw string in the Dockerfile AIUI.

Keep the old value too so that we can merge this
PR and not break openshift/os CI before merging
openshift/os#1919.

Assisted-by: OpenCode (Claude Opus 4.6)
@jlebon
Copy link
Copy Markdown
Member Author

jlebon commented Apr 24, 2026

/retest

@jlebon
Copy link
Copy Markdown
Member Author

jlebon commented Apr 24, 2026

  • cannot install both openssl-libs-1:3.5.5-1.el9.x86_64 from rhel-9.8-baseos and openssl-libs-1:3.5.5-2.el9_8.x86_64 from @System

Base RHCOS 9.8 image is ahead of 9.8 CI repos

@jlebon
Copy link
Copy Markdown
Member Author

jlebon commented Apr 27, 2026

/retest

@jlebon
Copy link
Copy Markdown
Member Author

jlebon commented Apr 27, 2026

OK, still hitting the openssl-libs mismatch due to CI repos being stale. And looking at:

 rpm-md repo 'rhel-9.8-baseos'; generated: 2026-04-13T04:52:49Z solvables: 1187 

it looks like it's 14 days old? Whereas we always compose with the latest 9.8 nightly.

@jlebon
Copy link
Copy Markdown
Member Author

jlebon commented Apr 27, 2026

I think the actual CI issue here comes from openshift-eng/ocp-build-data#9980 (comment)

@jlebon
Copy link
Copy Markdown
Member Author

jlebon commented Apr 27, 2026

Building the extensions image locally with the same pulp stage repo used as a source for the CI reposync, it does succeed and finds openssl-devel-1:3.5.5-2.el9_8.x86_64. I also see:

rpm-md repo 'rhel-9.8-baseos'; generated: 2026-04-24T18:14:32Z solvables: 13702

So yeah, I think it is a sync issue.

@thegreyd
Copy link
Copy Markdown

/retest-required

Prucek pushed a commit to Prucek/release that referenced this pull request Apr 29, 2026
…shift#78212)

In openshift/os#1919, we're changing the
openshift/os Containerfile to use ARG IMAGE_FROM=overridden instead of
a hardcoded FROM, and to require IMAGE_NAME/IMAGE_CPE build args for
RHCOS builds.

So we need to adapt the `as` substitution here accordingly.

Unfortunately, ci-operator (but really, Builds v1) doesn't support build
args files so here we're just hardcoding values for the parameter for
CI to build. This is something we'd be able to fix once CI also uses
Konflux.

Yes, the literal `${IMAGE_FROM}` is intended because the substitution
needs to match against the raw string in the Dockerfile AIUI.

Keep the old value too so that we can merge this
PR and not break openshift/os CI before merging
openshift/os#1919.

Assisted-by: OpenCode (Claude Opus 4.6)
@jlebon jlebon force-pushed the pr/build-args-sec branch from aa7049c to 509f23c Compare April 29, 2026 13:57
ART is no longer populating the 98 repo currently. To get pre-release
content, we need to use the 9 repo directly.
@jlebon jlebon force-pushed the pr/build-args-sec branch from 509f23c to d0be268 Compare April 29, 2026 15:04
@jlebon jlebon changed the title tree: add labels.json and security OCI labels for Clair scanning COS-4051: tree: add labels.json and security OCI labels for Clair scanning Apr 29, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Apr 29, 2026
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Apr 29, 2026

@jlebon: This pull request references COS-4051 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "5.0.0" version, but no target version was set.

Details

In response to this:

As part of container-first reporting (KONFLUX-6210), security scanners like Clair expect metadata at the OCI level (as labels) and in the rootfs itself (as a JSON file at /usr/share/buildinfo/labels.json).

To accommodate this, each variant now has a build-args-*.conf file that specifies the image name and CPE, but also while we're here, the image FROM to use which nicely cleans up the building docs. For the architecture, we use buildah's built-in TARGETARCH.

This is only relevant on OCP, not OKD. So skip it there.

Once we start building the node image through Konflux, this should in theory no longer be necessary because the Konflux pipeline itself automatically adds this information (though there's still details there to figure out on where that information comes from/whether it's correct).

Closes: https://redhat.atlassian.net/browse/COS-4051
Assisted-by: OpenCode (Claude Opus 4.6)

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@jlebon
Copy link
Copy Markdown
Member Author

jlebon commented Apr 29, 2026

OK, CI is passing! 🎉
Not really happy about the repo name mangling commit, but hopefully we can revert that soon.

This is ready for final review now.

Copy link
Copy Markdown
Member

@dustymabe dustymabe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

we should update branching docs somewhere regarding this change.

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Apr 29, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 29, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dustymabe, jlebon

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jlebon
Copy link
Copy Markdown
Member Author

jlebon commented Apr 29, 2026

/verified by #1919 (comment)

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Apr 29, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@jlebon: This PR has been marked as verified by https://github.com/openshift/os/pull/1919#issuecomment-4291558976.

Details

In response to this:

/verified by #1919 (comment)

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 29, 2026

@jlebon: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot Bot merged commit 398ab69 into openshift:master Apr 29, 2026
3 checks passed
@jlebon
Copy link
Copy Markdown
Member Author

jlebon commented May 1, 2026

/cherrypick release-4.22

@openshift-cherrypick-robot
Copy link
Copy Markdown

@jlebon: new pull request created: #1933

Details

In response to this:

/cherrypick release-4.22

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

BATMAN-JD pushed a commit to BATMAN-JD/release that referenced this pull request May 1, 2026
…shift#78212)

In openshift/os#1919, we're changing the
openshift/os Containerfile to use ARG IMAGE_FROM=overridden instead of
a hardcoded FROM, and to require IMAGE_NAME/IMAGE_CPE build args for
RHCOS builds.

So we need to adapt the `as` substitution here accordingly.

Unfortunately, ci-operator (but really, Builds v1) doesn't support build
args files so here we're just hardcoding values for the parameter for
CI to build. This is something we'd be able to fix once CI also uses
Konflux.

Yes, the literal `${IMAGE_FROM}` is intended because the substitution
needs to match against the raw string in the Dockerfile AIUI.

Keep the old value too so that we can merge this
PR and not break openshift/os CI before merging
openshift/os#1919.

Assisted-by: OpenCode (Claude Opus 4.6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants