test
Some checks failed
CI/CD Pipeline with Direct Podman Access / test-backend (push) Failing after 21s

This commit is contained in:
continuist 2025-09-13 14:31:27 -04:00
parent f1f061bf1b
commit ce648cb65f

View file

@ -11,7 +11,9 @@ env:
APP_NAME: ${{ secrets.APP_NAME }}
IMAGE_TAG: ${{ github.sha }}
RUN_ID: ${{ github.run_id }}
# Your other env vars...
RUST_IMG_DIGEST: ${{ secrets.RUST_IMG_DIGEST }}
NODE_IMG_DIGEST: ${{ secrets.NODE_IMG_DIGEST }}
POSTGRES_IMG_DIGEST: ${{ secrets.POSTGRES_IMG_DIGEST }}
jobs:
test-backend:
@ -20,34 +22,29 @@ jobs:
image: git.gcdo.org/devteam/sharenet/ci-node-podman@sha256:eb0d942bd9a8cc69c63eb9ccf3877703898d676d0268cf379defdcda7e55f37f
steps:
- uses: actions/checkout@v4
- name: Debug environment
run: |
echo "Current user: $(id)"
echo "DOCKER_HOST: $DOCKER_HOST"
ls -la /run/ || echo "No /run directory"
which podman || echo "Podman not found"
podman --version || echo "Podman command failed"
- name: Test Podman access
- name: Verify podman socket
run: |
# Test using the Docker CLI with the socket
podman info || echo "podman info failed"
podman ps || echo "podman ps failed"
echo "DOCKER_HOST=$DOCKER_HOST"
test -S /tmp/podman.sock || { echo "missing /tmp/podman.sock"; exit 1; }
mkdir -p "${XDG_CONFIG_HOME:-/tmp/.config}/containers"
# Prefer explicit remote; fallback to podman-remote if that's what's installed
(podman --remote info || podman-remote info) | sed -n '1,80p'
- name: Verify pinned digests
run: |
set -euo pipefail
for v in RUST_IMG_DIGEST NODE_IMG_DIGEST POSTGRES_IMG_DIGEST; do
[ -n "${!v}" ] || { echo "Missing $v"; exit 1; }
echo "${!v}" | grep -Eq '^.+@sha256:[0-9a-f]{64}$' || { echo "$v must be a digest ref"; exit 1; }
done
- name: Create internal network
run: docker network create --internal integ-${{ env.RUN_ID }}
run: podman --remote network create --internal integ-${{ env.RUN_ID }}
- name: Start PostgreSQL
run: |
docker run -d \
podman --remote run -d \
--name test-postgres-${{ env.RUN_ID }} \
--network integ-${{ env.RUN_ID }} \
-e POSTGRES_PASSWORD=password \
@ -57,24 +54,25 @@ jobs:
- name: Wait for PostgreSQL
run: |
timeout 60 bash -c '
until docker exec test-postgres-${{ env.RUN_ID }} pg_isready -h 127.0.0.1 -p 5432 -U postgres; do
timeout 60 bash -euc '
until podman --remote exec test-postgres-${{ env.RUN_ID }} \
pg_isready -h 127.0.0.1 -p 5432 -U postgres; do
sleep 1
done
'
- name: Run backend tests
run: |
docker run --rm \
podman --remote run --rm \
-v "$PWD":/workspace \
-w /workspace \
--network integ-${{ env.RUN_ID }} \
-e DATABASE_URL=postgres://postgres:password@test-postgres-${{ env.RUN_ID }}:5432/sharenet_test \
"$RUST_IMG_DIGEST" \
sh -c "cargo test --lib -- --test-threads=1"
sh -lc 'cargo test --lib -- --test-threads=1'
- name: Cleanup
if: always()
run: |
docker rm -f test-postgres-${{ env.RUN_ID }} 2>/dev/null || true
docker network rm integ-${{ env.RUN_ID }} 2>/dev/null || true
podman --remote rm -f test-postgres-${{ env.RUN_ID }} 2>/dev/null || true
podman --remote network rm integ-${{ env.RUN_ID }} 2>/dev/null || true