From 67e7afa039a0fd13802f33dbabea7d4a05bb5dbb Mon Sep 17 00:00:00 2001 From: "t.behrendt" Date: Thu, 5 Feb 2026 15:22:17 +0100 Subject: [PATCH 1/2] ci: add test for compose files --- .gitea/workflows/ci.yaml | 7 ++++++- get-images-from-files/test-compose.yaml | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 get-images-from-files/test-compose.yaml diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 3d5ee26..73a27ba 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -44,6 +44,7 @@ jobs: files: | - get-images-from-files/test.Dockerfile - get-images-from-files/test-deployment.yaml + - get-images-from-files/test-compose.yaml - name: Check image formats extracted run: | images="${{ steps.giff.outputs.images }}" @@ -59,6 +60,10 @@ jobs: check "K8s registry+tag (app:v2)" "example.com/library/app:v2" check "K8s registry+digest (helper@sha256:...)" "example.com/myproject/helper@sha256:bbbbbbbb" + # Compose-only refs + check "Compose registry+tag (web:v3)" "example.com/compose/web:v3" + check "Compose registry+tag (worker:v3)" "example.com/compose/worker:v3" + # 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) @@ -66,7 +71,7 @@ jobs: [ "$count" -eq 1 ] && echo "OK (count=$count)" || { echo "FAIL (count=$count, expected 1)"; exit 1; } total=$(echo "$images" | tr ',' '\n' | grep -c . || true) echo -n " Total unique refs: " - [ "$total" -eq 5 ] && echo "OK ($total)" || { echo "FAIL (got $total, expected 5)"; exit 1; } + [ "$total" -eq 7 ] && echo "OK ($total)" || { echo "FAIL (got $total, expected 7)"; exit 1; } echo "" echo "All checks passed." diff --git a/get-images-from-files/test-compose.yaml b/get-images-from-files/test-compose.yaml new file mode 100644 index 0000000..74c6571 --- /dev/null +++ b/get-images-from-files/test-compose.yaml @@ -0,0 +1,6 @@ +# Used by CI to test get-images-from-files action (Docker Compose, registry refs only) +services: + web: + image: example.com/compose/web:v3 + worker: + image: example.com/compose/worker:v3 -- 2.52.0 From a9e08697f6354842972f6277050b57cf11c2013a Mon Sep 17 00:00:00 2001 From: "t.behrendt" Date: Thu, 5 Feb 2026 15:22:37 +0100 Subject: [PATCH 2/2] docs: document compose compatibility --- get-images-from-files/README.md | 4 +++- get-images-from-files/action.yaml | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/get-images-from-files/README.md b/get-images-from-files/README.md index ad76b26..d2c00a8 100644 --- a/get-images-from-files/README.md +++ b/get-images-from-files/README.md @@ -2,7 +2,7 @@ A reusable Gitea Action, that extracts docker images from selected files in a repository. -The action supports Dockerfiles and Kubernetes manifests. Other files are supported if they have a recognizable image reference. Duplicate image references are deduplicated. +The action supports Dockerfiles, Kubernetes manifests, and Docker Compose/compose files. Other files are supported if they have a recognizable image reference. Duplicate image references are deduplicated. **Note:** Only fully-qualified refs (with registry, e.g. `docker.io/library/alpine:latest`, `gcr.io/distroless/static:nonroot@sha256:...`) are included; short refs like `alpine:latest` are omitted as their use is discouraged. @@ -17,6 +17,7 @@ The action supports Dockerfiles and Kubernetes manifests. Other files are suppor files: | - Dockerfile - k8s/50_deployment.yaml + - dockers/compose.yaml - values/traefik.yaml ``` @@ -37,6 +38,7 @@ jobs: files: | - Dockerfile - k8s/50_deployment.yaml + - dockers/compose.yaml - values/traefik.yaml ``` diff --git a/get-images-from-files/action.yaml b/get-images-from-files/action.yaml index 2746f63..2efa1da 100644 --- a/get-images-from-files/action.yaml +++ b/get-images-from-files/action.yaml @@ -1,5 +1,5 @@ name: "Get Images From Files" -description: "Extract docker images from selected files (Dockerfiles, Kubernetes manifests, and files with recognizable image references)" +description: "Extract docker images from selected files (Dockerfiles, Kubernetes manifests, Docker Compose/compose files, and files with recognizable image references)" author: "Timo Behrendt " branding: icon: "package" @@ -30,7 +30,7 @@ runs: [ -f "$f" ] || continue # Dockerfile: FROM [--platform=...] awk '/^[[:space:]]*FROM[[:space:]]/ { print $NF }' "$f" 2>/dev/null || true - # Kubernetes / Compose: image: + # Kubernetes / Docker Compose: image: grep -E '[[:space:]]image:[[:space:]]' "$f" 2>/dev/null | sed 's/.*image:[[:space:]]*//' | awk '{ print $1 }' || true done | grep -E '/' | sort -u | paste -sd, ) -- 2.52.0