diff --git a/.github/workflows/call-images-build-ci.yml b/.github/workflows/call-images-build-ci.yml index 52888eddd7..227fd3cfb4 100644 --- a/.github/workflows/call-images-build-ci.yml +++ b/.github/workflows/call-images-build-ci.yml @@ -41,25 +41,8 @@ concurrency: cancel-in-progress: false jobs: - prepare: - name: 📋 Build Matrix - runs-on: ubuntu-latest - outputs: - matrix: ${{ steps.out.outputs.matrix }} - image_tag: ${{ steps.out.outputs.image_tag }} - steps: - - uses: actions/checkout@v7.0.0 - - - name: 📦 Install jq - run: ./scripts/install/apt.sh jq - - - name: 🧮 Compute matrix JSON - id: out - run: scripts/github/runner/images_build_outputs.sh "${{ inputs.distros }}" "${{ inputs.image_tag }}" - build: name: 💿 Image - needs: prepare runs-on: ubuntu-latest permissions: contents: read @@ -81,6 +64,13 @@ jobs: persist-credentials: false allow-unsafe-pr-checkout: ${{ inputs.allow_unsafe_checkout }} + - name: 📦 Install jq + run: ./scripts/install/apt.sh jq + + - name: 🧮 Compute the distro list and image tag + id: out + run: scripts/github/runner/images_build_outputs.sh "${{ inputs.distros }}" "${{ inputs.image_tag }}" + - name: 💽 Disk pressure (start) shell: bash run: bash scripts/github/runner/disk_pressure_report.sh START @@ -129,8 +119,8 @@ jobs: env: GITHUB_REPOSITORY_OWNER: ${{ steps.owner.outputs.owner }} BUILD_CONTEXT_DIR: _src - INFINITO_DISTROS: ${{ join(fromJson(needs.prepare.outputs.matrix), ' ') }} - IMAGE_TAG: ${{ needs.prepare.outputs.image_tag }} + INFINITO_DISTROS: ${{ join(fromJson(steps.out.outputs.matrix), ' ') }} + IMAGE_TAG: ${{ steps.out.outputs.image_tag }} USE_NIX_TOKEN: ${{ !(github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository) }} NIX_GITHUB_TOKEN: ${{ github.token }} MAX_ATTEMPTS: "7" diff --git a/scripts/image/push_all.sh b/scripts/image/push_all.sh index b365fa7dba..11ca4b67b8 100755 --- a/scripts/image/push_all.sh +++ b/scripts/image/push_all.sh @@ -12,21 +12,15 @@ if ((${#distros[@]} == 0)); then read -r -a distros <<<"${INFINITO_DISTROS}" fi -log_dir="${INFINITO_BUILD_LOG_DIR:-${repo_root}/build/image-logs}" +log_dir="${BUILD_LOG_DIR:-${repo_root}/build/image-logs}" mkdir -p "${log_dir}" -group_open() { - if [[ -n "${GITHUB_ACTIONS:-}" ]]; then - echo "::group::$1" - else - echo "──────── $1 ────────" - fi -} - -group_close() { - if [[ -n "${GITHUB_ACTIONS:-}" ]]; then - echo "::endgroup::" - fi +stamp() { + local distro="$1" + local line + while IFS= read -r line; do + printf '[%s][%(%H:%M:%S)T] %s\n' "${distro}" -1 "${line}" + done } # shellcheck source=scripts/meta/env/load.sh @@ -48,10 +42,13 @@ for distro in "${distros[@]}"; do gap="${gap_next}" fi - MATRIX_DISTRO="${distro}" \ - bash "${script_dir}/push.sh" >"${log_dir}/${distro}.log" 2>&1 & + ( + set -o pipefail + MATRIX_DISTRO="${distro}" bash "${script_dir}/push.sh" 2>&1 | + stamp "${distro}" | + tee "${log_dir}/${distro}.log" + ) & pids+=("$!") - echo " → ${distro} started as pid $!" started=$((started + 1)) done @@ -68,12 +65,6 @@ for pid in "${pids[@]}"; do index=$((index + 1)) done -for distro in "${distros[@]}"; do - group_open "${distro}" - cat "${log_dir}/${distro}.log" || true # nocheck: shell-or-true -- a missing log must not mask the build verdict below - group_close -done - if ((${#failed[@]} > 0)); then echo "❌ Failed distros: ${failed[*]}" exit 1