Repository navigation
Fix md5srv HIL job failing with HTTP 403 while installing Bats - #257
Closed
zakoverflow wants to merge 2 commits into
Closed
zakoverflow wants to merge 2 commits into
zakoverflow wants to merge 2 commits into
Conversation
- The md5srv-test job (the first job of the nightly card.binary HIL workflow) failed in "Setup Bats and bats libs" with "curl: (22) The requested URL returned error: 403". The card.binary hardware job needs md5srv-test, so it was skipped. - The workflow does not pass bats-version to bats-core/bats-action, so the action looks up the latest Bats release through api.github.com/repos/bats-core/bats-core/releases/latest. The BATS_VERSION env var in this workflow is not read by the action. - bats-action 3.0.0 makes that lookup without a token. Unauthenticated API calls share a 60 requests/hour limit per source IP, and GitHub answers with 403 once the limit is used up. curl -f hides the response body, so the log can't confirm the reason, but this is the likely one. - bats-action 3.0.1 sends the job's GITHUB_TOKEN with the lookup and the tarball download. That is the upstream fix for this lookup. Bump to 3.0.1. No other change: same inputs, same Bats version resolution, same libraries. - Checked locally: actionlint reports no issues in md5srv-tests.yml, and the 3.0.1 install logic resolves and installs Bats v1.14.0, after which the md5srv bats suite passes (14 tests, 0 failures).
- Pass bats-version: 1.14.0 to bats-core/bats-action. With an explicit version the action skips its api.github.com releases/latest lookup, so the install no longer depends on GitHub API rate limits at all. - 1.14.0 is the version the nightly has been installing as "latest", so this does not change which Bats the tests run on. - Remove the BATS_VERSION: 1.10.0 env var. The action never read it, and its value did not match the Bats version actually in use. - Keep bats-action 3.0.1. Its token on the tarball download stays as defense in depth.
Contributor
Author
|
Dev Lead review (sign-off) for
Signed off. Ready for a maintainer to merge. |
7 of 8 tasks
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The nightly
note-c card.binary HIL testsrun on 2026-10-08 failed in its first job,md5srv-test / test-md5srv, at Setup Bats and bats libs. Becausenotecard-binary-testhasneeds: md5srv-test, the hardware job was skipped.Run: https://github.com/blues/note-c/actions/runs/37747611386
Root cause
md5srv-tests.ymlnever passedbats-versiontobats-core/bats-action. TheBATS_VERSION: 1.10.0env var in that workflow is not an action input, so the actionnever read it. Every run looked up the "latest" release through the GitHub REST API at
api.github.com/.../releases/latest. The 2026-10-07 run, for example, installedBats v1.14.0.
bats-action@3.0.0makes that API call without a token. Unauthenticated REST calls sharea 60 requests/hour budget per source IP, and hosted runners share IPs.
curl -fdropsthe response body, so the log can't prove the 403 was a rate limit. It's the most likely
cause.
Change
.github/workflows/md5srv-tests.ymlonly:env: TERM: xterm-256color MD5SRV_TIMEOUT: 5 MD5SRV_DIR: ./test/hitl/scripts - BATS_VERSION: 1.10.0 steps: - name: Setup Bats and bats libs id: setup-bats - uses: bats-core/bats-action@3.0.0 + uses: bats-core/bats-action@3.0.1 with: bats-install: true + bats-version: 1.14.0 file-install: false detik-install: falsebats-version, the action skips thereleases/latestlookup entirely and fetches only the tag tarball. So the fix no longerdepends on the rate-limit theory: the failing call is simply never made. 1.14.0 is the
version the nightly has been installing as "latest", so the tests run on the same Bats
as before.
BATS_VERSION: 1.10.0. Nothing read it, and its value didn't match the Batsversion actually in use.
bats-action3.0.0 → 3.0.1 (patch release; upstream pin github action hash and add scorecard workflow and fix the issue with latest version bats-core/bats-action#24).3.0.1 sends the job's
GITHUB_TOKENwith the Bats tarball download (and with thereleases/latestlookup, which the pin now skips). That token stays as defense in depthfor the tarball download. The bats-support and bats-assert tarballs are still fetched
without a token, the same as before. The tag pin follows this repo's existing convention.
Verification
actionlint1.7.12 reports no errors onmd5srv-tests.yml. With shellcheck enabled,the only finding is an info-level SC2086 on the existing, unchanged "Re-run Tests"
step. It shows up identically on
master.md5srv-tests.ymlunchanged in a scratch push-triggered workflowon my fork. It used a fresh branch with no cache entry for
Linux-X64-bats-1.14.0, sothe install really ran. No secrets, no hardware, and no Notehub or Notestation access.
https://github.com/zakoverflow/note-c/actions/runs/37817746692
with: bats-version: 1.14.0→VERSION=1.14.0, so thereleases/latestbranch isskipped.
Cache not found for input keys: Linux-X64-bats-1.14.0Bats v1.14.0 installed in /home/runner/.local/share/bats14 tests, 0 failurescurlshim.The only URLs requested were the three tag tarballs (
bats-core/.../v1.14.0.tar.gz,bats-support/.../v0.3.0.tar.gz,bats-assert/.../v2.1.0.tar.gz). There was noapi.github.comcall.Not verified here: a real run on blues/note-c. A
workflow_dispatchor the next nightlyis the final check for the
md5srv-testjob.Known follow-up (not fixed by this PR)
Cache hit for: <key>and thenFailed to restore: Cache not found for input keys: <key>. On blues/note-c this happensevery night for
Linux-X64-bats-, so the install runs every time. I saw the same patternon my fork (
Linux-X64-bats-assert-2.1.0in the run above), so it doesn't look specificto this repo's cache. Cause unknown. With the pin, a failed restore only means an extra
tarball download.