test
Some checks failed
CI/CD Pipeline with Direct Podman Access / test-backend (push) Failing after 21s
Some checks failed
CI/CD Pipeline with Direct Podman Access / test-backend (push) Failing after 21s
This commit is contained in:
parent
f1f061bf1b
commit
ce648cb65f
1 changed files with 20 additions and 22 deletions
|
@ -11,7 +11,9 @@ env:
|
||||||
APP_NAME: ${{ secrets.APP_NAME }}
|
APP_NAME: ${{ secrets.APP_NAME }}
|
||||||
IMAGE_TAG: ${{ github.sha }}
|
IMAGE_TAG: ${{ github.sha }}
|
||||||
RUN_ID: ${{ github.run_id }}
|
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:
|
jobs:
|
||||||
test-backend:
|
test-backend:
|
||||||
|
@ -21,33 +23,28 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Debug environment
|
- name: Verify podman socket
|
||||||
run: |
|
run: |
|
||||||
echo "Current user: $(id)"
|
echo "DOCKER_HOST=$DOCKER_HOST"
|
||||||
echo "DOCKER_HOST: $DOCKER_HOST"
|
test -S /tmp/podman.sock || { echo "missing /tmp/podman.sock"; exit 1; }
|
||||||
ls -la /run/ || echo "No /run directory"
|
mkdir -p "${XDG_CONFIG_HOME:-/tmp/.config}/containers"
|
||||||
which podman || echo "Podman not found"
|
# Prefer explicit remote; fallback to podman-remote if that's what's installed
|
||||||
podman --version || echo "Podman command failed"
|
(podman --remote info || podman-remote info) | sed -n '1,80p'
|
||||||
|
|
||||||
- name: Test Podman access
|
|
||||||
run: |
|
|
||||||
# Test using the Docker CLI with the socket
|
|
||||||
podman info || echo "podman info failed"
|
|
||||||
podman ps || echo "podman ps failed"
|
|
||||||
|
|
||||||
- name: Verify pinned digests
|
- name: Verify pinned digests
|
||||||
run: |
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
for v in RUST_IMG_DIGEST NODE_IMG_DIGEST POSTGRES_IMG_DIGEST; do
|
for v in RUST_IMG_DIGEST NODE_IMG_DIGEST POSTGRES_IMG_DIGEST; do
|
||||||
[ -n "${!v}" ] || { echo "Missing $v"; exit 1; }
|
[ -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; }
|
echo "${!v}" | grep -Eq '^.+@sha256:[0-9a-f]{64}$' || { echo "$v must be a digest ref"; exit 1; }
|
||||||
done
|
done
|
||||||
|
|
||||||
- name: Create internal network
|
- 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
|
- name: Start PostgreSQL
|
||||||
run: |
|
run: |
|
||||||
docker run -d \
|
podman --remote run -d \
|
||||||
--name test-postgres-${{ env.RUN_ID }} \
|
--name test-postgres-${{ env.RUN_ID }} \
|
||||||
--network integ-${{ env.RUN_ID }} \
|
--network integ-${{ env.RUN_ID }} \
|
||||||
-e POSTGRES_PASSWORD=password \
|
-e POSTGRES_PASSWORD=password \
|
||||||
|
@ -57,24 +54,25 @@ jobs:
|
||||||
|
|
||||||
- name: Wait for PostgreSQL
|
- name: Wait for PostgreSQL
|
||||||
run: |
|
run: |
|
||||||
timeout 60 bash -c '
|
timeout 60 bash -euc '
|
||||||
until docker exec test-postgres-${{ env.RUN_ID }} pg_isready -h 127.0.0.1 -p 5432 -U postgres; do
|
until podman --remote exec test-postgres-${{ env.RUN_ID }} \
|
||||||
|
pg_isready -h 127.0.0.1 -p 5432 -U postgres; do
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
'
|
'
|
||||||
|
|
||||||
- name: Run backend tests
|
- name: Run backend tests
|
||||||
run: |
|
run: |
|
||||||
docker run --rm \
|
podman --remote run --rm \
|
||||||
-v "$PWD":/workspace \
|
-v "$PWD":/workspace \
|
||||||
-w /workspace \
|
-w /workspace \
|
||||||
--network integ-${{ env.RUN_ID }} \
|
--network integ-${{ env.RUN_ID }} \
|
||||||
-e DATABASE_URL=postgres://postgres:password@test-postgres-${{ env.RUN_ID }}:5432/sharenet_test \
|
-e DATABASE_URL=postgres://postgres:password@test-postgres-${{ env.RUN_ID }}:5432/sharenet_test \
|
||||||
"$RUST_IMG_DIGEST" \
|
"$RUST_IMG_DIGEST" \
|
||||||
sh -c "cargo test --lib -- --test-threads=1"
|
sh -lc 'cargo test --lib -- --test-threads=1'
|
||||||
|
|
||||||
- name: Cleanup
|
- name: Cleanup
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
docker rm -f test-postgres-${{ env.RUN_ID }} 2>/dev/null || true
|
podman --remote rm -f test-postgres-${{ env.RUN_ID }} 2>/dev/null || true
|
||||||
docker network rm integ-${{ env.RUN_ID }} 2>/dev/null || true
|
podman --remote network rm integ-${{ env.RUN_ID }} 2>/dev/null || true
|
||||||
|
|
Loading…
Add table
Reference in a new issue