Update deploy.yml
Some checks failed
ci / Lint & typecheck (push) Successful in 29s
ci / Unit tests (push) Successful in 1m7s
deploy / build-and-deploy (push) Failing after 3s

This commit is contained in:
febux 2026-09-14 01:37:43 +03:00
parent ced2e1ae95
commit 1cfb8d0e42

View file

@ -1,11 +1,12 @@
# Deploy: build → push → nomad job run, on every push to master. # Deploy: build → push → nomad job run, on every push to master.
# #
# Runner requirements (verify on the Forgejo VPS): # Runner requirements (Forgejo VPS, via the docker-compose stack there):
# - job container gets the docker socket (runner config must allow # - DinD daemon also listens on unix:///var/run/docker.sock (so the job's
# valid_volumes for /var/run/docker.sock — see README §deploy notes), or # docker:28-cli container can reach it via -v /var/run/docker.sock);
# switch `runs-on` to the host label and drop the container/socket bits; # - runner config valid_volumes allows '**' (the job mounts that socket).
# - Docker Hub reachable (nomad CLI is extracted from hashicorp/nomad:1.9 — # nomad CLI is NOT extracted into the job container — the binary is
# releases.hashicorp.com is blocked from this network). # glibc-dynamically-linked and won't exec in Alpine; instead the Deploy step
# runs `nomad` inside the hashicorp/nomad:1.9 image (which has the loader).
# #
# Repo secrets (Settings → Secrets): # Repo secrets (Settings → Secrets):
# REGISTRY_TOKEN forgejo token, write:package scope (docker login) # REGISTRY_TOKEN forgejo token, write:package scope (docker login)
@ -40,13 +41,6 @@ jobs:
git fetch --depth 1 origin ${{ github.sha }} git fetch --depth 1 origin ${{ github.sha }}
git checkout -q FETCH_HEAD git checkout -q FETCH_HEAD
- name: Extract nomad CLI (official image; CDN is blocked here)
run: |
docker create --name nomad-extract hashicorp/nomad:1.9 >/dev/null
docker cp nomad-extract:/bin/nomad /usr/local/bin/nomad
docker rm nomad-extract >/dev/null
nomad version
- name: Registry login - name: Registry login
run: | run: |
echo "${{ secrets.REGISTRY_TOKEN }}" | \ echo "${{ secrets.REGISTRY_TOKEN }}" | \
@ -63,13 +57,20 @@ jobs:
done done
- name: Deploy to Nomad - name: Deploy to Nomad
# Run the nomad CLI inside its own image — the binary is
# glibc-dynamically-linked (PT_INTERP = ld-linux-x86-64.so.2), so it
# won't exec in the Alpine-based docker:28-cli container. The image
# has the loader; mount the workspace so the job file + CA cert are
# visible at the same paths.
run: | run: |
mkdir -p /tmp/nomad-tls mkdir -p .ci-tls
echo "${{ secrets.NOMAD_CACERT }}" > /tmp/nomad-tls/ca.crt printf '%s\n' "${{ secrets.NOMAD_CACERT }}" > .ci-tls/ca.crt
export IMAGE_TAG="${{ github.sha }}" docker run --rm \
export NOMAD_ADDR="https://${{ vars.NOMAD_ADDR_HOST }}:4646" -v "$PWD:$PWD" -w "$PWD" \
export NOMAD_CACERT=/tmp/nomad-tls/ca.crt -e IMAGE_TAG="${{ github.sha }}" \
export NOMAD_TOKEN="${{ secrets.NOMAD_TOKEN }}" -e NOMAD_ADDR="https://${{ vars.NOMAD_ADDR_HOST }}:4646" \
nomad job run deploy/nomad/contract-check.nomad.hcl -e NOMAD_CACERT="$PWD/.ci-tls/ca.crt" \
# the CLI follows the deployment and exits non-zero if health -e NOMAD_TOKEN="${{ secrets.NOMAD_TOKEN }}" \
# checks fail — auto_revert then rolls the job back server-side. --entrypoint /bin/nomad \
hashicorp/nomad:1.9 job run deploy/nomad/contract-check.nomad.hcl
rm -rf .ci-tls