File tree Expand file tree Collapse file tree 9 files changed +78
-63
lines changed
Expand file tree Collapse file tree 9 files changed +78
-63
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ CONTAINER_TOOL_EXTRA_ARGS ?=
1616EXTRA_RPM_PACKAGES ?=
1717GRAPH_ROOT=$(shell podman info --format '{{ .Store.GraphRoot }}')
1818UMASK=$(shell umask)
19+ IMAGE_VERSION := $(or ${IMAGE_VERSION},$(shell git rev-parse --short HEAD))
1920
2021AUTH_JSON ?=
2122
@@ -50,7 +51,7 @@ ENABLE_RT ?=
5051SSH_PUBKEY ?= $(shell cat ${HOME}/.ssh/id_rsa.pub 2> /dev/null)
5152
5253.PHONY: prepare-files
53- prepare-files: $(OUTDIR)/$(WRAPPER) $(OUTDIR)/$(QLORA_WRAPPER) $(OUTDIR)/$(TRAIN_WRAPPER) $(OUTDIR)
54+ prepare-files: $(OUTDIR)/$(WRAPPER) $(OUTDIR)/$(QLORA_WRAPPER) $(OUTDIR)/$(TRAIN_WRAPPER) $(OUTDIR) common-services
5455
5556$(OUTDIR):
5657 mkdir -p $(OUTDIR)
@@ -61,6 +62,11 @@ $(OUTDIR)/$(QLORA_WRAPPER): $(OUTDIR)
6162$(OUTDIR)/$(TRAIN_WRAPPER): $(OUTDIR)
6263 cp -pf $(TRAIN_WRAPPER) $(OUTDIR)
6364
65+ .PHONY: common-services
66+ common-services:
67+ mkdir -p build; cp -pR ../common/usr build
68+
69+
6470.PHONY: check-sshkey
6571check-sshkey:
6672 @test -n "$(SSH_PUBKEY)" || \
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ [Unit]
2+ Description =Check for available bootc updates
3+ ConditionPathExists =/run/ostree-booted
4+ After =network-online.target
5+ StartLimitIntervalSec =400
6+ StartLimitBurst =3
7+
8+ [Service]
9+ Type =oneshot
10+ ExecStart =/usr/libexec/upgrade-informer
11+ Restart =on-failure
12+ RestartSec =90
Original file line number Diff line number Diff line change 1+ [Unit]
2+ Description=Runs upgrade informer periodically
3+ ConditionPathExists=/run/ostree-booted
4+
5+ [Timer]
6+ OnBootSec=1h
7+ # This time is relatively arbitrary and obviously expected to be overridden/changed
8+ OnUnitInactiveSec=8h
9+ # When deploying a large number of systems, it may be beneficial to increase this value to help with load on the registry.
10+ RandomizedDelaySec=2h
11+
12+ [Install]
13+ WantedBy=timers.target
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Run the command and capture its output
4+ output=$( bootc upgrade --check | sed -e 1q)
5+ message_file=" /etc/motd.d/upgrade-message"
6+ bootc_auth=" /etc/ostree/auth.json"
7+
8+ if [[ $output == Update\ available* ]]; then
9+ if [[ ! -f $message_file ]]; then
10+ echo " New version was found"
11+ bootc_image=$( echo " $output " | awk ' {print $4}' )
12+ # If auth file exists we should use it
13+ auth_params=" "
14+ if [[ -f $bootc_auth ]]; then
15+ auth_params=" --authfile $bootc_auth "
16+ fi
17+
18+ # Get image version
19+ # shellcheck disable=SC2086
20+ image_version=$( skopeo inspect --format json $auth_params " $bootc_image " | jq ' .Labels | .["image_version"] // empty' | tr -d ' "' )
21+
22+ # If upgrade available, write the output to the file
23+ echo -e " \n\n ** Attention! ** \n** A new $image_version version is available **\n\
24+ ** In order to apply it run: bootc upgrade --apply \n\
25+ ** Please note that the system will reboot after the upgrade ** \n\n" > $message_file
26+ fi
27+ else
28+ echo " No upgrade was found"
29+ rm $message_file 2> /dev/null
30+ fi
31+
32+ echo " Finished running upgrade informer"
Original file line number Diff line number Diff line change @@ -98,6 +98,10 @@ COPY --from=builder /home/builder/yum-packaging-precompiled-kmod/RPMS/*/*.rpm /r
9898COPY --from=builder --chmod=444 /home/builder/yum-packaging-precompiled-kmod/tmp/firmware/*.bin /lib/firmware/nvidia/${DRIVER_VERSION}/
9999# Temporary workaround until the permanent fix for libdnf is merged
100100COPY nvidia-toolkit-firstboot.service /usr/lib/systemd/system/nvidia-toolkit-firstboot.service
101+ # Enable common services
102+ COPY build/usr /usr
103+
104+ ARG IMAGE_VERSION
101105
102106# TODO: rework this monstrosity into a build.sh (or even not shell script)
103107# The need for the `cp /etc/dnf/dnf.conf` is a workaround for https://github.com/containers/bootc/issues/637
@@ -146,6 +150,14 @@ RUN mv /etc/selinux /etc/selinux.tmp \
146150 && ln -s ../cloud-init.target /usr/lib/systemd/system/default.target.wants \
147151 && mv /etc/selinux.tmp /etc/selinux \
148152 && ln -s /usr/lib/systemd/system/nvidia-toolkit-firstboot.service /usr/lib/systemd/system/basic.target.wants/nvidia-toolkit-firstboot.service \
153+ # enable upgrade informer timer
154+ && ln -s /usr/lib/systemd/system/upgrade-informer.timer /usr/lib/systemd/system/timers.target.wants/upgrade-informer.timer \
155+ # enable upgrade informer service, added as we need it to start on boot
156+ && ln -s /usr/lib/systemd/system/upgrade-informer.service /usr/lib/systemd/system/basic.target.wants/upgrade-informer.service \
157+ # remove auto upgrade service
158+ && rm -f /usr/lib/systemd/system/default.target.wants/bootc-fetch-apply-updates.timer \
159+ # save version into file
160+ && echo ${IMAGE_VERSION} > /usr/lib/ai-release \
149161 && echo "blacklist nouveau" > /etc/modprobe.d/blacklist_nouveau.conf
150162
151163ARG SSHPUBKEY
Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ bootc: driver-toolkit check-sshkey prepare-files
1616 $(DRIVER_TOOLKIT_IMAGE:%=--build-arg DRIVER_TOOLKIT_IMAGE=% ) \
1717 $(DRIVER_VERSION:%=--build-arg DRIVER_VERSION=% ) \
1818 $(DRIVER_VERSION:%=--label driver-version=% ) \
19+ $(IMAGE_VERSION:%=--label image_version=% ) \
20+ $(IMAGE_VERSION:%=--build-arg IMAGE_VERSION=% ) \
1921 $(EXTRA_RPM_PACKAGES:%=--build-arg EXTRA_RPM_PACKAGES=% ) \
2022 $(FROM:%=--build-arg BASEIMAGE=% ) \
2123 $(INSTRUCTLAB_IMAGE:%=--build-arg INSTRUCTLAB_IMAGE=% ) \
You can’t perform that action at this time.
0 commit comments