From c14350f1353a9f67aee1e013aff3b834c92e3e98 Mon Sep 17 00:00:00 2001 From: Adrian Cowan Date: Sun, 19 Apr 2026 17:55:17 +1000 Subject: [PATCH] ci: add Docker image pull validation job (Phase 2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add image-pull job to .gitea/workflows/ci.yml that detects image changes in *.nomad.hcl files on PRs and pulls each changed image - Remove act-runner labels config — default runner already uses docker.gitea.com/runner-images:ubuntu-latest which has docker CLI - Remove CONFIG_FILE env var from act-runner (no longer needed) - Mark Phase 2 complete in cicd-plan.md --- .gitea/workflows/ci.yml | 36 +++++++++++++++++++++++++++++ 2-nomad-config/act-runner.nomad.hcl | 14 ----------- cicd-plan.md | 2 +- 3 files changed, 37 insertions(+), 15 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 97fe3d0..b158eb8 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -52,3 +52,39 @@ jobs: echo "==> $f" nomad job validate "$f" done + + image-pull: + name: Docker image pull validation + runs-on: ubuntu-latest + # Only run on PRs that touch nomad job specs + if: github.event_name == 'pull_request' + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Pull changed images + run: | + git fetch origin ${{ github.base_ref }} + IMAGES=$(git diff origin/${{ github.base_ref }}...HEAD -- '*.nomad.hcl' \ + | grep '^+\s*image\s*=' \ + | grep -oP '"[^"]+:[^"]+"' \ + | tr -d '"' \ + | sort -u) + + if [ -z "$IMAGES" ]; then + echo "No image changes detected, skipping pull." + exit 0 + fi + + FAILED=0 + while IFS= read -r image; do + echo "==> Pulling $image" + if ! docker pull "$image"; then + echo "ERROR: Failed to pull $image" + FAILED=1 + fi + done <<< "$IMAGES" + + exit $FAILED diff --git a/2-nomad-config/act-runner.nomad.hcl b/2-nomad-config/act-runner.nomad.hcl index c082d72..8abd6d2 100644 --- a/2-nomad-config/act-runner.nomad.hcl +++ b/2-nomad-config/act-runner.nomad.hcl @@ -29,7 +29,6 @@ job "act-runner" { env = { GITEA_INSTANCE_URL = "https://gitea-1ef0bea6b75a4fd3e9393a9f7f7e4b02.othrayte.one" - CONFIG_FILE = "/secrets/runner-config.yml" } # Required SOPS key: @@ -43,19 +42,6 @@ EOF env = true } - # Limit which images/labels the runner will accept so it doesn't pick up - # unrelated workloads if more runners are added later. - template { - data = <