Fixed CL failure
All checks were successful
Verify and publish container / build-and-push (push) Successful in 1m9s
All checks were successful
Verify and publish container / build-and-push (push) Successful in 1m9s
This commit is contained in:
parent
a95f7c1d18
commit
931e674814
1 changed files with 12 additions and 6 deletions
|
|
@ -49,16 +49,22 @@ jobs:
|
||||||
IMAGE_PATH=$(echo "git.elijahkuntz.com/${{ gitea.actor }}/${{ github.event.repository.name }}" | tr '[:upper:]' '[:lower:]')
|
IMAGE_PATH=$(echo "git.elijahkuntz.com/${{ gitea.actor }}/${{ github.event.repository.name }}" | tr '[:upper:]' '[:lower:]')
|
||||||
IMAGE_SHA="$IMAGE_PATH:${{ github.sha }}"
|
IMAGE_SHA="$IMAGE_PATH:${{ github.sha }}"
|
||||||
CI_SECRET=$(openssl rand -hex 32)
|
CI_SECRET=$(openssl rand -hex 32)
|
||||||
|
SMOKE_CONTAINER="study-smoke-$(openssl rand -hex 8)"
|
||||||
|
cleanup_smoke() {
|
||||||
|
docker rm -f "$SMOKE_CONTAINER" > /dev/null 2>&1 || true
|
||||||
|
}
|
||||||
|
trap cleanup_smoke EXIT
|
||||||
docker build -t "$IMAGE_SHA" .
|
docker build -t "$IMAGE_SHA" .
|
||||||
docker run -d --name study-smoke -p 3000:3726 -e SESSION_SECRET="$CI_SECRET" -e ALLOW_INITIAL_SETUP=true "$IMAGE_SHA"
|
docker run -d --name "$SMOKE_CONTAINER" -e SESSION_SECRET="$CI_SECRET" -e ALLOW_INITIAL_SETUP=true "$IMAGE_SHA"
|
||||||
for attempt in $(seq 1 30); do
|
for attempt in $(seq 1 30); do
|
||||||
if [ "$(docker inspect --format='{{.State.Health.Status}}' study-smoke)" = "healthy" ]; then break; fi
|
if [ "$(docker inspect --format='{{.State.Health.Status}}' "$SMOKE_CONTAINER")" = "healthy" ]; then break; fi
|
||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
test "$(docker inspect --format='{{.State.Health.Status}}' study-smoke)" = "healthy"
|
test "$(docker inspect --format='{{.State.Health.Status}}' "$SMOKE_CONTAINER")" = "healthy"
|
||||||
curl --fail http://127.0.0.1:3000/login > /dev/null
|
docker exec "$SMOKE_CONTAINER" node -e "fetch('http://127.0.0.1:3726/login').then(r => { if (!r.ok) process.exit(1) }).catch(() => process.exit(1))"
|
||||||
curl --fail http://127.0.0.1:3000/api/auth/setup-status | grep '"setupRequired":true'
|
docker exec "$SMOKE_CONTAINER" node -e "fetch('http://127.0.0.1:3726/api/auth/setup-status').then(async r => { const body = await r.json(); if (!r.ok || body.setupRequired !== true) process.exit(1) }).catch(() => process.exit(1))"
|
||||||
docker rm -f study-smoke
|
cleanup_smoke
|
||||||
|
trap - EXIT
|
||||||
docker tag "$IMAGE_SHA" "$IMAGE_PATH:latest"
|
docker tag "$IMAGE_SHA" "$IMAGE_PATH:latest"
|
||||||
docker push "$IMAGE_SHA"
|
docker push "$IMAGE_SHA"
|
||||||
docker push "$IMAGE_PATH:latest"
|
docker push "$IMAGE_PATH:latest"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue