Skip to content

ci: make nsgo's pinned downloads ready before nsgo build - #2720

Open
houko wants to merge 1 commit into
mainfrom
ci/prefetch-nsgo-downloads
Open

houko wants to merge 1 commit into
mainfrom
ci/prefetch-nsgo-downloads

Conversation

@houko

@houko houko commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Summary

nsgo build downloads the files it bundles by a pinned URL and SHA-256 (the AppImage runtimes for every Linux target with installers, Sparkle and WinSparkle when a project has updates). pinned.fetch in NSGo v0.4.0 (cmd/nsgo/updates.go, from line 252) uses a file already in os.UserCacheDir()/nsgo/downloads/<name>, and otherwise makes a single GET and fails the build on any answer but 200, with no retry. CI runners start with an empty cache, so every Linux build depended on one live request to GitHub's release storage.

Evidence: GitHub answered 618 for https://github.com/AppImage/type2-runtime/releases/download/20251108/runtime-x86_64 and failed jobs on pull requests that do not touch the build:

Changes:

  • .github/actions/nsgo-downloads, a composite action: restores nsgo's download directory from the Actions cache (key: runner OS and arch, the NSGo version in the given go.mod, the requested pins), runs prefetch.sh, and saves the cache right away on a miss, so a later failure in the job still keeps the files.
  • prefetch.sh keeps a file whose SHA-256 matches, fetches a missing one with curl --retry 6 --retry-all-errors (plain --retry treats HTTP errors such as 618 as permanent), verifies the SHA-256 and moves it to the name nsgo reads. It also checks each copied pin against the NSGo source of the version in use, so an NSGo update that moves a pin fails with the pin to change rather than falling back to nsgo's single request. nsgo verifies the SHA-256 again on read.
  • Called from every job whose build fetches a pin: coop2d-builds (linux_x64) in test.yml, release-build-tag in examples.yml, and each editor entry in release.yml (downloads matrix field: Sparkle on macOS, both AppImage runtimes on Linux, WinSparkle for Windows). quality.yml only builds Android, iOS and web, which fetch no pin. release.yml now also runs on pull requests that change the action.
  • Dependabot covers .github/actions/*, so the actions/cache pins there stay current like the workflows'.
  • Note: .agents/notes/implemented/process/2026-12-01-nsgo-pinned-downloads-ci.md.

The lasting fix belongs in NSGo (retry in pinned.fetch), which will be filed upstream separately.

Related issue

None; CI failures on unrelated pull requests, evidence above.

Verification

  • actionlint passes
  • shellcheck passes on prefetch.sh
  • prefetch.sh run locally against NSGo v0.4.0: fetched all four pins with matching SHA-256 into an empty directory, and a second run reported each as cached
  • bun run verify-notes passes
  • CI on this pull request runs the action in the coop2d, release build tag and release editor jobs

Screenshots

None (CI only).

nsgo build fetches the AppImage runtime (and Sparkle and WinSparkle when updates are on) with one GET and no retry, so a transient answer from GitHub's release storage (618 on 2026-11-30) failed the coop2d linux_x64 build and the release build tag check on unrelated pull requests. A composite action restores nsgo's download cache keyed on the NSGo version, fetches any missing pin with curl's retries, checks its SHA-256 and the pin against the NSGo source, and saves the cache at once.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/agents area/ci documentation Improvements or additions to documentation size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant