Skip to content

Commit b2e7e79

Browse files
Merge pull request #3810 from fontivan/sskeard/cnf-22506-update-ubi-tags
CNF-22504: Best practices for ubi tags
2 parents c259d64 + 34f2849 commit b2e7e79

File tree

8 files changed

+52
-45
lines changed

8 files changed

+52
-45
lines changed

cnf-tests/.konflux/Makefile

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ PROJECT_DIR := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
88
ROOT_PROJECT_DIR := $(shell dirname $(shell dirname $(abspath $(PROJECT_DIR))))
99

1010
# RHEL9_RELEASE defines the RHEL9 release version to update the rpm lock file for the runtime
11-
# This is automatically extracted from the Containerfile
12-
RHEL9_RELEASE ?= $(shell awk '/^FROM registry.access.redhat.com\/ubi9\/ubi-minimal:/ {split($$2, parts, /[:|@]/); print parts[2]}' $(PROJECT_DIR)/Dockerfile)
13-
RHEL9_RELEASE_DASHED := $(subst .,-,$(RHEL9_RELEASE))
11+
RHEL9_RELEASE ?= latest
1412

1513
# These should be set by the caller of the Makefile
1614
RHEL9_ACTIVATION_KEY ?= ""
@@ -22,6 +20,14 @@ RHEL9_ORG_ID ?= ""
2220
# This can be set from the command line if the default is not correct for your environment.
2321
REGISTRY_AUTH_FILE ?= $(shell echo $${XDG_RUNTIME_DIR:-/run/user/$$(id -u)})/containers/auth.json
2422

23+
# BSD sed (macOS) requires a backup suffix after -i (use '' for none); GNU sed (Linux) uses plain -i.
24+
UNAME_S := $(shell uname -s)
25+
ifeq ($(UNAME_S),Darwin)
26+
SED_INPLACE := sed -i ''
27+
else
28+
SED_INPLACE := sed -i
29+
endif
30+
2531
.PHONY: help
2632
help: ## Display this help.
2733
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
@@ -41,12 +47,12 @@ konflux-update-rpm-lock-runtime: sync-telco5g-konflux-submodule ## Update the rp
4147
cp $(PROJECT_DIR)/Dockerfile $(PROJECT_DIR)/lock-runtime/Dockerfile
4248
@echo "Copying rpms.in.yaml to lock-runtime directory..."
4349
cp $(PROJECT_DIR)/rpms.in.yaml $(PROJECT_DIR)/lock-runtime/rpms.in.yaml
44-
sed -i 's|sslclientkey: $$SSL_CLIENT_KEY|sslclientkey: /etc/pki/entitlement/placeholder-key.pem|g' $(PROJECT_DIR)/lock-runtime/rpms.in.yaml
45-
sed -i 's|sslclientcert: $$SSL_CLIENT_CERT|sslclientcert: /etc/pki/entitlement/placeholder.pem|g' $(PROJECT_DIR)/lock-runtime/rpms.in.yaml
50+
$(SED_INPLACE) 's|sslclientkey: $$SSL_CLIENT_KEY|sslclientkey: /etc/pki/entitlement/placeholder-key.pem|g' $(PROJECT_DIR)/lock-runtime/rpms.in.yaml
51+
$(SED_INPLACE) 's|sslclientcert: $$SSL_CLIENT_CERT|sslclientcert: /etc/pki/entitlement/placeholder.pem|g' $(PROJECT_DIR)/lock-runtime/rpms.in.yaml
4652
@cat $(PROJECT_DIR)/lock-runtime/rpms.in.yaml
4753
$(MAKE) -C $(ROOT_PROJECT_DIR)/telco5g-konflux/scripts/rpm-lock generate-rhel9-locks \
4854
LOCK_SCRIPT_TARGET_DIR=$(PROJECT_DIR)/lock-runtime \
49-
RHEL9_IMAGE_TO_LOCK=$$(awk '/^FROM registry.access.redhat.com\/ubi9\/ubi-minimal:/ {print $$2}' $(PROJECT_DIR)/Dockerfile) \
55+
RHEL9_IMAGE_TO_LOCK=registry.access.redhat.com/ubi9/ubi-minimal:$(RHEL9_RELEASE) \
5056
REGISTRY_AUTH_FILE=$(REGISTRY_AUTH_FILE) \
5157
\
5258
RHEL9_RELEASE=$(RHEL9_RELEASE) \

