Skip to content

ci: inline Alpine node setup to fix flaky linux-musl CI - #5455

Merged
jamescrosswell merged 2 commits into
mainfrom
fix/ci-alpine-setup-5408
Jul 29, 2026
Merged

ci: inline Alpine node setup to fix flaky linux-musl CI#5455
jamescrosswell merged 2 commits into
mainfrom
fix/ci-alpine-setup-5408

Conversation

@jamescrosswell

@jamescrosswell jamescrosswell commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

The linux-musl-arm64 "Initialize Alpine Linux" step has been failing on almost every push for the last few days (#5408). It piped a network-fetched script straight into a shell:

curl -sSL https://raw.githubusercontent.com/.../.github/alpine/setup-node.sh | sudo bash /dev/stdin

With no --fail/retry and a raw pipe, a rate-limited or truncated fetch got executed as-is, failing with line 2: syntax error near unexpected token 'newline'. It's non-deterministic — the same script passes and fails on adjacent commits.

Detailed explanation

GitHub's Actions runner has a hard limitation: JavaScript actions (like actions/checkout) inside Alpine containers are only supported on x64 Linux runners. On the linux-musl-arm64 job (Alpine on ARM), the runner normally refuses to run any JS action.

Our build.yml contained a workaround that runs before Checkout, because checkout is a JS action — it needs the workaround in place first.

run: |
  curl -sSL https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/.github/alpine/setup-node.sh | sudo bash /dev/stdin

This downloaded a script (setup-node.sh) from GitHub's raw CDN and piped it straight into sudo bash. That script contained:

if [ "$(uname -m)" != "x86_64" ]; then
    for node in /__e/node*; do
        mkdir -p $node/bin
        ln -s /usr/bin/node $node/bin/node
        ln -s /usr/bin/npm  $node/bin/npm
    done
    sed -i 's/ID=alpine/ID=unknown/' /usr/lib/os-release
fi

The downloading of the script is the bit that frequently fails - the script itself runs fine.

Solution

The solution is to move the logic that the downloaded script would have run directly into our build.yml file... to avoid the flaky download. So the build workflow does exactly the same thing as before, but without a flaky network dependency.

Issues

Fixes #5408

#skip-changelog

The "Initialize Alpine Linux" step piped a network-fetched script
(curl raw.githubusercontent.com | sudo bash) straight into a shell.
When the fetch was rate-limited or truncated, the partial/error body
was executed instead, failing with "syntax error near unexpected
token 'newline'". This flaked on almost every push.

The step runs before checkout (checkout is a JavaScript action that
needs node symlinked first), so the script can't be read from the
working tree. Inline it directly into the workflow instead, removing
the network dependency entirely. The now-unused setup-node.sh is
deleted.

Fixes #5408

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.70%. Comparing base (2f0203f) to head (d8fe83a).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5455      +/-   ##
==========================================
+ Coverage   74.68%   74.70%   +0.01%     
==========================================
  Files         512      512              
  Lines       18722    18722              
  Branches     3660     3660              
==========================================
+ Hits        13983    13986       +3     
+ Misses       3866     3864       -2     
+ Partials      873      872       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread .github/workflows/build.yml Outdated
Comment thread .github/workflows/build.yml Outdated
Co-authored-by: James Crosswell <jamescrosswell@users.noreply.github.com>
@jamescrosswell
jamescrosswell requested a review from jpnurmi July 28, 2026 23:00
@jamescrosswell
jamescrosswell marked this pull request as ready for review July 28, 2026 23:00
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Jul 28, 2026
@jamescrosswell
jamescrosswell merged commit cb7e1e3 into main Jul 29, 2026
41 checks passed
@jamescrosswell
jamescrosswell deleted the fix/ci-alpine-setup-5408 branch July 29, 2026 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI: flaky '.NET (linux-musl-arm64)' — 'Initialize Alpine Linux' curl|bash fails on transient raw.githubusercontent fetch

2 participants