From b41c75e76f2c08e80079677a5523989067de2291 Mon Sep 17 00:00:00 2001 From: "t.behrendt" Date: Thu, 5 Feb 2026 14:45:44 +0100 Subject: [PATCH] style: make ci test more expressive --- .gitea/workflows/ci.yaml | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index e467dd3..3d5ee26 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -48,16 +48,25 @@ jobs: run: | images="${{ steps.giff.outputs.images }}" echo "Extracted: $images" - # Dockerfile-only: registry with tag, registry with digest - echo "$images" | grep -q 'example.com/library/nginx:v1' - echo "$images" | grep -q 'example.com/library/base@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' - # K8s-only: registry with tag, registry with digest - echo "$images" | grep -q 'example.com/library/app:v2' - echo "$images" | grep -q 'example.com/myproject/helper@sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' - # Shared ref (in both Dockerfile and K8s) — must appear exactly once - echo "$images" | grep -q 'example.com/distroless/static:nonroot' + echo "" + check() { echo -n " $1: "; echo "$images" | grep -q "$2" && echo "OK" || { echo "FAIL (not found)"; exit 1; }; } + + # Dockerfile-only refs + check "Dockerfile registry+tag (nginx:v1)" "example.com/library/nginx:v1" + check "Dockerfile registry+digest (base@sha256:...)" "example.com/library/base@sha256:aaaaaaaa" + + # K8s-only refs + check "K8s registry+tag (app:v2)" "example.com/library/app:v2" + check "K8s registry+digest (helper@sha256:...)" "example.com/myproject/helper@sha256:bbbbbbbb" + + # Shared ref (in both files) — must appear exactly once + check "Shared ref present (distroless/static:nonroot)" "example.com/distroless/static:nonroot" count=$(echo "$images" | tr ',' '\n' | grep -c 'example.com/distroless/static:nonroot' || true) - [ "$count" -eq 1 ] || { echo "expected shared ref once, got: $count"; exit 1; } - # Total unique refs: 5 + echo -n " Shared ref appears once (no duplicates): " + [ "$count" -eq 1 ] && echo "OK (count=$count)" || { echo "FAIL (count=$count, expected 1)"; exit 1; } total=$(echo "$images" | tr ',' '\n' | grep -c . || true) - [ "$total" -eq 5 ] || { echo "expected 5 unique refs, got: $total"; exit 1; } + echo -n " Total unique refs: " + [ "$total" -eq 5 ] && echo "OK ($total)" || { echo "FAIL (got $total, expected 5)"; exit 1; } + + echo "" + echo "All checks passed."