Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 43 additions & 6 deletions .github/workflows/infrastructure-download-external.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ on:
required: false
type: boolean
default: false
CHUNK_INDEX:
# Which slice of the matrix this invocation processes (0..CHUNK_COUNT-1).
# Used to keep strategy.matrix under GitHub Actions' 256-entry cap when
# the number of packages × arches × releases grows past that. Defaults
# to 0/1 so the workflow still works when called un-chunked.
required: false
type: number
default: 0
CHUNK_COUNT:
required: false
type: number
default: 1
secrets:
GPG_KEY1:
required: true
Expand Down Expand Up @@ -209,7 +221,7 @@ jobs:
- name: Upload Artifact
uses: actions/upload-artifact@v7
with:
name: assets-for-download
name: assets-for-download-${{ inputs.CHUNK_INDEX }}
path: downloads
overwrite: true
retention-days: 5
Expand Down Expand Up @@ -360,11 +372,36 @@ jobs:
echo "::warning::No matrix entries generated, adding placeholder" >&2
MATRIX_JSON_COMPACTED='{"include":[{"name":"none","arch":"amd64","release":"bookworm"}]}'
else
# Debug: Show raw matrix JSON
echo "::debug::Raw matrix JSON: ${MATRIX_JSON}" >&2
# Chunk the matrix so each invocation keeps strategy.matrix
# below GitHub Actions' 256-entry cap. Callers that don't
# know about chunking get CHUNK_COUNT=1 and pass the whole
# thing through (legacy behavior).
CHUNK_INDEX="${{ inputs.CHUNK_INDEX }}"
CHUNK_COUNT="${{ inputs.CHUNK_COUNT }}"
if [[ "${CHUNK_COUNT}" -lt 1 ]]; then CHUNK_COUNT=1; fi
if [[ "${CHUNK_INDEX}" -ge "${CHUNK_COUNT}" ]]; then
echo "::error::CHUNK_INDEX=${CHUNK_INDEX} must be < CHUNK_COUNT=${CHUNK_COUNT}" >&2
exit 1
fi
Comment thread
coderabbitai[bot] marked this conversation as resolved.

# Compact the JSON for GitHub Actions
MATRIX_JSON_COMPACTED=$(echo "${MATRIX_JSON}" | jq -c)
# Slice jq: split includes into CHUNK_COUNT roughly-equal
# groups by modular index (not contiguous ranges) so a
# slow package type doesn't cluster into one chunk.
SLICED=$(echo "${MATRIX_JSON}" | jq -c \
--argjson idx "${CHUNK_INDEX}" \
--argjson cnt "${CHUNK_COUNT}" \
'{include: [.include | to_entries[] | select(.key % $cnt == $idx) | .value]}')

SLICE_COUNT=$(echo "${SLICED}" | jq '.include | length')
echo "::notice::chunk ${CHUNK_INDEX}/${CHUNK_COUNT}: ${SLICE_COUNT} of ${MATRIX_COUNT} entries" >&2

# Empty slice needs a placeholder for the downstream job to
# run at all — it'll skip entries with name=none.
if [[ "${SLICE_COUNT}" -eq 0 ]]; then
MATRIX_JSON_COMPACTED='{"include":[{"name":"none","arch":"amd64","release":"bookworm"}]}'
else
MATRIX_JSON_COMPACTED="${SLICED}"
fi
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
echo "::debug::Compacted matrix JSON: ${MATRIX_JSON_COMPACTED}" >&2
fi

Expand Down Expand Up @@ -897,5 +934,5 @@ jobs:
- name: Clean artifacts
uses: geekyeggo/delete-artifact@v6
with:
name: assets-for-download
name: assets-for-download-${{ inputs.CHUNK_INDEX }}
failOnError: false
14 changes: 13 additions & 1 deletion .github/workflows/infrastructure-repository-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,18 @@ jobs:
TEAM: "Release manager"

external:
name: "Download external"
name: "Download external (chunk ${{ matrix.chunk_index }}/4)"
needs: Check
# Fan out across 4 chunks. The child workflow filters its matrix to
# only entries where `index % CHUNK_COUNT == CHUNK_INDEX`, so each
# invocation stays under GitHub Actions' 256-entry strategy.matrix
# cap. Effective concurrency is 4 × max-parallel (180) = 720.
# Bump `chunk_index` and `CHUNK_COUNT` together when total packages
# × arches × releases approaches 4 × 256 = 1024.
strategy:
fail-fast: false
matrix:
chunk_index: [0, 1, 2, 3]
uses: armbian/armbian.github.io/.github/workflows/infrastructure-download-external.yml@main
with:
ENABLED: ${{ inputs.download_external != false || github.event.client_payload.download_external != false }}
Expand All @@ -51,6 +61,8 @@ jobs:
BUILD_RUNNER: "docker"
HOST_DEPLOY: "repo.armbian.com"
PURGE: ${{ inputs.purge_external || false }}
CHUNK_INDEX: ${{ matrix.chunk_index }}
CHUNK_COUNT: 4
secrets:
GPG_KEY1: ${{ secrets.GPG_KEY3 }}
GPG_KEY2: ${{ secrets.GPG_KEY4 }}
Expand Down
Loading