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
This commit is contained in:
1 parent
b0a49de3e6
commit
cdc4a84658
6 files changed
+21
-35
No files matched your search
+14
-18
@@ -35,24 +35,20 @@ jobs:
|
||||
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.
|
||||
# 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: |
|
||||
for f in $(awk '{print $2}' SHA256SUMS); do curl -fsS -o /dev/null -H "$AUTH" -F "attachment=@$f" "$RELEASE/assets?name=$f"; done
|
||||
old=$(curl -fsS -H "$AUTH" "$RELEASE/assets" | jq '.[] | select(.name == "SHA256SUMS") | .id')
|
||||
[ -z "$old" ] || curl -fsS -H "$AUTH" -X DELETE "$RELEASE/assets/$old"
|
||||
curl -fsS -o /dev/null -H "$AUTH" -F attachment=@SHA256SUMS "$RELEASE/assets?name=SHA256SUMS"
|
||||
- name: Remove older versions
|
||||
working-directory: mkosi.output
|
||||
run: |
|
||||
curl -fsS -H "$AUTH" "$RELEASE/assets" | jq -r '.[] | "\(.id) \(.name)"' | grep ' git-runner_' |
|
||||
grep -vFf <(awk '{print " " $2}' SHA256SUMS) | while read -r id name; do curl -fsS -H "$AUTH" -X DELETE "$RELEASE/assets/$id"; done
|
||||
- name: Publish the disk image
|
||||
if: github.event_name != 'push'
|
||||
working-directory: mkosi.output
|
||||
run: |
|
||||
qemu-img convert -c -O qcow2 "$(basename git-runner_*.efi .efi).raw" git-runner.qcow2
|
||||
old=$(curl -fsS -H "$AUTH" "$RELEASE/assets" | jq '.[] | select(.name == "git-runner.qcow2") | .id')
|
||||
[ -z "$old" ] || curl -fsS -H "$AUTH" -X DELETE "$RELEASE/assets/$old"
|
||||
curl -fsS -o /dev/null -H "$AUTH" -F attachment=@git-runner.qcow2 "$RELEASE/assets?name=git-runner.qcow2"
|
||||
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
|
||||
Reference in new issue
Block a user