workflows/deploy: Improve update verification check
This commit is contained in:
@@ -97,7 +97,7 @@ jobs:
|
||||
|
||||
- name: Replace placeholder serial
|
||||
run: |
|
||||
SERIAL_OLD="$(dig +short SOA pvv.ntnu.no | cut -d" " -f3)"
|
||||
SERIAL_OLD="$(dig +short "@${{ vars.SSH_HOST }}" SOA pvv.ntnu.no | cut -d" " -f3)"
|
||||
if [[ -z "$SERIAL_OLD" || ! "$SERIAL_OLD" =~ ^[0-9]+$ || $SERIAL_OLD -lt 1970010101 || $SERIAL_OLD -gt 3000000000 ]]; then
|
||||
echo "Error: SERIAL_OLD='$SERIAL_OLD' does not look reasonable"
|
||||
exit 1
|
||||
@@ -110,6 +110,7 @@ jobs:
|
||||
else
|
||||
SERIAL_NEW="${DATE}01"
|
||||
fi
|
||||
echo "$SERIAL_NEW" > /tmp/serial_new
|
||||
|
||||
SERIAL_PLACEHOLDER=1970010101
|
||||
|
||||
@@ -154,4 +155,12 @@ jobs:
|
||||
ssh targethost "doas /usr/sbin/nsd-control reload"
|
||||
|
||||
- name: Verifying operation
|
||||
run: dig "@${{ vars.SSH_HOST }}" SOA pvv.ntnu.no
|
||||
run: |
|
||||
SERIAL_ACTIVE="$(dig "@${{ vars.SSH_HOST }}" SOA pvv.ntnu.no | cut -d" " -f3)"
|
||||
if [[ "$(cat /tmp/serial_new)" == "$SERIAL_ACTIVE" ]]
|
||||
then
|
||||
echo "Update successful, server reports new active serial number '$SERIAL_ACTIVE'"
|
||||
else
|
||||
echo "Update failed, server reports serial '$SERIAL_ACTIVE' instead of new serial '$(cat /tmp/serial_new)'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user