-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RHELAI-429: Adding upgrade informer service
Upgrade informer will run every couple of our and will be triggered by systemd timer. In order to start it on boot and run once i enabled it and timer. Disabling auto upgrade service in order to remove unexpected reboots. Service will run "bootc upgrade --check" and in case new version exists it will create motd file with upgrade info. Removed unused grow-part services
- Loading branch information
Showing
9 changed files
with
78 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
training/common/usr/lib/systemd/system/bootc-generic-growpart.service
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
training/common/usr/lib/systemd/system/local-fs.target.wants/bootc-generic-growpart.service
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
training/common/usr/lib/systemd/system/upgrade-informer.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Unit] | ||
Description=Check for available bootc updates | ||
ConditionPathExists=/run/ostree-booted | ||
After=network-online.target | ||
StartLimitIntervalSec=400 | ||
StartLimitBurst=3 | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/usr/libexec/upgrade-informer | ||
Restart=on-failure | ||
RestartSec=90 |
13 changes: 13 additions & 0 deletions
13
training/common/usr/lib/systemd/system/upgrade-informer.timer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[Unit] | ||
Description=Runs upgrade informer periodically | ||
ConditionPathExists=/run/ostree-booted | ||
|
||
[Timer] | ||
OnBootSec=1h | ||
# This time is relatively arbitrary and obviously expected to be overridden/changed | ||
OnUnitInactiveSec=8h | ||
# When deploying a large number of systems, it may be beneficial to increase this value to help with load on the registry. | ||
RandomizedDelaySec=2h | ||
|
||
[Install] | ||
WantedBy=timers.target |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
# Run the command and capture its output | ||
output=$(bootc upgrade --check | sed -e 1q) | ||
message_file="/etc/motd.d/upgrade-message" | ||
bootc_auth="/etc/ostree/auth.json" | ||
|
||
if [[ $output == Update\ available* ]]; then | ||
if [[ ! -f $message_file ]]; then | ||
echo "New version was found" | ||
bootc_image=$(echo "$output" | awk '{print $4}') | ||
# If auth file exists we should use it | ||
auth_params="" | ||
if [[ -f $bootc_auth ]]; then | ||
auth_params="--authfile $bootc_auth" | ||
fi | ||
|
||
# Get image version | ||
# shellcheck disable=SC2086 | ||
image_version=$(skopeo inspect --format json $auth_params "$bootc_image" | jq '.Labels | .["image_version"] // empty' | tr -d '"') | ||
|
||
# If upgrade available, write the output to the file | ||
echo -e "\n\n ** Attention! ** \n** A new $image_version version is available **\n\ | ||
** In order to apply it run: bootc upgrade --apply \n\ | ||
** Please note that the system will reboot after the upgrade ** \n\n" > $message_file | ||
fi | ||
else | ||
echo "No upgrade was found" | ||
rm $message_file 2> /dev/null | ||
fi | ||
|
||
echo "Finished running upgrade informer" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters