-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Wait for snap changes * Wait for docker daemon after reboot * Run docker commands with sudo * Docker run in non-interactive mode
- Loading branch information
Showing
5 changed files
with
46 additions
and
19 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
32 changes: 32 additions & 0 deletions
32
.github/workflows/testflinger/scripts/check-snap-changes.sh
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 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This script is adapted from | ||
# https://github.com/canonical/hwcert-jenkins-tools/blob/c5cf512d968100db90998abe61c474de0be681ca/scriptlets/check_for_snap_changes | ||
|
||
echo "Get snap changes" | ||
|
||
# list the snap changes on the device and store the output in a temp file | ||
OUTPUT=$(mktemp) | ||
snap changes > $OUTPUT | ||
|
||
RESULT=$? | ||
if [ ! "$RESULT" -eq 0 ]; then exit $RESULT; fi | ||
|
||
# tail -n +2: remove the header | ||
# awk 'NF {print $2}': print the second column on non-empty lines (i.e. the status) | ||
# grep -q -E "...": succeed when changes are still ongoing or pending | ||
cat $OUTPUT | \ | ||
tail -n +2 | \ | ||
awk 'NF {print $2}' | \ | ||
grep -q -E "\b(Doing|Undoing|Wait|Do|Undo)\b" | ||
|
||
if [ "$?" -eq 0 ]; then | ||
# changes are still ongoing or pending: display output as a diagnostic | ||
cat "$OUTPUT" | grep -E "\b(Doing|Undoing|Wait|Do|Undo)\b" | ||
rm "$OUTPUT" | ||
|
||
exit 1 | ||
fi | ||
|
||
echo "No ongoing or pending snap changes" | ||
rm "$OUTPUT" |
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
This file was deleted.
Oops, something went wrong.