Files
computer-playbook/scripts/github/runner/images_build_outputs.sh
kevinveenbirkenbachandClaude Opus 4.7 ce48a8151a 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>
2026-05-21 04:01:39 +02:00

32 lines
819 B
Bash
Executable File

#!/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}"