Files
vnctalk-prosody/.gitlab-ci.yml
T
Stefan-Sanger 51504f8a6f fix: correct pytest paths for tester container
The tester container uses WORKDIR /tests, so 'tests/pytest.ini' resolves
to /tests/tests/pytest.ini which does not exist, causing FileNotFoundError
in CI. Use paths relative to /tests (pytest . -c pytest.ini) for all
in-container invocations: CI job, Makefile target, tester image CMD, and
docs. Host-run scripts are unchanged (they run from repo root).

Part-of: <http://gitlab.vnc.biz/uxf/vnctalk-prosody/-/merge_requests/3>
2026-07-15 17:59:12 +02:00

119 lines
3.5 KiB
YAML

image: docker:24.0
variables:
DOCKER_HOST: tcp://localhost:2375
DOCKER_TLS_CERTDIR: ''
DEV_CONTAINER_REGISTRY: eu.gcr.io/vnc-development/vnctalk-prosody:development
IMAGE_TAG: eu.gcr.io/vnc-development/vnctalk-prosody:development-$CI_COMMIT_SHORT_SHA
IMAGE_TAG_PROD: eu.gcr.io/vnc-dev-275609/vnctalk-prosody:production
IMAGE_TAG_STABLE: eu.gcr.io/vnc-stable/vnctalk-prosody:stable
services:
- name: docker:24.0-dind
alias: docker
stages:
- test
- docker
- scan
- notification
test:compose:
stage: test
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != "main"
before_script:
- until docker info; do sleep 1; done
script:
- docker compose version
- docker compose up -d --build postgres mocks prosody
# Wait for the prosody container to pass its healthcheck before running tests.
- |
for i in $(seq 1 60); do
cid=$(docker compose ps -q prosody)
health=$(docker inspect --format '{{.State.Health.Status}}' "$cid" 2>/dev/null || echo "")
echo "prosody health: ${health:-unknown}"
[ "$health" = "healthy" ] && break
if [ "$i" = "60" ]; then
echo "prosody did not become healthy — prosody logs:" >&2
docker compose logs --tail=50 prosody >&2 || true
exit 1
fi
sleep 1
done
# Run the slixmpp suite inside the compose network via the prebuilt tester
# image (deps + env vars already wired in docker-compose.yml). The ./tests
# volume mount surfaces report.xml on the runner for the junit artifact.
- docker compose --profile ci run --rm tester pytest . -v -c pytest.ini --junitxml=report.xml
after_script:
- docker compose down -v || true
artifacts:
when: always
reports:
junit: tests/report.xml
dev_deploy:
before_script:
- until docker info; do sleep 1; done
- base64 -d $SA_Development | docker login -u _json_key --password-stdin https://eu.gcr.io
stage: docker
artifacts:
public: false
expire_in: 12h
paths:
- scan
script:
- docker build -t $IMAGE_TAG .
- docker push $IMAGE_TAG
- docker image save $IMAGE_TAG -o scan/vnctalk-prosody.tgz
only:
- main
dev_trivy:
image: aquasec/trivy:latest
stage: scan
script:
- trivy image --input scan/vnctalk-prosody.tgz
only:
- main
prod_deploy:
before_script:
- until docker info; do sleep 1; done
- base64 -d $SA_Production | docker login -u _json_key --password-stdin https://eu.gcr.io
stage: docker
script:
- echo $CI_COMMIT_TAG
- COMMIT_VERSION=$(echo $CI_COMMIT_TAG | awk -F'prod-' '{print $2}')
- echo $COMMIT_VERSION
- DEV_TAG=$DEV_CONTAINER_REGISTRY-$COMMIT_VERSION
- echo $DEV_TAG
- docker pull $DEV_TAG
- PROD_IMAGE=$IMAGE_TAG_PROD-$COMMIT_VERSION
- docker tag $DEV_TAG $PROD_IMAGE
- docker push $PROD_IMAGE
rules:
- if: $CI_COMMIT_TAG =~ /^prod-.*/
stable_deploy:
before_script:
- until docker info; do sleep 1; done
- base64 -d $SA_Production | docker login -u _json_key --password-stdin https://eu.gcr.io
stage: docker
script:
- echo $CI_COMMIT_TAG
- COMMIT_VERSION=$(echo $CI_COMMIT_TAG | awk -F'stable-' '{print $2}')
- echo $COMMIT_VERSION
- DEV_TAG=$DEV_CONTAINER_REGISTRY-$COMMIT_VERSION
- echo $DEV_TAG
- docker pull $DEV_TAG
- STABLE_IMAGE=$IMAGE_TAG_STABLE-$COMMIT_VERSION
- docker tag $DEV_TAG $STABLE_IMAGE
- docker push $STABLE_IMAGE
rules:
- if: $CI_COMMIT_TAG =~ /^stable-.*/