Publish updates as a generic package
Each build replaces version "latest" of the generic package git-runner: one delete and one upload per file, with no release ids or pruning. Updates are no longer atomic: while a build uploads, runners find no update and retry later. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
5 files changed
+13
-22
No files matched your search
+8
-17
@@ -1,9 +1,8 @@
|
|||||||
# git-runner OS image
|
# git-runner OS image
|
||||||
#
|
#
|
||||||
# Builds the OS image, with the job image inside, and publishes it as a release of this repository.
|
# Builds the OS image, with the job image inside, and publishes it as version "latest" of the
|
||||||
# Runners fetch their updates from releases/download/latest/ (mkosi.extra/usr/lib/sysupdate.d),
|
# generic package git-runner, where runners fetch their updates (mkosi.extra/usr/lib/sysupdate.d).
|
||||||
# which Gitea serves from the newest release. Runs on every push, weekly for Fedora updates, and
|
# Runs on every push, weekly for Fedora updates, and by hand.
|
||||||
# by hand.
|
|
||||||
name: os
|
name: os
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -16,11 +15,11 @@ jobs:
|
|||||||
os:
|
os:
|
||||||
runs-on: fedora
|
runs-on: fedora
|
||||||
env:
|
env:
|
||||||
API: ${{ github.api_url }}/repos/${{ github.repository }}
|
PKG: ${{ github.server_url }}/api/packages/${{ github.repository_owner }}/generic/git-runner/latest
|
||||||
AUTH: "Authorization: token ${{ github.token }}"
|
AUTH: "Authorization: token ${{ github.token }}"
|
||||||
steps:
|
steps:
|
||||||
- name: Install tools
|
- name: Install tools
|
||||||
run: dnf install -yq git-core mkosi jq
|
run: dnf install -yq git-core mkosi
|
||||||
- name: Check out
|
- name: Check out
|
||||||
uses: builtin:checkout
|
uses: builtin:checkout
|
||||||
- name: Build
|
- name: Build
|
||||||
@@ -31,19 +30,11 @@ jobs:
|
|||||||
zstd -q --rm -T0 -19 git-runner_*.root-*.raw
|
zstd -q --rm -T0 -19 git-runner_*.root-*.raw
|
||||||
qemu-img convert -c -O qcow2 "$(basename git-runner_*.efi .efi).raw" git-runner.qcow2
|
qemu-img convert -c -O qcow2 "$(basename git-runner_*.efi .efi).raw" git-runner.qcow2
|
||||||
sha256sum git-runner_*.efi git-runner_*.root-*.raw.zst > SHA256SUMS
|
sha256sum git-runner_*.efi git-runner_*.root-*.raw.zst > SHA256SUMS
|
||||||
# A draft until its files are uploaded, so "latest" never points at a release without them.
|
# Replaces the previous version. SHA256SUMS goes last: until it's there, runners find no update.
|
||||||
# Then removes all but the newest 3 releases.
|
|
||||||
- name: Publish
|
- name: Publish
|
||||||
working-directory: mkosi.output
|
working-directory: mkosi.output
|
||||||
run: |
|
run: |
|
||||||
version=$(basename git-runner_*.efi .efi)
|
curl -fsS -H "$AUTH" -X DELETE "$PKG" || true
|
||||||
version=${version#git-runner_}
|
|
||||||
id=$(curl -fsS -H "$AUTH" -H 'Content-Type: application/json' "$API/releases" \
|
|
||||||
-d "{\"tag_name\": \"$version\", \"target_commitish\": \"$GITHUB_SHA\", \"draft\": true}" | jq .id)
|
|
||||||
for f in $(awk '{print $2}' SHA256SUMS) git-runner.qcow2 SHA256SUMS; do
|
for f in $(awk '{print $2}' SHA256SUMS) git-runner.qcow2 SHA256SUMS; do
|
||||||
curl -fsS -o /dev/null -H "$AUTH" -F "attachment=@$f" "$API/releases/$id/assets?name=$f"
|
curl -fsS -o /dev/null -H "$AUTH" --upload-file "$f" "$PKG/$f"
|
||||||
done
|
|
||||||
curl -fsS -o /dev/null -H "$AUTH" -H 'Content-Type: application/json' -X PATCH "$API/releases/$id" -d '{"draft": false}'
|
|
||||||
curl -fsS -H "$AUTH" "$API/releases" | jq -r '.[3:][].tag_name' | while read -r tag; do
|
|
||||||
curl -fsS -H "$AUTH" -X DELETE "$API/releases/tags/$tag" && curl -fsS -H "$AUTH" -X DELETE "$API/tags/$tag"
|
|
||||||
done
|
done
|
||||||
@@ -11,7 +11,7 @@ A [Gitea Actions](https://docs.gitea.com/usage/actions/overview) runner packaged
|
|||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
Download [the disk image](https://git.plabble.org/Job79/git-runner-mkosi/releases/download/latest/git-runner.qcow2) (built by the `os` workflow), resize it to the disk size you want (/var grows to fill it) and boot it with UEFI. The screen and the serial console ask for a root password, hostname, Gitea URL, registration token and number of parallel jobs; the runner then registers itself.
|
Download [the disk image](https://git.plabble.org/api/packages/Job79/generic/git-runner/latest/git-runner.qcow2) (built by the `os` workflow), resize it to the disk size you want (/var grows to fill it) and boot it with UEFI. The screen and the serial console ask for a root password, hostname, Gitea URL, registration token and number of parallel jobs; the runner then registers itself.
|
||||||
|
|
||||||
## Images
|
## Images
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
# Updates the root filesystem: writes the next version to the unused root partition.
|
# Updates the root filesystem: writes the next version to the unused root partition.
|
||||||
# Verify=no: releases are unsigned (no secrets in the repo); SHA256SUMS still checks each download.
|
# Verify=no: updates are unsigned (no secrets in the repo); SHA256SUMS still checks each download.
|
||||||
[Transfer]
|
[Transfer]
|
||||||
ProtectVersion=%A
|
ProtectVersion=%A
|
||||||
Verify=no
|
Verify=no
|
||||||
|
|
||||||
[Source]
|
[Source]
|
||||||
Type=url-file
|
Type=url-file
|
||||||
Path=https://git.plabble.org/Job79/git-runner-mkosi/releases/download/latest/
|
Path=https://git.plabble.org/api/packages/Job79/generic/git-runner/latest/
|
||||||
MatchPattern=git-runner_@v.root-%a.@u.raw.zst
|
MatchPattern=git-runner_@v.root-%a.@u.raw.zst
|
||||||
|
|
||||||
[Target]
|
[Target]
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ Verify=no
|
|||||||
|
|
||||||
[Source]
|
[Source]
|
||||||
Type=url-file
|
Type=url-file
|
||||||
Path=https://git.plabble.org/Job79/git-runner-mkosi/releases/download/latest/
|
Path=https://git.plabble.org/api/packages/Job79/generic/git-runner/latest/
|
||||||
MatchPattern=git-runner_@v.root-%a-verity.@u.raw.zst
|
MatchPattern=git-runner_@v.root-%a-verity.@u.raw.zst
|
||||||
|
|
||||||
[Target]
|
[Target]
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ Verify=no
|
|||||||
|
|
||||||
[Source]
|
[Source]
|
||||||
Type=url-file
|
Type=url-file
|
||||||
Path=https://git.plabble.org/Job79/git-runner-mkosi/releases/download/latest/
|
Path=https://git.plabble.org/api/packages/Job79/generic/git-runner/latest/
|
||||||
MatchPattern=git-runner_@v.efi
|
MatchPattern=git-runner_@v.efi
|
||||||
|
|
||||||
[Target]
|
[Target]
|
||||||
|
|||||||
Reference in new issue
Block a user