mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-07-09 16:00:59 +00:00
Prune demo volatile stores for release deploy
This commit is contained in:
parent
d8487b568a
commit
d2ab2b793d
2 changed files with 29 additions and 0 deletions
27
.github/workflows/update-demo-server.yml
vendored
27
.github/workflows/update-demo-server.yml
vendored
|
|
@ -379,10 +379,37 @@ jobs:
|
|||
fi
|
||||
done
|
||||
fi
|
||||
pruned_volatile=false
|
||||
if ((free_kb < required_kb)); then
|
||||
echo "Pruning demo volatile runtime stores to restore install headroom."
|
||||
if command -v systemctl >/dev/null 2>&1; then
|
||||
sudo systemctl stop "$SERVICE_NAME" || true
|
||||
fi
|
||||
for volatile_path in \
|
||||
"$CONFIG_DIR/metrics.db" \
|
||||
"$CONFIG_DIR/metrics.db-shm" \
|
||||
"$CONFIG_DIR/metrics.db-wal" \
|
||||
"$CONFIG_DIR/notification_queue.db" \
|
||||
"$CONFIG_DIR/notification_queue.db-shm" \
|
||||
"$CONFIG_DIR/notification_queue.db-wal"
|
||||
do
|
||||
if [[ -e "$volatile_path" ]]; then
|
||||
printf 'Removing demo volatile store: %s\n' "$volatile_path"
|
||||
sudo rm -f -- "$volatile_path"
|
||||
pruned_volatile=true
|
||||
fi
|
||||
done
|
||||
config_kb="$(sudo du -sk "$CONFIG_DIR" | awk 'NR == 1 {print $1}')"
|
||||
free_kb="$(df -Pk "$BACKUP_PARENT" | awk 'NR == 2 {print $4}')"
|
||||
required_kb=$((config_kb + BACKUP_MARGIN_KB))
|
||||
fi
|
||||
if ((free_kb < required_kb)); then
|
||||
echo "::error::Demo host does not have enough free space to back up $CONFIG_DIR before install."
|
||||
echo "Config: ${config_kb}KB, available: ${free_kb}KB, required: ${required_kb}KB"
|
||||
sudo find "$BACKUP_PARENT" -maxdepth 1 -type d -name "${BACKUP_BASENAME}.backup.*" -printf '%TY-%Tm-%Td %TH:%TM %p\n' 2>/dev/null | sort || true
|
||||
if [[ "$pruned_volatile" == "true" ]] && command -v systemctl >/dev/null 2>&1; then
|
||||
sudo systemctl start "$SERVICE_NAME" || true
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -760,6 +760,8 @@ func TestUpdateDemoWorkflowUsesGovernedNetworkPath(t *testing.T) {
|
|||
`Prepare demo host storage`,
|
||||
`KEEP_BACKUPS=2`,
|
||||
`Removing demo backup to restore install headroom: %s`,
|
||||
`Pruning demo volatile runtime stores to restore install headroom.`,
|
||||
`Removing demo volatile store: %s`,
|
||||
`Demo host does not have enough free space to back up $CONFIG_DIR before install.`,
|
||||
`Verify public browser smoke`,
|
||||
`./scripts/run_demo_public_browser_smoke.sh`,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue