Skip to content

Commit 825418c

Browse files
committed
fix(update-index): remove cross-job artifact, commit-index re-downloads digests
The prepared-index artifact upload/download between prepare and commit-index was hitting transient Azure blob storage failures (5-retry timeout). The computed index is deterministic given the same digest inputs, so commit-index can re-download the digest artifacts from the triggering build run directly and rerun update-index.py without any cross-job artifact transfer. prepare is now lightweight: only downloads digests to build the e2e matrix. Assisted-by: Claude Sonnet 4.6 via OpenCode
1 parent bd3429c commit 825418c

File tree

1 file changed

+50
-64
lines changed

1 file changed

+50
-64
lines changed

.github/workflows/update-index.yml

Lines changed: 50 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ name: Sync Flatpak Remote Index
99
#
1010
# The gh-pages index is only committed AFTER e2e-install passes.
1111
# This prevents the index from pointing at a broken image that cannot be installed.
12+
#
13+
# commit-index re-downloads the digest artifacts from the triggering build run
14+
# and reruns update-index.py — deterministic, no cross-job artifact needed.
1215

1316
on:
1417
workflow_run:
@@ -19,10 +22,9 @@ on:
1922
permissions: {}
2023

2124
jobs:
22-
# ── Prepare: build updated index content and derive e2e matrix ────────────
23-
# Downloads per-arch digest artifacts from the triggering build run,
24-
# runs update-index.py against ghcr.io, and uploads the result as an artifact.
25-
# Does NOT commit to gh-pages yet — that happens only after e2e-install passes.
25+
# ── Prepare: derive e2e matrix from digest artifacts ─────────────────────
26+
# Downloads per-arch digest artifacts from the triggering build run and
27+
# builds the matrix for e2e-install. Does NOT touch gh-pages.
2628
prepare:
2729
if: >-
2830
github.event.workflow_run.conclusion == 'success' &&
@@ -31,22 +33,11 @@ jobs:
3133
github.event.workflow_run.event == 'workflow_dispatch')
3234
runs-on: ubuntu-24.04
3335
permissions:
34-
contents: read
35-
packages: read
3636
actions: read
3737
outputs:
3838
matrix: ${{ steps.matrix.outputs.matrix }}
3939
has_entries: ${{ steps.matrix.outputs.has_entries }}
4040
steps:
41-
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
42-
with:
43-
path: main
44-
45-
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
46-
with:
47-
ref: gh-pages
48-
path: pages
49-
5041
- name: Download all digest artifacts from triggering run
5142
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
5243
with:
@@ -55,48 +46,6 @@ jobs:
5546
run-id: ${{ github.event.workflow_run.id }}
5647
github-token: ${{ secrets.GITHUB_TOKEN }}
5748

