Skip to content

scripts/helm-docs.sh: detect CPU architecture on every OS - #952

Merged
marcleblanc2 merged 1 commit into
mainfrom
marc/helm-docs-arch-detection
Sep 29, 2026
Merged

marcleblanc2 merged 1 commit into
mainfrom
marc/helm-docs-arch-detection

Conversation

@marcleblanc2

Copy link
Copy Markdown
Contributor

scripts/helm-docs.sh hardcoded arch=x86_64 on macOS, so on Apple Silicon it downloads an amd64 binary and fails:

target/bin/helm-docs-1.7.0: Bad CPU type in executable

Two more latent bugs in the same block: the Linux amd64 branch pointed at helm-docs_1.7.0_linux_amd64.tar.gz, which is not a published asset (they are x86_64), and Linux arm64 hosts report aarch64 from uname -m, which the arm) branch never matched.

This replaces the per-OS blocks with one uname -s case for the OS and one uname -m case for the architecture, mapped to the release asset names (Darwin_arm64, Linux_x86_64, ...). Unsupported combinations exit 126 with the offending value instead of a generic message. The pinned version stays at 1.7.0 so generated READMEs do not churn.

Test plan

  • On an M-series Mac: rm -rf target && ./scripts/helm-docs.sh downloads Mach-O 64-bit executable arm64 and regenerates all four chart READMEs with no diff (the AGENTS.md check).
  • curl -I confirms Darwin_x86_64, Darwin_arm64, Linux_x86_64, Linux_arm64 assets exist for v1.7.0 and linux_amd64 returns 404.

The script hardcoded x86_64 on macOS, so Apple Silicon machines downloaded
an amd64 binary that fails with "Bad CPU type in executable". On Linux the
amd64 branch pointed at a release asset that does not exist, and arm64 hosts
report aarch64, which the script never matched. Map uname -m to the helm-docs
release asset names for all supported OSes.

Amp-Thread-ID: https://ampcode.com/threads/T-01a0e96e-01bb-762e-a752-d2a3103593f0
Co-authored-by: Amp <amp@ampcode.com>
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

@marcleblanc2
marcleblanc2 requested a review from a team September 29, 2026 22:07
@marcleblanc2
marcleblanc2 enabled auto-merge (squash) September 29, 2026 22:07
@marcleblanc2
marcleblanc2 merged commit 09e488f into main Sep 29, 2026
6 checks passed
@marcleblanc2
marcleblanc2 deleted the marc/helm-docs-arch-detection branch September 29, 2026 22:08
marcleblanc2 added a commit that referenced this pull request Sep 30, 2026
Bumps the pinned helm-docs in `scripts/helm-docs.sh` from 1.7.0 (Feb 2022) to 1.14.2, the [latest release](https://github.com/norwoodj/helm-docs/releases/tag/v1.14.2) (Jul 2024). Follows #952.

## Test plan

- Apple Silicon: `rm -rf target && ./scripts/helm-docs.sh` downloads `Mach-O 64-bit executable arm64`, `target/bin/helm-docs-1.14.2
--version` prints `helm-docs version 1.14.2`
- After committing the regenerated READMEs, `./scripts/helm-docs.sh && [[ -z $(git status -s) ]]` (the `AGENTS.md` check) passes

Co-authored-by: Amp <amp@ampcode.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants