mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-28 22:06:31 +00:00
revert(ci): restore original split_runner_apps.sh — pinning shifted app boundaries
This commit is contained in:
1 file changed
+4
-16
@@ -9,10 +9,6 @@
|
||||
# The split ratio mirrors the relative throughput of each runner pool:
|
||||
# github_count = floor(total × GITHUB_QUOTA / (GITHUB_QUOTA + SELF_HOSTED_COUNT))
|
||||
#
|
||||
# Apps listed in PINNED_GITHUB are always kept on GitHub-hosted runners
|
||||
# regardless of the split ratio (e.g. svc-runner installs host-level systemd
|
||||
# services that conflict with production self-hosted runners).
|
||||
#
|
||||
# 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)
|
||||
@@ -26,9 +22,6 @@ APPS_JSON="${APPS_JSON:-[]}"
|
||||
SELF_HOSTED_COUNT="${CI_SELF_HOSTED_RUNNER_COUNT:-0}"
|
||||
GITHUB_QUOTA=20
|
||||
|
||||
# Apps that must always run on GitHub-hosted runners.
|
||||
PINNED_GITHUB='["svc-runner"]'
|
||||
|
||||
if [[ "${SELF_HOSTED_COUNT}" -le 0 ]]; then
|
||||
echo "apps_github=${APPS_JSON}" >>"${GITHUB_OUTPUT}"
|
||||
echo "apps_self_hosted=[]" >>"${GITHUB_OUTPUT}"
|
||||
@@ -37,19 +30,14 @@ if [[ "${SELF_HOSTED_COUNT}" -le 0 ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Separate pinned apps from the pool before splitting.
|
||||
pinned="$(echo "${APPS_JSON}" | jq -c --argjson pins "${PINNED_GITHUB}" '[.[] | select(. as $a | $pins | index($a) != null)]')"
|
||||
pool="$(echo "${APPS_JSON}" | jq -c --argjson pins "${PINNED_GITHUB}" '[.[] | select(. as $a | $pins | index($a) == null)]')"
|
||||
|
||||
total="$(echo "${pool}" | jq 'length')"
|
||||
total="$(echo "${APPS_JSON}" | jq 'length')"
|
||||
github_count=$((total * GITHUB_QUOTA / (GITHUB_QUOTA + SELF_HOSTED_COUNT)))
|
||||
self_count=$((total - github_count))
|
||||
|
||||
apps_github="$(echo "${pool}" | jq -c --argjson pinned "${pinned}" "\$pinned + .[0:${github_count}]")"
|
||||
apps_self="$(echo "${pool}" | jq -c ".[${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}"
|
||||
|
||||
pinned_count="$(echo "${pinned}" | jq 'length')"
|
||||
echo "=== Runner split: ${pinned_count} pinned + ${github_count} apps → GitHub-hosted, ${self_count} apps → self-hosted (${SELF_HOSTED_COUNT} runners) ==="
|
||||
echo "=== Runner split: ${github_count} apps → GitHub-hosted, ${self_count} apps → self-hosted (${SELF_HOSTED_COUNT} runners) ==="
|
||||
Reference in new issue
Block a user