Skip to content

Commit

Permalink
Changing os-release file parameter from BUILD_ID to RHEL_AI_VERSION_I…
Browse files Browse the repository at this point in the history
…D as

it matches much better.
Changing the way we set image_version_id label, in order for it to work in
konflux we should use LABEL in container file

Signed-off-by: Igal Tsoiref <itsoiref@redhat.com>
  • Loading branch information
tsorya committed Jul 17, 2024
1 parent 28ee9a8 commit 9d175ab
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion training/common/Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ CONTAINER_TOOL_EXTRA_ARGS ?=
EXTRA_RPM_PACKAGES ?=
GRAPH_ROOT=$(shell podman info --format '{{ .Store.GraphRoot }}')
UMASK=$(shell umask)
IMAGE_VERSION := $(or ${IMAGE_VERSION},$(shell git rev-parse --short HEAD))
IMAGE_VERSION_ID := $(or ${IMAGE_VERSION_ID},$(shell git rev-parse --short HEAD))

AUTH_JSON ?=

Expand Down
6 changes: 4 additions & 2 deletions training/nvidia-bootc/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ COPY --from=builder --chmod=444 /home/builder/yum-packaging-precompiled-kmod/tmp
# Temporary workaround until the permanent fix for libdnf is merged
COPY nvidia-toolkit-firstboot.service /usr/lib/systemd/system/nvidia-toolkit-firstboot.service

ARG IMAGE_VERSION
ARG IMAGE_VERSION_ID

# TODO: rework this monstrosity into a build.sh (or even not shell script)
# The need for the `cp /etc/dnf/dnf.conf` is a workaround for https://github.com/containers/bootc/issues/637
Expand Down Expand Up @@ -153,7 +153,7 @@ RUN mv /etc/selinux /etc/selinux.tmp \
dnf install -y rhc rhc-worker-playbook; \
sed -i -e "/^VARIANT=/ {s/^VARIANT=.*/VARIANT=\"RHEL AI\"/; t}" -e "\$aVARIANT=\"RHEL AI\"" /usr/lib/os-release; \
sed -i -e "/^VARIANT_ID=/ {s/^VARIANT_ID=.*/VARIANT_ID=rhel_ai/; t}" -e "\$aVARIANT_ID=rhel_ai" /usr/lib/os-release; \
sed -i -e "/^BUILD_ID=/ {s/^BUILD_ID=.*/BUILD_ID='${IMAGE_VERSION}'/; t}" -e "\$aBUILD_ID='${IMAGE_VERSION}'" /usr/lib/os-release; \
sed -i -e "/^RHEL_AI_VERSION_ID=/ {s/^RHEL_AI_VERSION_ID=.*/RHEL_AI_VERSION_ID='${IMAGE_VERSION_ID}'/; t}" -e "\$aRHEL_AI_VERSION_ID='${IMAGE_VERSION_ID}'" /usr/lib/os-release; \
fi \
&& dnf clean all \
&& ln -s ../cloud-init.target /usr/lib/systemd/system/default.target.wants \
Expand Down Expand Up @@ -212,3 +212,5 @@ RUN --mount=type=secret,id=instructlab-nvidia-pull/.dockerconfigjson \
IID=$(sudo podman --root /usr/lib/containers/storage pull ${INSTRUCTLAB_IMAGE}); \
fi
RUN podman system reset --force 2>/dev/null

LABEL image_version_id="${IMAGE_VERSION_ID}"
3 changes: 1 addition & 2 deletions training/nvidia-bootc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ bootc: driver-toolkit check-sshkey prepare-files
$(DRIVER_TOOLKIT_IMAGE:%=--build-arg DRIVER_TOOLKIT_IMAGE=%) \
$(DRIVER_VERSION:%=--build-arg DRIVER_VERSION=%) \
$(DRIVER_VERSION:%=--label driver-version=%) \
$(IMAGE_VERSION:%=--label image_version=%) \
$(IMAGE_VERSION:%=--build-arg IMAGE_VERSION=%) \
$(IMAGE_VERSION_ID:%=--build-arg IMAGE_VERSION_ID=%) \
$(EXTRA_RPM_PACKAGES:%=--build-arg EXTRA_RPM_PACKAGES=%) \
$(FROM:%=--build-arg BASEIMAGE=%) \
$(INSTRUCTLAB_IMAGE:%=--build-arg INSTRUCTLAB_IMAGE=%) \
Expand Down

0 comments on commit 9d175ab

Please sign in to comment.