Skip to content

Commit 0af5223

Browse files
authored
Merge branch 'main' into konflux/references/main
2 parents f1f54f2 + 79eecb2 commit 0af5223

File tree

14 files changed

+17592
-53
lines changed

14 files changed

+17592
-53
lines changed

.konflux/Dockerfile

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,22 @@
1+
# See README.Konflux.md before editing this Dockerfile
2+
13
# build stage
24
FROM registry.redhat.io/rhel9-4-els/rhel:9.4-1044 AS build-image
35
WORKDIR app
46
COPY . .
57

6-
RUN subscription-manager register --org $(cat "/activation-key/org") --activationkey $(cat "/activation-key/activationkey") \
7-
&& subscription-manager refresh \
8-
&& subscription-manager repos --disable=* \
9-
--enable=rhel-9-for-x86_64-baseos-rpms \
10-
--enable=rhel-9-for-x86_64-appstream-rpms \
11-
--enable=codeready-builder-for-rhel-9-x86_64-rpms
12-
138
RUN PKGS="rust-toolset protobuf-compiler" \
149
&& dnf install -y $PKGS \
15-
&& dnf clean all \
16-
&& subscription-manager unregister
10+
&& dnf clean all
1711

1812
RUN cargo build --release --bin recert
1913

2014
# runtime stage
2115
FROM registry.redhat.io/rhel9-4-els/rhel-minimal:9.4-149 AS runtime-image
2216

23-
RUN microdnf install -y 'subscription-manager' \
24-
&& subscription-manager register --org $(cat "/activation-key/org") --activationkey $(cat "/activation-key/activationkey") \
25-
&& subscription-manager refresh \
26-
&& subscription-manager repos --disable=* \
27-
--enable=rhel-9-for-x86_64-baseos-rpms
28-
2917
RUN PKGS="openssh-clients" \
3018
&& microdnf install -y $PKGS \
31-
&& microdnf clean all \
32-
&& subscription-manager unregister
19+
&& microdnf clean all
3320

3421
WORKDIR app
3522
COPY --from=build-image /app/target/release/recert /usr/local/bin

.konflux/README.Konflux.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# RPM lock files in Konflux
2+
3+
## Overview
4+
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.
5+
6+
More information about the hermetic builds in the [Konflux Hermetic Builds FAQ](https://konflux.pages.redhat.com/docs/users/faq/hermetic.html)
7+
8+
## RPM lock file management
9+
10+
### Generate a rpm lock file
11+
12+
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`.
13+
14+
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`.
15+
16+
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:
17+
18+
1. `repofiles`: the .repo file extracted from the runtime base image for recert (a `redhat.repo` file from rhel9 so far)
19+
2. `packages`: the rpms we depend on
20+
3. `arches`: the supported architectures for building
21+
4. `Containerfile`: the Containerfile used to build the recert image.
22+
23+
### Introduce rpms based on new subscriptions
24+
25+
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).
26+
27+
### Configure the .tekton yaml files
28+
29+
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)
30+
31+
1. Enable hermetic builds
32+
```yaml
33+
- name: hermetic
34+
value: "true"
35+
```
36+
2. Enable rpm pre-fetch per stage, configuring two directories
37+
```yaml
38+
- name: prefetch-input
39+
value: '[{"type": "rpm", "path": ".konflux/lock-build"}, {"type": "rpm", "path": ".konflux/lock-runtime"}]'
40+
```
41+
42+
3. Enable dev package managers
43+
```yaml
44+
- name: dev-package-managers
45+
value: "true"
46+
```
47+
48+
### Update rpms
49+
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.

0 commit comments

Comments
 (0)