-
Notifications
You must be signed in to change notification settings - Fork 16
create hermetic builds #185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
openshift-merge-bot
merged 5 commits into
rh-ecosystem-edge:main
from
rauhersu:main.hermetic
Apr 3, 2025
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a38b9ff
create hermetic builds
rauhersu e06c0d0
remove subscription config and rely on rpm lock file
rauhersu 5c0e76f
test a different lock file
rauhersu d2e89e4
create lock files per docker stage
rauhersu cd9a3b5
update task-sast-coverity-check manually
rauhersu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # RPM lock files in Konflux | ||
|
|
||
| ## Overview | ||
| When installing external software via RPMs in Konflux builds, we need to integrate a RPM lock file management in our workflow: the primary goal is to ensure that hermetic builds ,required by Konflux Conforma, can pre-fetch RPM dependencies before building the Docker image. A hermetic build without lock files, relying on dynamic downloads exclusively, would fail due to no internet access otherwise. | ||
|
|
||
| More information about the hermetic builds in the [Konflux Hermetic Builds FAQ](https://konflux.pages.redhat.com/docs/users/faq/hermetic.html) | ||
|
|
||
| ## RPM lock file management | ||
|
|
||
| ### Generate a rpm lock file | ||
|
|
||
| We will be using a generator named `rpm-lock-file-prototype` according to the directions provided by that project in the [rpm-lockfile-prototype README](https://github.com/konflux-ci/rpm-lockfile-prototype?tab=readme-ov-file#installation) to generate the `rpms.lock.yaml`. | ||
|
|
||
| The recert image has a build stage and final runtime stage which requires different rpms to be installed.To that end, we have encapsulated the `rpms.in.yaml` and the resolved `rpms.lock.yaml` under two specific dirs which correspond to the specific stage: `lock-build` and `lock-runtime`. | ||
|
|
||
| The `rpms.lock.yaml` has been generated from the input provided by `rpms.in.yaml`: this file must be manually created from scratch by Konflux developers with the following fields: | ||
|
|
||
| 1. `repofiles`: the .repo file extracted from the runtime base image for recert (a `redhat.repo` file from rhel9 so far) | ||
| 2. `packages`: the rpms we depend on | ||
| 3. `arches`: the supported architectures for building | ||
| 4. `Containerfile`: the Containerfile used to build the recert image. | ||
|
|
||
| ### Introduce rpms based on new subscriptions | ||
|
|
||
| A subscription-manager/activation-key config has been carried out to fetch RPMs.See how to activate subscriptions in the [Konflux activation key doc](https://konflux.pages.redhat.com/docs/users/how-tos/configuring/activation-keys-subscription.html#_configuring_an_rpm_lockfile_for_hermetic_builds). | ||
|
|
||
| ### Configure the .tekton yaml files | ||
|
|
||
| The push/pull tekton yaml files in `.tekton` have been configured to setup a hermetic build workflow according to the [Konflux prefetch doc](https://konflux.pages.redhat.com/docs/users/how-tos/configuring/prefetching-dependencies.html#_procedure) | ||
|
|
||
| 1. Enable hermetic builds | ||
| ```yaml | ||
| - name: hermetic | ||
| value: "true" | ||
| ``` | ||
| 2. Enable rpm pre-fetch per stage, configuring two directories | ||
| ```yaml | ||
| - name: prefetch-input | ||
| value: '[{"type": "rpm", "path": ".konflux/lock-build"}, {"type": "rpm", "path": ".konflux/lock-runtime"}]' | ||
| ``` | ||
|
|
||
| 3. Enable dev package managers | ||
| ```yaml | ||
| - name: dev-package-managers | ||
| value: "true" | ||
| ``` | ||
|
|
||
| ### Update rpms | ||
| Konflux provides a mechanism (Mintmaker) to automatically file PRs to update RPM versions and generate the updated lockfile. At time of writing, this is limited to a `rpm.locks.yaml` file present in the project root. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Use Absolute Paths for WORKDIR
Hadolint recommends the use of absolute paths for the
WORKDIRdirective. Please update both instances (in the build and runtime stages) as shown below:This change enhances clarity and complies with best practices.
Also applies to: 21-21
🧰 Tools
🪛 Hadolint (2.12.0)
[error] 5-5: Use absolute WORKDIR
(DL3000)