ci(deploy): retry compose up once to survive container-recreate races
All checks were successful
Deploy XIP / deploy (push) Successful in 24s
All checks were successful
Deploy XIP / deploy (push) Successful in 24s
A raced or interrupted previous deploy (e.g. a manual compose up overlapping the automated one) could leave a half-removed container behind, so the next recreate failed with 'removal of container ... is already in progress' (seen on the b25eb44 run, idx15). Prune stopped containers and retry once.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,20 @@ git fetch --all --prune
|
|||||||
git reset --hard origin/main
|
git reset --hard origin/main
|
||||||
|
|
||||||
echo "==> Building + starting the stack…"
|
echo "==> Building + starting the stack…"
|
||||||
docker compose -f "$COMPOSE_FILE" --env-file "$ENV_FILE" up -d --build --remove-orphans
|
deploy_up() {
|
||||||
|
docker compose -f "$COMPOSE_FILE" --env-file "$ENV_FILE" up -d --build --remove-orphans
|
||||||
|
}
|
||||||
|
|
||||||
|
# A raced or interrupted previous deploy (e.g. a manual `compose up` overlapping
|
||||||
|
# the automated one) can leave a half-removed / renamed container behind, making
|
||||||
|
# the next recreate fail with "removal of container ... is already in progress".
|
||||||
|
# If the first attempt fails, prune stopped containers and retry once.
|
||||||
|
if ! deploy_up; then
|
||||||
|
echo "!! 'compose up' failed — pruning stopped containers, retrying once in 8s…"
|
||||||
|
docker container prune -f >/dev/null 2>&1 || true
|
||||||
|
sleep 8
|
||||||
|
deploy_up
|
||||||
|
fi
|
||||||
|
|
||||||
echo "==> Pruning dangling images…"
|
echo "==> Pruning dangling images…"
|
||||||
docker image prune -f >/dev/null 2>&1 || true
|
docker image prune -f >/dev/null 2>&1 || true
|
||||||
|
|||||||
Reference in New Issue
Block a user