cnf-tests/.konflux/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ As part of the update, make sure that packages are updated in both `rpms.in.yaml
1919
It is enough that the Dockerfile that is used to generate the lockfile contain the final base image and the command that installs the packages. For example:
2020

2121
```azure
22-
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.4
22+
FROM registry.access.redhat.com/ubi9/ubi-minimal:latest
2323
RUN microdnf install -y lksctp-tools iproute \
2424
ethtool iputils procps-ng numactl-libs iptables \
2525
kmod realtime-tests linuxptp iperf3 nc \
@@ -31,7 +31,7 @@ When an image version is out-of-maintenance (OOM) some versions has what's calle
3131
As any other RPM repo, also EUS repos need to be enabled in the activation key. Once enabled, the lockfile will be generated with additional EUS packages. The version of the base images should anyhow align with those used for OCP for the same branch.
3232

3333
**Important**:
34-
* When starting the container in which you will be generating the lockfile in, use a production image in order to get the GA RPM repos and not beta one. So use `registry.access.redhat.com/ubi9/ubi-minimal:9.4` and not `registry-proxy.engineering.redhat.com/rh-osbs/ubi9/ubi-minimal:9.4`.
34+
* When starting the container in which you will be generating the lockfile in, use a production image in order to get the GA RPM repos and not beta one. So use `registry.access.redhat.com/ubi9/ubi-minimal:latest` and not `registry-proxy.engineering.redhat.com/rh-osbs/ubi9/ubi-minimal:latest`.
3535
* Please make sure that the repos that you used to pull the RPMs from are found under the activation key that is associated to the konflux public instance by:
3636
<steps on how to confirm this will be detailed later once we have a team activation key>
3737

