refactor(ci): extract images-build-ci inline blocks into runner SPOTs

Three inline `run:` blocks moved into `scripts/github/runner/`:

* `images_build_outputs.sh "$distros" "$image_tag"` — replaces the
  matrix/image_tag computation in the "Compute matrix JSON" step; emits
  both outputs to $GITHUB_OUTPUT in one call.
* `distros_matrix.sh "$distros"` — the matrix-JSON primitive
  (`split(" ") | map(select(length>0))`), reused by test-dns.yml's
  matrix step. Removes the jq duplicate that lived in both workflows.
* The two pre/post-build `Disk pressure` steps now invoke the already-
  existing `disk_pressure_report.sh PRE-BUILD` / `POST-BUILD` instead of
  duplicating the df/docker-system-df/buildx-du block inline.

Behaviour unchanged; the workflow runs the same commands via the SPOT
helpers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 4.7 committed 2026-05-21 04:01:39 +02:00
1 parent 42865145cb
commit ce48a8151a
4 files changed
+47 -30

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
#
# Emit a JSON array matrix from a space-separated distro list. Used by
# images-build-ci and test-dns workflows to feed the matrix strategy.
#
# Usage:
# distros_matrix.sh "arch debian ubuntu"
# echo "matrix=$(distros_matrix.sh "${INPUT}")" >> "$GITHUB_OUTPUT"
set -euo pipefail
distros="${1:-}"
printf '%s' "${distros}" | jq -Rc 'split(" ") | map(select(length>0))'
+31
View File
@@ -0,0 +1,31 @@
#!/usr/bin/env bash
#
# Compute the matrix JSON + effective image_tag for images-build-ci and
# write both to $GITHUB_OUTPUT. Replaces the inline `run:` block of the
# "Compute matrix JSON" step.
#
# Usage:
# images_build_outputs.sh "<distros>" "<image_tag_override>"
set -euo pipefail
distros="${1:-}"
override="${2:-}"
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
json="$(bash "${script_dir}/distros_matrix.sh" "${distros}")"
if [[ -n "${override}" ]]; then
image_tag="${override}"
else
: "${GITHUB_SHA:?GITHUB_SHA must be set when no image_tag override is provided}"
image_tag="ci-${GITHUB_SHA}"
fi
: "${GITHUB_OUTPUT:?GITHUB_OUTPUT must be set}"
{
echo "matrix=${json}"
echo "image_tag=${image_tag}"
} >>"${GITHUB_OUTPUT}"
echo "Using matrix: ${json}"
echo "Using image tag: ${image_tag}"