mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-25 10:06:34 +00:00
Add backup and restore to CI (#3509)
* Add backup and restore to CI * Update .github/workflows/builder.yml * -r * restore ssl * restart between * Make sure it actually installed * access .data
This commit is contained in:
parent
3fd3c02010
commit
d2dc78ae6a
58
.github/workflows/builder.yml
vendored
58
.github/workflows/builder.yml
vendored
@ -278,6 +278,12 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Make sure it actually installed
|
||||||
|
test=$(docker exec hassio_cli ha addons info core_ssh --no-progress --raw-json | jq -r '.data.version')
|
||||||
|
if [[ "$test" == "null" ]]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Start Core SSH Add-on"
|
echo "Start Core SSH Add-on"
|
||||||
test=$(docker exec hassio_cli ha addons start core_ssh --no-progress --raw-json | jq -r '.result')
|
test=$(docker exec hassio_cli ha addons start core_ssh --no-progress --raw-json | jq -r '.result')
|
||||||
if [ "$test" != "ok" ]; then
|
if [ "$test" != "ok" ]; then
|
||||||
@ -312,6 +318,58 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
- name: Create full backup
|
||||||
|
id: backup
|
||||||
|
run: |
|
||||||
|
test=$(docker exec hassio_cli ha backups new --no-progress --raw-json)
|
||||||
|
if [ "$(echo $test | jq -r '.result')" != "ok" ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "::set-output name=slug::$(echo $test | jq -r '.data.slug')"
|
||||||
|
|
||||||
|
- name: Uninstall SSH add-on
|
||||||
|
run: |
|
||||||
|
test=$(docker exec hassio_cli ha addons uninstall core_ssh --no-progress --raw-json | jq -r '.result')
|
||||||
|
if [ "$test" != "ok" ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Restart supervisor
|
||||||
|
run: |
|
||||||
|
test=$(docker exec hassio_cli ha supervisor restart --no-progress --raw-json | jq -r '.result')
|
||||||
|
if [ "$test" != "ok" ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Wait for Supervisor to come up
|
||||||
|
run: |
|
||||||
|
SUPERVISOR=$(docker inspect --format='{{.NetworkSettings.IPAddress}}' hassio_supervisor)
|
||||||
|
ping="error"
|
||||||
|
while [ "$ping" != "ok" ]; do
|
||||||
|
ping=$(curl -sSL "http://$SUPERVISOR/supervisor/ping" | jq -r '.result')
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Restore SSH add-on from backup
|
||||||
|
run: |
|
||||||
|
test=$(docker exec hassio_cli ha backups restore ${{ steps.backup.outputs.slug }} --addons core_ssh --no-progress --raw-json | jq -r '.result')
|
||||||
|
if [ "$test" != "ok" ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make sure it actually installed
|
||||||
|
test=$(docker exec hassio_cli ha addons info core_ssh --no-progress --raw-json | jq -r '.data.version')
|
||||||
|
if [[ "$test" == "null" ]]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Restore SSL directory from backup
|
||||||
|
run: |
|
||||||
|
test=$(docker exec hassio_cli ha backups restore ${{ steps.backup.outputs.slug }} --folders ssl --no-progress --raw-json | jq -r '.result')
|
||||||
|
if [ "$test" != "ok" ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Get supervisor logs on failiure
|
- name: Get supervisor logs on failiure
|
||||||
if: ${{ cancelled() || failure() }}
|
if: ${{ cancelled() || failure() }}
|
||||||
run: docker logs hassio_supervisor
|
run: docker logs hassio_supervisor
|
||||||
|
Loading…
x
Reference in New Issue
Block a user