cnf-tests/.konflux/rpms.lock.yaml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ arches:
3232
name: nmap-ncat
3333
evr: 3:7.92-3.el9
3434
sourcerpm: nmap-7.92-3.el9.src.rpm
35-
- url: https://cdn.redhat.com/content/dist/rhel9/9.7/x86_64/appstream/os/Packages/p/python-unversioned-command-3.9.25-3.el9_7.noarch.rpm
35+
- url: https://cdn.redhat.com/content/dist/rhel9/9.7/x86_64/appstream/os/Packages/p/python-unversioned-command-3.9.25-3.el9_7.1.noarch.rpm
3636
repoid: rhel-9-for-x86_64-appstream-rpms
37-
size: 15791
38-
checksum: sha256:624671b3cc8d4e90eb53a05aae5c5533c6f9f4cb9c18ec0720ac98e328b8f69b
37+
size: 15875
38+
checksum: sha256:f0b982bd1aef79c7389814cf16dbfe64737be8692bd9f9ae2f0a8618e397bdd6
3939
name: python-unversioned-command
40-
evr: 3.9.25-3.el9_7
41-
sourcerpm: python3.9-3.9.25-3.el9_7.src.rpm
40+
evr: 3.9.25-3.el9_7.1
41+
sourcerpm: python3.9-3.9.25-3.el9_7.1.src.rpm
4242
- url: https://cdn.redhat.com/content/dist/rhel9/9.7/x86_64/appstream/os/Packages/r/realtime-tests-2.9-1.el9.x86_64.rpm
4343
repoid: rhel-9-for-x86_64-appstream-rpms
4444
size: 196448
@@ -165,13 +165,13 @@ arches:
165165
name: jansson
166166
evr: 2.14-1.el9
167167
sourcerpm: jansson-2.14-1.el9.src.rpm
168-
- url: https://cdn.redhat.com/content/dist/rhel9/9.7/x86_64/baseos/os/Packages/k/kernel-tools-libs-5.14.0-611.36.1.el9_7.x86_64.rpm
168+
- url: https://cdn.redhat.com/content/dist/rhel9/9.7/x86_64/baseos/os/Packages/k/kernel-tools-libs-5.14.0-611.41.1.el9_7.x86_64.rpm
169169
repoid: rhel-9-for-x86_64-baseos-rpms
170-
size: 1181881
171-
checksum: sha256:15810c98bd132f55b8f49463a74d76bfaaa5a7beb3dbd5e9974e3d94a3b470ea
170+
size: 1184541
171+
checksum: sha256:b2d18b8b71cfcf941b1056a0cfbe28ea7de3d015a954c3c5ff6fc7183fcc8799
172172
name: kernel-tools-libs
173-
evr: 5.14.0-611.36.1.el9_7
174-
sourcerpm: kernel-5.14.0-611.36.1.el9_7.src.rpm
173+
evr: 5.14.0-611.41.1.el9_7
174+
sourcerpm: kernel-5.14.0-611.41.1.el9_7.src.rpm
175175
- url: https://cdn.redhat.com/content/dist/rhel9/9.7/x86_64/baseos/os/Packages/k/kmod-28-11.el9.x86_64.rpm
176176
repoid: rhel-9-for-x86_64-baseos-rpms
177177
size: 127775
@@ -333,20 +333,20 @@ arches:
333333
name: psmisc
334334
evr: 23.4-3.el9
335335
sourcerpm: psmisc-23.4-3.el9.src.rpm
336-
- url: https://cdn.redhat.com/content/dist/rhel9/9.7/x86_64/baseos/os/Packages/p/python3-3.9.25-3.el9_7.x86_64.rpm
336+
- url: https://cdn.redhat.com/content/dist/rhel9/9.7/x86_64/baseos/os/Packages/p/python3-3.9.25-3.el9_7.1.x86_64.rpm
337337
repoid: rhel-9-for-x86_64-baseos-rpms
338-
size: 33157
339-
checksum: sha256:0e0cadfc2b4ce7eb629c82a2a8f3bebb89ecf828da36ba142ac92d485d2baca4
338+
size: 33297
339+
checksum: sha256:d21de06ad0b98cdc04021a37330071758a71fb712a808f82e4ae715727f5f639
340340
name: python3
341-
evr: 3.9.25-3.el9_7
342-
sourcerpm: python3.9-3.9.25-3.el9_7.src.rpm
343-
- url: https://cdn.redhat.com/content/dist/rhel9/9.7/x86_64/baseos/os/Packages/p/python3-libs-3.9.25-3.el9_7.x86_64.rpm
341+
evr: 3.9.25-3.el9_7.1
342+
sourcerpm: python3.9-3.9.25-3.el9_7.1.src.rpm
343+
- url: https://cdn.redhat.com/content/dist/rhel9/9.7/x86_64/baseos/os/Packages/p/python3-libs-3.9.25-3.el9_7.1.x86_64.rpm
344344
repoid: rhel-9-for-x86_64-baseos-rpms
345-
size: 8476238
346-
checksum: sha256:5140197b69d6cf14dcbc65d4d5733fa1d3d248fa4f7e03e0b0f37faebf45e341
345+
size: 8484329
346+
checksum: sha256:c371182b9b33f245737e82ffef539f9fbd9adc0a0f1c7fab0fda24459e4e4695
347347
name: python3-libs
348-
evr: 3.9.25-3.el9_7
349-
sourcerpm: python3.9-3.9.25-3.el9_7.src.rpm
348+
evr: 3.9.25-3.el9_7.1
349+
sourcerpm: python3.9-3.9.25-3.el9_7.1.src.rpm
350350
- url: https://cdn.redhat.com/content/dist/rhel9/9.7/x86_64/baseos/os/Packages/p/python3-pip-wheel-21.3.1-1.el9.noarch.rpm
351351
repoid: rhel-9-for-x86_64-baseos-rpms
352352
size: 1193706