58-
- name: Login to ghcr.io for skopeo inspect
59-
run: |
60-
# update-index.py calls skopeo inspect against ghcr.io.
61-
# Login required even for public packages to avoid rate limiting and
62-
# to handle the window before the package is set public after first push.
63-
echo "${{ secrets.GITHUB_TOKEN }}" | \
64-
skopeo login ghcr.io -u "${{ github.repository_owner }}" --password-stdin
65-
66-
- name: Sync gh-pages before writing
67-
run: |
68-
cd pages
69-
git fetch origin gh-pages && git rebase origin/gh-pages
70-
71-
- name: Update index for each app and arch
72-
run: |
73-
cd pages
74-
shopt -s nullglob
75-
for DIGEST_FILE in /tmp/digests/digest-*/digest.txt; do
76-
# Extract app and arch from the artifact directory name: digest-<app>-<arch>
77-
DIR=$(basename "$(dirname "${DIGEST_FILE}")")
78-
# Strip leading "digest-" prefix, then split on the last "-" to get arch
79-
REST="${DIR#digest-}"
80-
ARCH="${REST##*-}"
81-
APP="${REST%-${ARCH}}"
82-
APP="${APP,,}"
83-
DIGEST=$(cat "${DIGEST_FILE}")
84-
echo "==> Updating index: ${APP} ${ARCH} ${DIGEST}"
85-
python3 ../main/scripts/update-index.py \
86-
--app "${APP}" \
87-
--digest "${DIGEST}" \
88-
--registry ghcr.io \
89-
--repo "${{ github.repository }}/${APP}" \
90-
--tags "latest"
91-
done
92-
93-
- name: Upload prepared index as artifact
94-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
95-
with:
96-
name: prepared-index-${{ github.run_id }}
97-
path: pages/index/static
98-
retention-days: 1
99-
10049
- name: Build app+arch matrix from digest artifacts
10150
id: matrix
10251
run: |
@@ -163,7 +112,8 @@ jobs:
163112
164113
# ── Commit index to gh-pages ──────────────────────────────────────────────
165114
# Only runs after e2e-install passes — the gate is enforced by needs: [e2e-install].
166-
# Downloads the prepared index artifact from the prepare job and commits it.
115+
# Re-downloads digest artifacts from the triggering build run and reruns
116+
# update-index.py — deterministic, no cross-job artifact transfer needed.
167117
# Serialised via concurrency group to prevent races between concurrent builds.
168118
commit-index:
169119
needs: [prepare, e2e-install]
@@ -174,26 +124,62 @@ jobs:
174124
runs-on: ubuntu-24.04
175125
permissions:
176126
contents: write
127+
packages: read
177128
actions: read
178129
concurrency:
179130
group: gh-pages-update
180131
cancel-in-progress: false
181132
steps:
182133
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
183134
with:
184-
ref: gh-pages
135+
path: main
185136

186-
- name: Sync gh-pages before writing
187-
run: git fetch origin gh-pages && git rebase origin/gh-pages
137+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
138+
with:
139+
ref: gh-pages
140+
path: pages
188141

189-
- name: Download prepared index artifact
142+
- name: Download all digest artifacts from triggering run
190143
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
191144
with:
192-
name: prepared-index-${{ github.run_id }}
193-
path: index/static
145+
pattern: digest-*
146+
path: /tmp/digests
147+
run-id: ${{ github.event.workflow_run.id }}
148+
github-token: ${{ secrets.GITHUB_TOKEN }}
149+
150+
- name: Login to ghcr.io for skopeo inspect
151+
run: |
152+
echo "${{ secrets.GITHUB_TOKEN }}" | \
153+
skopeo login ghcr.io -u "${{ github.repository_owner }}" --password-stdin
154+
155+
- name: Sync gh-pages before writing
156+
run: |
157+
cd pages
158+
git fetch origin gh-pages && git rebase origin/gh-pages
159+
160+
- name: Update index for each app and arch
161+
run: |
162+
cd pages
163+
shopt -s nullglob
164+
for DIGEST_FILE in /tmp/digests/digest-*/digest.txt; do
165+
DIR=$(basename "$(dirname "${DIGEST_FILE}")")
166+
REST="${DIR#digest-}"
167+
ARCH="${REST##*-}"
168+
APP="${REST%-${ARCH}}"
169+
APP="${APP,,}"
170+
DIGEST=$(cat "${DIGEST_FILE}")
171+
echo "==> Updating index: ${APP} ${ARCH} ${DIGEST}"
172+
python3 ../main/scripts/update-index.py \
173+
--app "${APP}" \
174+
--digest "${DIGEST}" \
175+
--registry ghcr.io \
176+
--repo "${{ github.repository }}/${APP}" \
177+
--tags "latest"
178+
done
194179
195180
- name: Commit and push index
196181
run: |
182+
cd pages
197183
git config user.name "github-actions[bot]"
198184
git config user.email "github-actions[bot]@users.noreply.github.com"
199185
git add index/static

0 commit comments

Comments
 (0)