style: make ci test more expressive
This commit is contained in:
+20
-11
@@ -48,16 +48,25 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
images="${{ steps.giff.outputs.images }}"
|
images="${{ steps.giff.outputs.images }}"
|
||||||
echo "Extracted: $images"
|
echo "Extracted: $images"
|
||||||
# Dockerfile-only: registry with tag, registry with digest
|
echo ""
|
||||||
echo "$images" | grep -q 'example.com/library/nginx:v1'
|
check() { echo -n " $1: "; echo "$images" | grep -q "$2" && echo "OK" || { echo "FAIL (not found)"; exit 1; }; }
|
||||||
echo "$images" | grep -q 'example.com/library/base@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
|
|
||||||
# K8s-only: registry with tag, registry with digest
|
# Dockerfile-only refs
|
||||||
echo "$images" | grep -q 'example.com/library/app:v2'
|
check "Dockerfile registry+tag (nginx:v1)" "example.com/library/nginx:v1"
|
||||||
echo "$images" | grep -q 'example.com/myproject/helper@sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'
|
check "Dockerfile registry+digest (base@sha256:...)" "example.com/library/base@sha256:aaaaaaaa"
|
||||||
# Shared ref (in both Dockerfile and K8s) — must appear exactly once
|
|
||||||
echo "$images" | grep -q 'example.com/distroless/static:nonroot'
|
# 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=$(echo "$images" | tr ',' '\n' | grep -c 'example.com/distroless/static:nonroot' || true)
|
||||||
[ "$count" -eq 1 ] || { echo "expected shared ref once, got: $count"; exit 1; }
|
echo -n " Shared ref appears once (no duplicates): "
|
||||||
# Total unique refs: 5
|
[ "$count" -eq 1 ] && echo "OK (count=$count)" || { echo "FAIL (count=$count, expected 1)"; exit 1; }
|
||||||
total=$(echo "$images" | tr ',' '\n' | grep -c . || true)
|
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."
|
||||||
|
|||||||
Reference in New Issue
Block a user