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>
@@ -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 C37
37
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.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 zijn40
## Archief41
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
```text45
https://gitlab.com/Timfa/bluegit/-/archive/<commit>/bluegit-<commit>.tar.gz46
```47
48
De publish-job haalt die tarball zonder token op en zet de sha256 in de PKGBUILD. `makepkg` gebruikt dezelfde URL.@@ -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 {@@ -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-${COMMI42
TMP_SOURCE="$WORKDIR/source.tar.gz"42
TMP_SOURCE="$WORKDIR/source.tar.gz"43
echo "Checking source tarball: $SOURCE_URL"43
echo "Checking source tarball: $SOURCE_URL"44
if ! curl -fsSL "$SOURCE_URL" -o "$TMP_SOURCE"; then44
if ! curl -fsSL "$SOURCE_URL" -o "$TMP_SOURCE"; then45
if [[ -n "${CI_JOB_TOKEN:-}" ]]; then45
echo "Could not download $SOURCE_URL" >&246
curl -fsSL --header "JOB-TOKEN: ${CI_JOB_TOKEN}" "$SOURCE_URL" -o "$TMP_SOURCE"46
exit 147
else48
echo "Could not download $SOURCE_URL" >&249
exit 150
fi51
fi47
fi52
SOURCE_SHA="$(sha256sum "$TMP_SOURCE" | awk '{print $1}')"48
SOURCE_SHA="$(sha256sum "$TMP_SOURCE" | awk '{print $1}')"53
49