# Pipeline for saiblog # inspired by https://git.shivering-isles.com/shivering-isles/blog/-/blob/deploy/.gitlab-ci.yml image: quay.io/sheogorath/build-ah-engine:latest variables: GIT_SUBMODULE_STRATEGY: recursive stages: - build - package - test - deploy build: image: docker.io/library/node:20.5 stage: build before_script: - npm install -g pnpm - pnpm config set store-dir .pnpm-store script: - pnpm install # install dependencies - pnpm run build cache: key: files: - pnpm-lock.yaml paths: - .pnpm-store package: stage: package image: quay.io/sheogorath/build-ah-engine:latest tags: - privileged variables: LANG: C.UTF-8 before_script: - podman login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY script: - podman build --pull -f .docker/Dockerfile -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" . - podman push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" except: - deploy package-deploy: stage: package image: quay.io/sheogorath/build-ah-engine:latest variables: LANG: C.UTF-8 tags: - privileged before_script: - podman login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY script: - podman build --pull -f .docker/Dockerfile -t "$CI_REGISTRY_IMAGE" . - podman push "$CI_REGISTRY_IMAGE" only: - deploy test: stage: test tags: - privileged image: quay.io/sheogorath/build-ah-engine:latest variables: LANG: C.UTF-8 before_script: - dnf install curl script: - podman run -d -p 8080:80 --name testing $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG - sleep 5 - podman exec testing nginx -c /etc/nginx/nginx.conf -t - curl http://localhost:8080/status.txt | grep -q 'OK' - podman stop testing - podman rm testing except: - deploy test-deploy: stage: test tags: - privileged image: quay.io/sheogorath/build-ah-engine:latest variables: LANG: C.UTF-8 before_script: - dnf install curl script: - podman run -d -p 8080:80 --name testing $CI_REGISTRY_IMAGE:latest - sleep 5 - podman exec testing nginx -c /etc/nginx/nginx.conf -t - curl http://localhost:8080/status.txt | grep -q 'OK' - podman stop testing - podman rm testing only: - deploy deploy: stage: deploy variables: PLAYBOOK: static_websites.yml trigger: project: saibotk.de/infrastructure-private strategy: depend only: - deploy