Skip to content

Commit e6fb4b9

Browse files
authored
NETOBSERV-2611: add tar to dockerfiles (#462)
* NETOBSERV-2611: add tar to dockerfiles * Update konflux hermetic builds with rpm cache
1 parent 7885b72 commit e6fb4b9

File tree

7 files changed

+158
-2
lines changed

7 files changed

+158
-2
lines changed

.tekton/pipeline-ref.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ spec:
4848
description: Execute the build with network isolation
4949
name: hermetic
5050
type: string
51-
- default: "{\"type\":\"gomod\", \"path\":\".\"}"
51+
- default: '[{"type": "gomod", "path": "."}, {"type": "rpm", "path": "./rpm-prefetching/"}]'
5252
description: Build dependencies to be prefetched by Cachi2
5353
name: prefetch-input
5454
type: string

Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ RUN USER=netobserv VERSION=main make oc-commands
3333
RUN mkdir -p output
3434

3535
# Create final image from ubi + built binary and command
36-
FROM --platform=linux/$TARGETARCH registry.access.redhat.com/ubi9/ubi:9.7-1769417801
36+
FROM --platform=linux/$TARGETARCH registry.access.redhat.com/ubi9/ubi-minimal:9.7-1769056855
37+
38+
RUN microdnf install -y tar && \
39+
microdnf clean all
40+
3741
WORKDIR /
3842

3943
COPY --from=builder /opt/app-root/build .

Dockerfile.downstream

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ FROM registry.access.redhat.com/ubi9/ubi-minimal:9.7-1769056855
3838
ARG BUILDVERSION
3939
ARG BUILDVERSION_Y
4040

41+
RUN microdnf install -y tar && \
42+
microdnf clean all
43+
4144
WORKDIR /
4245

4346
COPY --from=builder /opt/app-root/build .

rpm-prefetching/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## RPM pre-fetching for Konflux
2+
3+
1. Doc reference is here: https://konflux.pages.redhat.com/docs/users/building/prefetching-dependencies.html#rpm-walkthrough
4+
5+
2. How it's currently done:
6+
7+
Tool rpm-lockfile-prototype is downloaded as a Docker image via:
8+
9+
```
10+
curl https://raw.githubusercontent.com/konflux-ci/rpm-lockfile-prototype/refs/heads/main/Containerfile \
11+
| $(OCI_BIN) build -t localhost/rpm-lockfile-prototype -
12+
```
13+
14+
Then, ubi.repo was created out of the current base image (which means, we need to do it again every time the base image changes)
15+
16+
```
17+
BASE_IMAGE=registry.access.redhat.com/ubi9/ubi-minimal:9.7-1769056855
18+
podman run -it $BASE_IMAGE cat /etc/yum.repos.d/ubi.repo > rpm-prefetching/ubi.repo
19+
sed -i 's/ubi-9-codeready-builder/codeready-builder-for-ubi-9-$basearch/' rpm-prefetching/ubi.repo
20+
sed -i 's/\[ubi-9/[ubi-9-for-$basearch/' rpm-prefetching/ubi.repo
21+
```
22+
23+
Finally, run rpm-lockfile-prototype:
24+
25+
```
26+
podman run --privileged --rm -v ./rpm-prefetching:/work localhost/rpm-lockfile-prototype:latest --outfile=rpms.lock.yaml --image $BASE_IMAGE rpms.in.yaml
27+
```
28+
29+
3. Automate all this!

rpm-prefetching/rpms.in.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
contentOrigin:
2+
repofiles:
3+
- ubi.repo
4+
packages:
5+
- tar
6+
arches:
7+
- aarch64
8+
- x86_64
9+
- ppc64le
10+
- s390x

rpm-prefetching/rpms.lock.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
lockfileVersion: 1
3+
lockfileVendor: redhat
4+
arches:
5+
- arch: aarch64
6+
packages:
7+
- url: https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi9/9/aarch64/baseos/os/Packages/t/tar-1.34-9.el9_7.aarch64.rpm
8+
repoid: ubi-9-for-aarch64-baseos-rpms
9+
size: 898317
10+
checksum: sha256:2d0bd44116c3f5c229d25fdc6458f6ce24a7ad4fdb463767eea48dcab78c5062
11+
name: tar
12+
evr: 2:1.34-9.el9_7
13+
sourcerpm: tar-1.34-9.el9_7.src.rpm
14+
source: []
15+
module_metadata: []
16+
- arch: ppc64le
17+
packages:
18+
- url: https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi9/9/ppc64le/baseos/os/Packages/t/tar-1.34-9.el9_7.ppc64le.rpm
19+
repoid: ubi-9-for-ppc64le-baseos-rpms
20+
size: 938310
21+
checksum: sha256:6b32b0c5b960f836c91fae329c0d2786d932a44b9e44711639646b5e55146c8b
22+
name: tar
23+
evr: 2:1.34-9.el9_7
24+
sourcerpm: tar-1.34-9.el9_7.src.rpm
25+
source: []
26+
module_metadata: []
27+
- arch: s390x
28+
packages:
29+
- url: https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi9/9/s390x/baseos/os/Packages/t/tar-1.34-9.el9_7.s390x.rpm
30+
repoid: ubi-9-for-s390x-baseos-rpms
31+
size: 900131
32+
checksum: sha256:ae335ed3e594cdb4123c6732c5dd9d4250050e96117e2593b31f8c4ee4ee2b8f
33+
name: tar
34+
evr: 2:1.34-9.el9_7
35+
sourcerpm: tar-1.34-9.el9_7.src.rpm
36+
source: []
37+
module_metadata: []
38+
- arch: x86_64
39+
packages:
40+
- url: https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi9/9/x86_64/baseos/os/Packages/t/tar-1.34-9.el9_7.x86_64.rpm
41+
repoid: ubi-9-for-x86_64-baseos-rpms
42+
size: 906521
43+
checksum: sha256:4c0beb933074a5254c297e8968b3f41ec5a02b23056997ddcf526fe7e6166482
44+
name: tar
45+
evr: 2:1.34-9.el9_7
46+
sourcerpm: tar-1.34-9.el9_7.src.rpm
47+
source: []
48+
module_metadata: []

rpm-prefetching/ubi.repo

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
[ubi-9-for-$basearch-baseos-rpms]
2+
name = Red Hat Universal Base Image 9 (RPMs) - BaseOS
3+
baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi9/9/$basearch/baseos/os
4+
enabled = 1
5+
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
6+
gpgcheck = 1
7+
8+
[ubi-9-for-$basearch-baseos-debug-rpms]
9+
name = Red Hat Universal Base Image 9 (Debug RPMs) - BaseOS
10+
baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi9/9/$basearch/baseos/debug
11+
enabled = 0
12+
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
13+
gpgcheck = 1
14+
15+
[ubi-9-for-$basearch-baseos-source-rpms]
16+
name = Red Hat Universal Base Image 9 (Source RPMs) - BaseOS
17+
baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi9/9/$basearch/baseos/source/SRPMS
18+
enabled = 0
19+
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
20+
gpgcheck = 1
21+
22+
[ubi-9-for-$basearch-appstream-rpms]
23+
name = Red Hat Universal Base Image 9 (RPMs) - AppStream
24+
baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi9/9/$basearch/appstream/os
25+
enabled = 1
26+
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
27+
gpgcheck = 1
28+
29+
[ubi-9-for-$basearch-appstream-debug-rpms]
30+
name = Red Hat Universal Base Image 9 (Debug RPMs) - AppStream
31+
baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi9/9/$basearch/appstream/debug
32+
enabled = 0
33+
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
34+
gpgcheck = 1
35+
36+
[ubi-9-for-$basearch-appstream-source-rpms]
37+
name = Red Hat Universal Base Image 9 (Source RPMs) - AppStream
38+
baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi9/9/$basearch/appstream/source/SRPMS
39+
enabled = 0
40+
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
41+
gpgcheck = 1
42+
43+
[codeready-builder-for-ubi-9-$basearch-rpms]
44+
name = Red Hat Universal Base Image 9 (RPMs) - CodeReady Builder
45+
baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi9/9/$basearch/codeready-builder/os
46+
enabled = 1
47+
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
48+
gpgcheck = 1
49+
50+
[codeready-builder-for-ubi-9-$basearch-debug-rpms]
51+
name = Red Hat Universal Base Image 9 (Debug RPMs) - CodeReady Builder
52+
baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi9/9/$basearch/codeready-builder/debug
53+
enabled = 0
54+
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
55+
gpgcheck = 1
56+
57+
[codeready-builder-for-ubi-9-$basearch-source-rpms]
58+
name = Red Hat Universal Base Image 9 (Source RPMs) - CodeReady Builder
59+
baseurl = https://cdn-ubi.redhat.com/content/public/ubi/dist/ubi9/9/$basearch/codeready-builder/source/SRPMS
60+
enabled = 0
61+
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
62+
gpgcheck = 1

0 commit comments

Comments
 (0)