tools/buildingsctp/src/Dockerfile.sctp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM registry.access.redhat.com/ubi8/ubi AS builder
1+
FROM registry.access.redhat.com/ubi8/ubi:latest AS builder
22
USER root
33
# Copy entitlements
44
COPY ./etc-pki-entitlement /etc/pki/entitlement
@@ -17,7 +17,7 @@ USER 1001
1717
COPY samplebuild/src/* /src/
1818
RUN gcc /src/sctp.c -o /src/sctpclient -lsctp
1919

20-
FROM registry.access.redhat.com/ubi8/ubi
20+
FROM registry.access.redhat.com/ubi8/ubi:latest
2121
COPY --from=builder /src/sctpclient /usr/local/bin/sctpclient
2222
CMD ["/usr/bin/sctptest"]
2323

ztp/resource-generator/.konflux/Makefile

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,9 @@ PROJECT_DIR := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
2525
# Trim any trailing slash from the directory path as we will add if when necessary later
2626
ROOT_PROJECT_DIR := $(shell dirname $(shell dirname $(shell dirname $(abspath $(PROJECT_DIR)))))
2727

28-
# RHEL8_RELEASE defines the RHEL8 release version to update the rpm lock file for the runtime
29-
# This is automatically extracted from the Containerfile
30-
RHEL8_RELEASE ?= $(shell awk '/^FROM registry.access.redhat.com\/ubi8-minimal:/ {split($$2, parts, /[:|@]/); print parts[2]}' $(PROJECT_DIR)/Containerfile)
31-
32-
# Use make's built-in substitution function to replace the dot with a dash
33-
RHEL8_RELEASE_DASHED := $(subst .,-,$(RHEL8_RELEASE))
34-
3528
# RHEL9_RELEASE defines the RHEL9 release version to update the rpm lock file for the runtime
36-
RHEL9_RELEASE ?= 9.4
37-
RHEL9_RELEASE_DASHED := $(subst .,-,$(RHEL9_RELEASE))
29+
RHEL9_RELEASE ?= latest
30+
RHEL8_RELEASE ?= latest
3831

3932
# We don't need activation keys because we only use ubi packages
4033
RHEL9_ACTIVATION_KEY ?= ""
@@ -48,6 +41,14 @@ RHEL8_ORG_ID ?= ""
4841
# This can be set from the command line if the default is not correct for your environment.
4942
REGISTRY_AUTH_FILE ?= $(shell echo $${XDG_RUNTIME_DIR:-/run/user/$$(id -u)})/containers/auth.json
5043

44+
# BSD sed (macOS) requires a backup suffix after -i (use '' for none); GNU sed (Linux) uses plain -i.
45+
UNAME_S := $(shell uname -s)
46+
ifeq ($(UNAME_S),Darwin)
47+
SED_INPLACE := sed -i ''
48+
else
49+
SED_INPLACE := sed -i
50+
endif
51+
5152
help: ## Display this help.
5253
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
5354

@@ -79,11 +80,11 @@ konflux-update-rpm-lock-runtime: sync-telco5g-konflux-submodule ## Update the rp
7980
cp $(PROJECT_DIR)/../Containerfile $(PROJECT_DIR)/lock-runtime/Containerfile
8081
@echo "Copying rpms.in.yaml to lock-runtime directory..."
8182
cp $(PROJECT_DIR)/rpms.in.yaml $(PROJECT_DIR)/lock-runtime/rpms.in.yaml
82-
sed -i 's|../Containerfile|Containerfile|g' $(PROJECT_DIR)/lock-runtime/rpms.in.yaml
83+
$(SED_INPLACE) 's|../Containerfile|Containerfile|g' $(PROJECT_DIR)/lock-runtime/rpms.in.yaml
8384
@echo "Updating rpm lock file for the runtime..."
8485
$(MAKE) -C $(ROOT_PROJECT_DIR)/telco5g-konflux/scripts/rpm-lock generate-rhel8-locks \
8586
LOCK_SCRIPT_TARGET_DIR=$(PROJECT_DIR)/lock-runtime \
86-
RHEL8_IMAGE_TO_LOCK=$$(awk '/^FROM registry.access.redhat.com\/ubi8-minimal:/ {print $$2}' $(PROJECT_DIR)/Containerfile) \
87+
RHEL8_IMAGE_TO_LOCK=registry.access.redhat.com/ubi8-minimal:$(RHEL8_RELEASE) \
8788
REGISTRY_AUTH_FILE=$(REGISTRY_AUTH_FILE) \
8889
\
8990
RHEL9_RELEASE=$(RHEL9_RELEASE) \

ztp/resource-generator/.konflux/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ To manually regenerate the rpm lock configuration, use the following Makefile ta
6161
- Update the `.konflux/rpms.lock.yaml` file
6262

6363
**Configuration Options:**
64-
- `RHEL8_RELEASE`: RHEL8 release version (automatically extracted from Containerfile)
65-
- `RHEL9_RELEASE`: RHEL9 release version (default: 9.4)
64+
- `RHEL8_RELEASE`: RHEL8 release version (default: latest)
65+
- `RHEL9_RELEASE`: RHEL9 release version (default: latest)
6666
- `RHEL8_ACTIVATION_KEY`: Red Hat activation key for RHEL8 (not needed for UBI packages)
6767
- `RHEL8_ORG_ID`: Red Hat organization ID for RHEL8 (not needed for UBI packages)
6868
- `RHEL9_ACTIVATION_KEY`: Red Hat activation key for RHEL9 (not needed for UBI packages)

ztp/resource-generator/Containerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ WORKDIR $SITECONFIG_GENERATOR_ROOT
3434
RUN make build
3535

3636
# Container image
37-
FROM registry.access.redhat.com/ubi8-minimal:8.10-1772599255@sha256:b880e16b888f47bc3fae64e67cd9776b24372f2e7ec2051f5a9386de6f5a75ac
37+
FROM registry.access.redhat.com/ubi8-minimal:latest
3838
#
3939

4040
USER root

0 commit comments

Comments
 (0)