mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-08 11:46:35 +00:00
act merges its --env-file, which defaults to .env, after the workflow-level env block (pkg/runner/run_context.go:84 at v0.2.89) and interpolates only afterwards, so INFINITO_DISTROS: ${{ inputs.distros }} was replaced by the repository's own five-distro list before the expression was ever evaluated. Every workspace leg therefore swept all five distros instead of its own: 25 distro deploys where 5 were intended, which is what walked the five legs into their 345-minute cap. The drill step's name kept rendering the single distro because it is interpolated from the workflow model rather than from the env map, which is why the logs read as a contradiction.
Pass INFINITO_DISTROS as an --env pair instead, the layer act itself wins with, where --env beats the env-file because the file only fills keys that are absent (cmd/root.go:364-366). The expression was duplicated across ACT_ENV and ACT_INPUTS, so name it once.
Wrapping the assignment for readability required the splitter to tolerate whitespace: inside double quotes the shell removes the backslash-newline but keeps the continuation line's indentation, so every pair after the first arrived with a leading tab.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
87 lines
2.9 KiB
Bash
Executable File
87 lines
2.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
: "${ACT_WORKFLOW:?ACT_WORKFLOW is not set (e.g. .github/workflows/test-workspace.yml)}"
|
|
: "${ACT_EVENT:=workflow_dispatch}"
|
|
: "${ACT_JOB:=}"
|
|
: "${ACT_MATRIX:=}"
|
|
: "${ACT_CONTAINER_OPTIONS:=--privileged}"
|
|
: "${ACT_NETWORK:=host}"
|
|
: "${ACT_PULL:=false}"
|
|
: "${ACT_RM:=true}"
|
|
: "${ACT_PLATFORM_IMAGE:?ACT_PLATFORM_IMAGE is not set; source scripts/meta/env/load.sh or invoke via make}"
|
|
: "${ACT_BIND:=false}"
|
|
: "${ACT_INPUTS:=}"
|
|
: "${ACT_ENV:=}"
|
|
|
|
if [[ "${ACT_PLATFORM_IMAGE}" == local/act-runner-fixed:latest ]] &&
|
|
! docker image inspect "${ACT_PLATFORM_IMAGE}" >/dev/null 2>&1; then
|
|
bash "$(dirname "${BASH_SOURCE[0]}")/build_runner_image.sh"
|
|
fi
|
|
|
|
_act_cache_path="${ACT_ACTION_CACHE_PATH:-/tmp/actcache/act}" # nocheck: act-tool cache path, not a stack variable
|
|
_stale_mounts=$(mount | grep -E " on ${_act_cache_path}/[^ ]+ type devtmpfs " || true)
|
|
if [[ -n "${_stale_mounts}" ]]; then
|
|
echo "ERROR: stale devtmpfs bind-mounts inside ${_act_cache_path} block act from refreshing the actions cache." >&2
|
|
echo "Affected mountpoints:" >&2
|
|
echo "${_stale_mounts}" | awk '{print " " $3}' >&2
|
|
echo "Fix (run on the host, outside the agent sandbox):" >&2
|
|
echo " mount | awk -v p='${_act_cache_path}/' '\$5==\"devtmpfs\" && index(\$3,p)==1 {print \$3}' | sudo xargs -r umount" >&2
|
|
echo " sudo rm -rf ${_act_cache_path}" >&2
|
|
exit 3
|
|
fi
|
|
|
|
echo "=== act: workflow=${ACT_WORKFLOW} event=${ACT_EVENT} job=${ACT_JOB:-<all>} matrix=${ACT_MATRIX:-<none>} inputs=${ACT_INPUTS:-<none>} ==="
|
|
|
|
cmd=(act "${ACT_EVENT}" -W "${ACT_WORKFLOW}")
|
|
cmd+=(-P "ubuntu-latest=${ACT_PLATFORM_IMAGE}")
|
|
cmd+=(-P "ubuntu-24.04=${ACT_PLATFORM_IMAGE}")
|
|
cmd+=(-P "ubuntu-22.04=${ACT_PLATFORM_IMAGE}")
|
|
cmd+=(-P "ubuntu-20.04=${ACT_PLATFORM_IMAGE}")
|
|
|
|
if [[ -n "${ACT_JOB}" ]]; then
|
|
cmd+=(-j "${ACT_JOB}")
|
|
fi
|
|
if [[ -n "${ACT_MATRIX}" ]]; then
|
|
IFS=';' read -ra _act_matrix_filters <<<"${ACT_MATRIX}"
|
|
for pair in "${_act_matrix_filters[@]}"; do
|
|
cmd+=(--matrix "${pair}")
|
|
done
|
|
fi
|
|
if [[ -n "${ACT_INPUTS}" ]]; then
|
|
for pair in ${ACT_INPUTS}; do
|
|
cmd+=(--input "${pair}")
|
|
done
|
|
fi
|
|
if [[ -n "${ACT_ENV}" ]]; then
|
|
IFS=';' read -ra _act_env_pairs <<<"${ACT_ENV}"
|
|
for pair in "${_act_env_pairs[@]}"; do
|
|
pair="${pair#"${pair%%[![:space:]]*}"}"
|
|
pair="${pair%"${pair##*[![:space:]]}"}"
|
|
if [[ -n "${pair}" ]]; then
|
|
cmd+=(--env "${pair}")
|
|
fi
|
|
done
|
|
fi
|
|
if [[ -n "${ACT_CONTAINER_OPTIONS}" ]]; then
|
|
cmd+=(--container-options "${ACT_CONTAINER_OPTIONS}")
|
|
fi
|
|
if [[ -n "${ACT_NETWORK}" ]]; then
|
|
cmd+=(--network "${ACT_NETWORK}")
|
|
fi
|
|
cmd+=(--concurrent-jobs "1")
|
|
|
|
cmd+=(--pull="${ACT_PULL}")
|
|
cmd+=(--action-offline-mode)
|
|
cmd+=(--action-cache-path "${ACT_ACTION_CACHE_PATH:-/tmp/actcache/act}") # nocheck: act-tool cache path, not a stack variable
|
|
if [[ "${ACT_RM}" == "true" ]]; then
|
|
cmd+=(--rm)
|
|
fi
|
|
cmd+=(--cache-server-addr 127.0.0.1)
|
|
cmd+=(--artifact-server-addr 127.0.0.1)
|
|
if [[ "${ACT_BIND}" == "true" ]]; then
|
|
cmd+=(--bind)
|
|
fi
|
|
|
|
"${cmd[@]}"
|