Skip to content

task/buildah: add SKIP_INJECTIONS parameter#2964

Merged
chmeliik merged 1 commit intokonflux-ci:mainfrom
jlebon:pr/skip-injections
Nov 7, 2025
Merged

task/buildah: add SKIP_INJECTIONS parameter#2964
chmeliik merged 1 commit intokonflux-ci:mainfrom
jlebon:pr/skip-injections

Conversation

@jlebon
Copy link
Copy Markdown
Contributor

@jlebon jlebon commented Nov 6, 2025

Today, the buildah task automatically adds COPY directives into the Containerfile to inject dynamically-generated files (content-sets.json and labels.json). This kind of dynamic mutation of the build process makes it very hard to reproduce the build outside of Konflux (especially labels.json, which requires parsing the Containerfile).

Really, all the information in those files already lives in the upstream repo, and it's not hard for a project to take over that resposibility.

Add a new SKIP_INJECTIONS parameter which when set to true skips all those mutations.

To reiterate more explicitly: all our images should have these files. They are consumed by scanners like Clair. The goal is NOT to ship images without them, but simply to allow projects to take over that responsibility. We will eventually have checks in place that verify the presence and contents of these files. This will block anyone using this parameter without the necessary work upstream to add them.

@jlebon jlebon requested review from a team, Allda and jedinym as code owners November 6, 2025 14:58
Today, the buildah task automatically adds `COPY` directives into the
Containerfile to inject dynamically-generated files (`content-sets.json`
and `labels.json`). This kind of dynamic mutation of the build process
makes it very hard to reproduce the build outside of Konflux (especially
`labels.json`, which requires parsing the Containerfile).

Really, all the information in those files already lives in the upstream
repo, and it's not hard for a project to take over that resposibility.

Add a new SKIP_INJECTIONS parameter which when set to `true` skips all
those mutations.

To reiterate more explicitly: all our images should have these files.
They are consumed by scanners like Clair. The goal is NOT to ship
images without them, but simply to allow projects to take over that
responsibility. We will eventually have checks in place that verify the
presence and contents of these files. This will block anyone using this
parameter without the necessary work upstream to add them.

Signed-off-by: Jonathan Lebon <jonathan@jlebon.com>
@jlebon jlebon force-pushed the pr/skip-injections branch from 3f54e37 to b64b0c4 Compare November 6, 2025 14:59
# Conditionally write to the old location for backward compatibility
if [ "${ICM_KEEP_COMPAT_LOCATION}" = "true" ]; then
echo 'COPY labels.json /root/buildinfo/labels.json' >>"$dockerfile_copy"
if [ "${SKIP_INJECTIONS}" = "false" ]; then
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I just conditionalized the final injection sites rather than also many of the preparatory steps before this one to make this patch easier to review. I could be more invasive if folks prefer.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This seems reasonable, the preparatory work is not particularly costly 👍

@brunoapimentel
Copy link
Copy Markdown
Contributor

/ok-to-test

@chmeliik
Copy link
Copy Markdown
Contributor

chmeliik commented Nov 7, 2025

We will eventually have checks in place

What kind of checks do you have in mind?

@p-rog
Copy link
Copy Markdown

p-rog commented Nov 7, 2025

I'm guessing that ECP will check if necessary labels are correctly set.
If by default the SKIP_INJECTIONS will be set to "false", and only used when project owner understands the consequences I'm OK to this update.

@p-rog
Copy link
Copy Markdown

p-rog commented Nov 7, 2025

We will eventually have checks in place

What kind of checks do you have in mind?

@chmeliik There is ECP rule for this labels already:
release-engineering/rhtap-ec-policy#149

@konflux-ci-qe-bot
Copy link
Copy Markdown

@brunoapimentel: The following test has Completed, say /retest to rerun failed tests.

PipelineRun Name Status Rerun command Build Log Test Log
build-definitions-pull-request-z48hj Completed /retest View Pipeline Log View Test Logs

Inspecting Test Artifacts

To inspect your test artifacts, follow these steps:

  1. Install ORAS (see the ORAS installation guide).
  2. Download artifacts with the following commands:
mkdir -p oras-artifacts
cd oras-artifacts
oras pull quay.io/konflux-test-storage/konflux-team/build-definitions:b64b0c4a9d49add62d09955f5489f146c8edf458

Test results analysis

🚨 Error occurred while running the E2E tests, list of failed Spec(s):

OCI Artifact Browser URL

<not enabled>

@chmeliik
Copy link
Copy Markdown
Contributor

chmeliik commented Nov 7, 2025

We will eventually have checks in place

What kind of checks do you have in mind?

@chmeliik There is ECP rule for this labels already: release-engineering/rhtap-ec-policy#149

That's for the labels themselves, but not for the existence of labels.json in the filesystem or its content. May I ask you @p-rog or @jlebon to file a Conforma story to add the checks?

@chmeliik chmeliik added this pull request to the merge queue Nov 7, 2025
Merged via the queue into konflux-ci:main with commit cd79349 Nov 7, 2025
18 checks passed
@p-rog
Copy link
Copy Markdown

p-rog commented Nov 7, 2025

That's for the labels themselves, but not for the existence of labels.json in the filesystem or its content. May I ask you @p-rog or @jlebon to file a Conforma story to add the checks?

I will take care of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants