mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 10:59:59 +00:00
call-test-deploy-{compose,host,swarm,single-node}.yml differed only in
which mode they pinned and which artifact prefix they wrote; compose and
host already ran the identical drill. They become one call-test-deploy.yml
whose matrix rows carry the mode, so the swarm-specific steps are guarded
on it and everything else is shared.
The orchestrator loses its eight deploy jobs and the sequencing job for
three serial chunk blocks. GitHub Actions cannot generate a variable
number of jobs, so the blocks are written out and INFINITO_CI_MAX_CHUNKS
tells the budget how many exist; blocks whose slice is empty skip
themselves. chunk_gate stops the chain at the first red chunk,
resume_from_chunk re-enters after a fix instead of re-running the green
chunks, and modes collapses to a single mode choice.
apps.sh now emits matrix entries for one chunk rather than a token list
for one mode, and no longer sorts them: the discovery order is what the
chunker slices on. split_runner_apps.sh reads its runner quota from
INFINITO_CI_CONCURRENCY instead of carrying a second copy of the 20.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
52 lines
2.2 KiB
Bash
Executable File
52 lines
2.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
||
# Splits a JSON array of app IDs proportionally between GitHub-hosted and
|
||
# self-hosted CI runners.
|
||
#
|
||
# When CI_SELF_HOSTED_RUNNER_COUNT is 0 or unset, all apps are assigned to
|
||
# the GitHub-hosted batch and the self-hosted batch is empty — CI behaves
|
||
# exactly as before with no self-hosted runners registered.
|
||
#
|
||
# The split ratio mirrors the relative throughput of each runner pool:
|
||
# github_count = floor(total × GITHUB_QUOTA / (GITHUB_QUOTA + SELF_HOSTED_COUNT))
|
||
#
|
||
# Inputs (environment variables):
|
||
# APPS_JSON JSON array of app IDs from the discover step
|
||
# CI_SELF_HOSTED_RUNNER_COUNT self-hosted runner instance count (default: 0)
|
||
# INFINITO_CI_CONCURRENCY GitHub-hosted runner slots (SPOT: default.env)
|
||
#
|
||
# Outputs (appended to $GITHUB_OUTPUT):
|
||
# apps_github JSON array routed to GitHub-hosted runners
|
||
# apps_self_hosted JSON array routed to self-hosted runners ([] when disabled)
|
||
set -euo pipefail
|
||
|
||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||
REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
|
||
if [[ -f "${REPO_ROOT}/scripts/meta/env/load.sh" ]]; then
|
||
# shellcheck source=scripts/meta/env/load.sh
|
||
source "${REPO_ROOT}/scripts/meta/env/load.sh"
|
||
fi
|
||
|
||
APPS_JSON="${APPS_JSON:-[]}"
|
||
SELF_HOSTED_COUNT="${CI_SELF_HOSTED_RUNNER_COUNT:-0}"
|
||
GITHUB_QUOTA="${INFINITO_CI_CONCURRENCY:?INFINITO_CI_CONCURRENCY must be set (SPOT: default.env)}"
|
||
|
||
if [[ "${SELF_HOSTED_COUNT}" -le 0 ]]; then
|
||
echo "apps_github=${APPS_JSON}" >>"${GITHUB_OUTPUT}"
|
||
echo "apps_self_hosted=[]" >>"${GITHUB_OUTPUT}"
|
||
total="$(echo "${APPS_JSON}" | jq 'length')"
|
||
echo "=== Runner split: all ${total} apps → GitHub-hosted (self-hosted disabled) ==="
|
||
exit 0
|
||
fi
|
||
|
||
total="$(echo "${APPS_JSON}" | jq 'length')"
|
||
github_count=$((total * GITHUB_QUOTA / (GITHUB_QUOTA + SELF_HOSTED_COUNT)))
|
||
self_count=$((total - github_count))
|
||
|
||
apps_github="$(echo "${APPS_JSON}" | jq -c ".[0:${github_count}]")"
|
||
apps_self="$(echo "${APPS_JSON}" | jq -c ".[${github_count}:]")"
|
||
|
||
echo "apps_github=${apps_github}" >>"${GITHUB_OUTPUT}"
|
||
echo "apps_self_hosted=${apps_self}" >>"${GITHUB_OUTPUT}"
|
||
|
||
echo "=== Runner split: ${github_count} apps → GitHub-hosted, ${self_count} apps → self-hosted (${SELF_HOSTED_COUNT} runners) ==="
|