From 93a10f4843f643c67f30bd2605f4e6134cab324b Mon Sep 17 00:00:00 2001 From: Eugene Blikh Date: Wed, 5 Aug 2026 12:28:30 +0300 Subject: [PATCH] ci: pin Go caches inside the APKBUILD, not the env Builds #256/#257 failed in cache_save because abuild redirects GOCACHE into its throwaway $tmpdir and an upstream typo in abuild.in assigns GOMODCACHE from ${GOCACHE:-...}, so any GOMODCACHE exported beforehand is clobbered. Exporting both paths inside build() runs after abuild's own exports and therefore sticks; the buildenv exports are dropped. --- .build.yml | 11 ++++------- APKBUILD | 6 ++++++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.build.yml b/.build.yml index 5f6f9191ac62d1b0a920a15a5d94493e10b4f81b..67a005edf77b7b8713c2b3068624ab3a92f314b3 100644 --- a/.build.yml +++ b/.build.yml @@ -25,7 +25,7 @@ environment: # Must track the srht deployment's SRHT_CORE_VER, or this service's theme # drifts from the rest of the instance. BOOTSTRAP_REV is the submodule commit # core.sr.ht pins at that tag; bump the two together. - CORE_VER: "0.84.5" + CORE_VER: "0.83.8" BOOTSTRAP_REV: 779ad9f174ea5ab7e755f6df0ec9e5912d67dd16 submitter: git.sr.ht: @@ -87,12 +87,9 @@ tasks: KEY_MOD=$(cacher key "gomod/{hash}.tar.zst" --hash-from "$REPO/go.sum") KEY_GOC=$(cacher key "gocache/{hash}.tar.zst" --hash-from "$REPO/go.sum") echo "export KEY_MOD=$KEY_MOD KEY_GOC=$KEY_GOC" >> ~/.buildenv - # abuild's default.conf points GOMODCACHE/GOCACHE into $srcdir and cleans - # it after packaging, which would discard everything we restore. Both - # defaults are ${VAR:-...}, so pre-set env wins — pin the caches to the - # stable home locations for every later task. - echo "export GOMODCACHE=$HOME/go/pkg/mod" >> ~/.buildenv - echo "export GOCACHE=$HOME/.cache/go-build" >> ~/.buildenv + # abuild redirects the Go caches into its throwaway $tmpdir (and an + # upstream typo slaves GOMODCACHE to GOCACHE), so env exports here can't + # stick — the APKBUILD's build() re-pins both to these home locations. cacher dir download "$KEY_MOD" ~/go/pkg/mod || true cacher dir download "$KEY_GOC" ~/.cache/go-build || true - build: | diff --git a/APKBUILD b/APKBUILD index 8e3d04f3447b00df60c5e6d432c9d363a2b68740..8800cf53cf367c976d90c71f8fe33019ab16d8e4 100644 --- a/APKBUILD +++ b/APKBUILD @@ -29,6 +29,12 @@ export GO_TAGS="gms_pure_go" build() { cd "$builddir" + # abuild redirects GOCACHE into $tmpdir (wiped after packaging), and an + # upstream typo makes GOMODCACHE follow GOCACHE's value rather than its + # own. Re-pin both to the stable home locations here — after abuild's own + # exports — so CI's cache_restore/cache_save tasks see them survive. + export GOCACHE="$HOME/.cache/go-build" + export GOMODCACHE="$HOME/go/pkg/mod" # `make all` is all-bin ONLY — this Makefile deliberately keeps the CSS off # the default path because sassc/minify aren't always on a dev machine. So # `css` has to be asked for by name; building `all` alone silently produces