BlueGit

timfa bluegit

fix: haal de token-fallback uit de AUR-publicatie

Het archief is anoniem te downloaden, dus de publish-job en makepkg gebruiken dezelfde URL.

Co-authored-by: tim <tim@timfalken.com>

timfa project_87923614_bot_3aff574f6f98414b945a8799374f9092 · pushed by timfa

Authored 2026-10-22 · 3 weeks ago

Hash
bdc4d1c5ec8b4953896e8ff53c01e8dd4019740e
Parent
f64ec713
Pipeline
Failed
3 files changed +17 −8
docs/AUR.md +8 −2
@@ -37,6 +37,12 @@ Eén van de twee sleutelvariabelen is genoeg. `scripts/aur-ssh-setup.sh` haalt C
37 37
38 38 De job heet `publish:aur` in `.gitlab-ci.yml` en `publish_aur` in `blue-ci-cd.yml`. Beide draaien alleen op `master` (BlueGit ook op `main`) en hebben `allow_failure: true`, zodat een storing bij de AUR de rest van de pipeline niet rood maakt.
39 39
40 ## Archief moet leesbaar zijn
40 ## Archief
41 41
42 Het project is nog privé. Een anonieme aanvraag van het archief komt uit op de aanmeldpagina, niet op de tarball. De publish-job valt daarom terug op `CI_JOB_TOKEN` om de hash te zetten. Een AUR-gebruiker die `makepkg` draait heeft die token niet. Het project moet publiek zijn voordat een installatie vanaf de AUR slaagt.
42 Het archief is anoniem te downloaden:
43
44 ```text
45 https://gitlab.com/Timfa/bluegit/-/archive/<commit>/bluegit-<commit>.tar.gz
46 ```
47
48 De publish-job haalt die tarball zonder token op en zet de sha256 in de PKGBUILD. `makepkg` gebruikt dezelfde URL.
@@ -37,6 +37,12 @@ Eén van de twee sleutelvariabelen is genoeg. `scripts/aur-ssh-setup.sh` haalt C
37
37
38De job heet `publish:aur` in `.gitlab-ci.yml` en `publish_aur` in `blue-ci-cd.yml`. Beide draaien alleen op `master` (BlueGit ook op `main`) en hebben `allow_failure: true`, zodat een storing bij de AUR de rest van de pipeline niet rood maakt.
38De job heet `publish:aur` in `.gitlab-ci.yml` en `publish_aur` in `blue-ci-cd.yml`. Beide draaien alleen op `master` (BlueGit ook op `main`) en hebben `allow_failure: true`, zodat een storing bij de AUR de rest van de pipeline niet rood maakt.
39
39
40## Archief moet leesbaar zijn
40## Archief
41
41
42Het project is nog privé. Een anonieme aanvraag van het archief komt uit op de aanmeldpagina, niet op de tarball. De publish-job valt daarom terug op `CI_JOB_TOKEN` om de hash te zetten. Een AUR-gebruiker die `makepkg` draait heeft die token niet. Het project moet publiek zijn voordat een installatie vanaf de AUR slaagt.
42Het archief is anoniem te downloaden:
43
44```text
45https://gitlab.com/Timfa/bluegit/-/archive/<commit>/bluegit-<commit>.tar.gz
46```
47
48De publish-job haalt die tarball zonder token op en zet de sha256 in de PKGBUILD. `makepkg` gebruikt dezelfde URL.
scripts/aur_test.go +7 −0
@@ -16,6 +16,13 @@ func TestRewritePkgbuild(t *testing.T) {
16 16 t.Fatalf("%s: %v %s", name, err, out)
17 17 }
18 18 }
19 publish, err := os.ReadFile(filepath.Join(root, "scripts", "publish-aur.sh"))
20 if err != nil {
21 t.Fatal(err)
22 }
23 if strings.Contains(string(publish), "CI_JOB_TOKEN") || strings.Contains(string(publish), "JOB-TOKEN") {
24 t.Fatal("het archief hoort anoniem opgehaald te worden")
25 }
19 26 dir := t.TempDir()
20 27 src, err := os.ReadFile(filepath.Join(root, "packaging", "aur", "PKGBUILD"))
21 28 if err != nil {
@@ -16,6 +16,13 @@ func TestRewritePkgbuild(t *testing.T) {
16 t.Fatalf("%s: %v %s", name, err, out)
16 t.Fatalf("%s: %v %s", name, err, out)
17 }
17 }
18 }
18 }
19 publish, err := os.ReadFile(filepath.Join(root, "scripts", "publish-aur.sh"))
20 if err != nil {
21 t.Fatal(err)
22 }
23 if strings.Contains(string(publish), "CI_JOB_TOKEN") || strings.Contains(string(publish), "JOB-TOKEN") {
24 t.Fatal("het archief hoort anoniem opgehaald te worden")
25 }
19 dir := t.TempDir()
26 dir := t.TempDir()
20 src, err := os.ReadFile(filepath.Join(root, "packaging", "aur", "PKGBUILD"))
27 src, err := os.ReadFile(filepath.Join(root, "packaging", "aur", "PKGBUILD"))
21 if err != nil {
28 if err != nil {
scripts/publish-aur.sh +2 −6
@@ -42,12 +42,8 @@ SOURCE_URL="https://gitlab.com/Timfa/bluegit/-/archive/${COMMIT}/bluegit-${COMMI
42 42 TMP_SOURCE="$WORKDIR/source.tar.gz"
43 43 echo "Checking source tarball: $SOURCE_URL"
44 44 if ! curl -fsSL "$SOURCE_URL" -o "$TMP_SOURCE"; then
45 if [[ -n "${CI_JOB_TOKEN:-}" ]]; then
46 curl -fsSL --header "JOB-TOKEN: ${CI_JOB_TOKEN}" "$SOURCE_URL" -o "$TMP_SOURCE"
47 else
48 echo "Could not download $SOURCE_URL" >&2
49 exit 1
50 fi
45 echo "Could not download $SOURCE_URL" >&2
46 exit 1
51 47 fi
52 48 SOURCE_SHA="$(sha256sum "$TMP_SOURCE" | awk '{print $1}')"
53 49
@@ -42,12 +42,8 @@ SOURCE_URL="https://gitlab.com/Timfa/bluegit/-/archive/${COMMIT}/bluegit-${COMMI
42TMP_SOURCE="$WORKDIR/source.tar.gz"
42TMP_SOURCE="$WORKDIR/source.tar.gz"
43echo "Checking source tarball: $SOURCE_URL"
43echo "Checking source tarball: $SOURCE_URL"
44if ! curl -fsSL "$SOURCE_URL" -o "$TMP_SOURCE"; then
44if ! curl -fsSL "$SOURCE_URL" -o "$TMP_SOURCE"; then
45 if [[ -n "${CI_JOB_TOKEN:-}" ]]; then
45 echo "Could not download $SOURCE_URL" >&2
46 curl -fsSL --header "JOB-TOKEN: ${CI_JOB_TOKEN}" "$SOURCE_URL" -o "$TMP_SOURCE"
46 exit 1
47 else
48 echo "Could not download $SOURCE_URL" >&2
49 exit 1
50 fi
51fi
47fi
52SOURCE_SHA="$(sha256sum "$TMP_SOURCE" | awk '{print $1}')"
48SOURCE_SHA="$(sha256sum "$TMP_SOURCE" | awk '{print $1}')"
53
49