Files
runneros/.gitea/workflows/os.yml
T
Job79andClaude Opus 5.5 cdc4a84658 Run the runner as root; shorten the workflow
The gitea-runner user had root's podman socket, which is root access anyway, so it bought no
isolation. Run it as root and drop the user, the podman.socket drop-in and the /run/podman
permission workaround.

The workflow publishes in one step with small helpers, and filters assets with awk, which,
unlike grep, does not fail the step when nothing matches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V27snor4EJUATK7VoiKne6
2026-11-14 11:26:52 +00:00

55 lines
2.4 KiB
YAML

# git-runner OS image
#
# Builds the OS image, with the job image inside, and publishes it as assets of this repository's
# "latest" release, where runners fetch their updates (mkosi.extra/usr/lib/sysupdate.d).
# Runs on every push, weekly for Fedora updates, and by hand. The weekly and manual runs also
# publish the disk image for new installs (git-runner.qcow2).
name: os
on:
push:
branches: [main]
schedule:
- cron: "0 2 * * 0" # weekly (Sunday), picks up Fedora updates
workflow_dispatch: # run by hand, e.g. for a CVE
jobs:
os:
runs-on: fedora
env:
API: ${{ github.api_url }}/repos/${{ github.repository }}/releases
AUTH: "Authorization: token ${{ github.token }}"
steps:
- name: Install tools
run: dnf install -yq git-core mkosi jq
- name: Check out
uses: builtin:checkout
- name: Build
run: mkosi build
- name: Compress
working-directory: mkosi.output
run: |
zstd -q --rm -T0 -19 git-runner_*.root-*.raw
sha256sum git-runner_*.efi git-runner_*.root-*.raw.zst > SHA256SUMS
- name: Find the release
run: |
release=$(curl -fsS -H "$AUTH" "$API/tags/latest") ||
release=$(curl -fsS -H "$AUTH" -H 'Content-Type: application/json' "$API" -d '{"tag_name": "latest", "name": "latest"}')
echo "RELEASE=$API/$(jq .id <<<"$release")" >> "$GITHUB_ENV"
# Uploads the update, then replaces SHA256SUMS, which tells runners it is there, then removes
# older versions.
- name: Publish the update
working-directory: mkosi.output
run: |
assets() { curl -fsS -H "$AUTH" "$RELEASE/assets" | jq -r '.[] | "\(.id) \(.name)"'; }
upload() { curl -fsS -o /dev/null -H "$AUTH" -F "attachment=@$1" "$RELEASE/assets?name=$1"; }
delete() { while read -r id _; do curl -fsS -H "$AUTH" -X DELETE "$RELEASE/assets/$id"; done; }
for f in $(awk '{print $2}' SHA256SUMS); do upload "$f"; done
assets | awk '$2 == "SHA256SUMS"' | delete
upload SHA256SUMS
assets | awk 'NR == FNR { keep[$2]; next } $2 ~ /^git-runner_/ && !($2 in keep)' SHA256SUMS - | delete
if [ "${{ github.event_name }}" != push ]; then
qemu-img convert -c -O qcow2 "$(basename git-runner_*.efi .efi).raw" git-runner.qcow2
assets | awk '$2 == "git-runner.qcow2"' | delete
upload git-runner.qcow2
fi