Files
komorebi/.github/workflows/rerun-no-kvm.yaml
T
LGUG2Z 88b12fd253 build(github): rerun a run that lost its runner's KVM
A hosted runner of a private repository can land on a host with no
/dev/kvm, which failed one vm-fast job of a run (core-e2e, 2026-10-28)
and nothing else. The Enable KVM step now says so, and rerun-no-kvm
reruns the failed jobs, up to three attempts, when every failed job
failed on that step. A failed suite is not rerun.
2026-10-28 19:56:56 -07:00

38 lines
1.6 KiB
YAML

# A hosted runner of a private repository may land on a host with no KVM, which fails the "Enable
# KVM" step of .github/actions/nix. Another attempt usually gets another host, so a run that failed
# only for that is rerun, up to three attempts. A suite that fails is left alone. A run cannot rerun
# its own failed jobs while it is still in progress, hence a workflow of its own.
name: rerun-no-kvm
on:
workflow_run:
workflows: [ci]
types: [completed]
jobs:
rerun:
if: >-
github.repository == 'LGUG2Z/komorebi-for-kde' &&
github.event.workflow_run.conclusion == 'failure' &&
github.event.workflow_run.run_attempt < 3
runs-on: ubuntu-24.04
permissions:
actions: write
steps:
- name: Rerun the failed jobs when every one of them failed to get KVM
env:
GH_TOKEN: ${{ github.token }}
RUN_ID: ${{ github.event.workflow_run.id }}
REPO: ${{ github.repository }}
run: |
# for each failed job, the name of the step that failed
failed=$(gh api --paginate "repos/$REPO/actions/runs/$RUN_ID/jobs?filter=latest" \
--jq '.jobs[] | select(.conclusion == "failure") | [.name, ([.steps[] | select(.conclusion == "failure") | .name] | first // "")] | @tsv')
echo "$failed"
if [ -z "$failed" ] || printf '%s\n' "$failed" | awk -F'\t' '$2 !~ /Enable KVM/ { bad = 1 } END { exit !bad }'; then
echo "something other than a missing /dev/kvm failed: not rerunning"
exit 0
fi
gh run rerun "$RUN_ID" --repo "$REPO" --failed