-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from thin-edge/feat-auto-rollback
feat: add auto rollback service in case new image does not have a functioning agent
- Loading branch information
Showing
12 changed files
with
47 additions
and
20 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,2 @@ | ||
description = "Health check runner" | ||
priority = 80_000 |
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
9 changes: 0 additions & 9 deletions
9
recipes/rugpi-auto-rollback/files/rugpi-auto-rollback.service
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
recipes/tedge-firmware-update/files/firmware-auto-rollback
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,15 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
RUGPI_INFO=$(rugpi-ctrl system info ||:) | ||
HOT=$(echo "$RUGPI_INFO" | grep Hot | cut -d: -f2 | xargs) | ||
DEFAULT=$(echo "$RUGPI_INFO" | grep Default | cut -d: -f2 | xargs) | ||
|
||
if [ "$HOT" = "$DEFAULT" ]; then | ||
echo "Already on default partition. Nothing to rollback to. hot=$HOT, default=$DEFAULT" >&2 | ||
exit 0 | ||
fi | ||
|
||
echo "Rebooting into default partition. hot=$HOT, default=$DEFAULT" | ||
reboot | ||
exit 0 |
9 changes: 9 additions & 0 deletions
9
recipes/tedge-firmware-update/files/firmware-auto-rollback.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,9 @@ | ||
[Unit] | ||
Description=Rollback to default partition if this service has not been disabled yet | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/usr/bin/firmware-auto-rollback | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
8 changes: 8 additions & 0 deletions
8
recipes/tedge-firmware-update/files/firmware-auto-rollback.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,8 @@ | ||
[Unit] | ||
Description=rugpi auto rollback | ||
|
||
[Timer] | ||
OnBootSec=1800s | ||
|
||
[Install] | ||
WantedBy=timers.target |
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 |
---|---|---|
@@ -1,4 +1,7 @@ | ||
description = "Add workflow scripts to support firmware updates" | ||
default = false | ||
priority = 10_000 | ||
dependencies = ["thin-edge.io"] | ||
dependencies = ["thin-edge.io", "health-check"] | ||
|
||
[parameters] | ||
autorollback = { default = true } |
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