All checks were successful
Reload Act Runner Stack to clear cache for workflows / diff (push) Successful in 47s
Reload Act Runner Stack to clear cache for workflows / reload-primary (push) Successful in 4s
Reload Act Runner Stack to clear cache for workflows / reload-secondary (push) Successful in 3s
Reload Act Runner Stack to clear cache for workflows / wait-for-secondary-death (push) Successful in 32s
Reload Act Runner Stack to clear cache for workflows / pull-cache-secondary (push) Successful in 8s
52 lines
2.0 KiB
YAML
52 lines
2.0 KiB
YAML
name: Reload Act Runner Stack to clear cache for workflows
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
diff:
|
|
uses: https://gitea.chromart.cc/martin/chromart-gitea-actions/.gitea/workflows/diff-output.yaml@main
|
|
with:
|
|
files: .gitea/**
|
|
|
|
reload-primary:
|
|
needs: diff
|
|
if: ${{ needs.diff.outputs.is_changed == 'true' }}
|
|
uses: https://gitea.chromart.cc/martin/chromart-gitea-actions/.gitea/workflows/gitainer-deploy.yaml@main
|
|
with:
|
|
stack_name: gitea_act_runner
|
|
# the secondary runner executes the primary restart webhook
|
|
runs_on_label: runner-secondary
|
|
|
|
reload-secondary:
|
|
needs: [diff, reload-primary]
|
|
if: ${{ needs.diff.outputs.is_changed == 'true' }}
|
|
# ensuring the primary actually survived and restarted successfully
|
|
uses: https://gitea.chromart.cc/martin/chromart-gitea-actions/.gitea/workflows/gitainer-deploy.yaml@main
|
|
with:
|
|
stack_name: gitea_act_runner_secondary
|
|
# the primary runner executes the secondary restart webhook
|
|
runs_on_label: runner-primary
|
|
# We use a detached webhook call so primary doesn't hang if the Gitainer stack takes 5 minutes to rebuild, and it avoids bridge network drop edge cases
|
|
delayed_silent: true
|
|
|
|
wait-for-secondary-death:
|
|
needs: [diff, reload-secondary]
|
|
if: ${{ needs.diff.outputs.is_changed == 'true' }}
|
|
runs-on: runner-primary
|
|
steps:
|
|
- name: Wait for Gitainer to kill the secondary runner
|
|
run: |
|
|
echo "The detached webhook container sleeps for 10s before firing."
|
|
echo "We wait 30s here to guarantee the webhook fired and Gitainer destroyed the old secondary runner."
|
|
sleep 30
|
|
|
|
pull-cache-secondary:
|
|
needs: [diff, wait-for-secondary-death]
|
|
if: ${{ needs.diff.outputs.is_changed == 'true' }}
|
|
# Because the old secondary is dead, Gitea leaves this job in the queue until the NEW secondary runner boots up.
|
|
uses: https://gitea.chromart.cc/martin/chromart-gitea-actions/.gitea/workflows/noop.yaml@main
|
|
with:
|
|
runs_on_label: runner-secondary
|