Skip to content

Reject unsupported host platforms in the container build fallback - #239

Merged
JakeSCahill merged 1 commit into
mainfrom
fix/container-build-unsupported-platform
Jul 31, 2026
Merged

Reject unsupported host platforms in the container build fallback#239
JakeSCahill merged 1 commit into
mainfrom
fix/container-build-unsupported-platform

Conversation

@JakeSCahill

Copy link
Copy Markdown
Contributor

Suggestion 3 from @micheleRP's #238 review: the host-platform mapping sent win32 to linux, silently reproducing the wrong-binary bug class the cross-compile fix eliminated. Unsupported platforms now throw with a message naming --rpk-bin as the escape hatch. macOS and Linux behavior unchanged.

No version bump — intended to merge before #228 so the 5.3.1 publish carries it with the rest of the train.

Related PRs (rpk docs automation train)

Follow-up to #238.

…lback

#238 review suggestion: process.platform === 'darwin' ? 'darwin' :
'linux' silently handed a win32 host a linux binary, reproducing the
bug class the cross-compile fixed. Unsupported platforms now throw
with the --rpk-bin escape hatch named.
@netlify

netlify Bot commented Jul 31, 2026

Copy link
Copy Markdown

Deploy Preview for docs-extensions-and-macros ready!

Name Link
🔨 Latest commit 6f49911
🔍 Latest deploy log https://app.netlify.com/projects/docs-extensions-and-macros/deploys/6a6ce5e0ef970300081ac021
😎 Deploy Preview https://deploy-preview-239--docs-extensions-and-macros.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The container-based fallback build now checks the host platform before cross-compilation. macOS and Linux hosts continue through the existing path. Other hosts now receive an explicit error instead of being mapped to Linux. The error instructs users to update Go or provide an existing binary.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: rejecting unsupported host platforms in the container build fallback.
Description check ✅ Passed The description directly explains the platform-mapping fix, error behavior, unchanged platforms, and release intent.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/container-build-unsupported-platform

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tools/rpk-docs/rpk-docs-handler.js`:
- Around line 1389-1398: Move the host-platform validation in the `catch` block
to its beginning, before the Docker availability check and related fallback
handling. Ensure unsupported platforms always throw the platform-specific error
containing the `--rpk-bin` escape hatch, while supported macOS and Linux hosts
retain the existing Docker error behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 62fd974d-ba6a-4286-81af-a0700d133190

📥 Commits

Reviewing files that changed from the base of the PR and between 3fb86df and 6f49911.

📒 Files selected for processing (1)
  • tools/rpk-docs/rpk-docs-handler.js

Comment on lines +1389 to +1398
// Only macOS and Linux hosts are supported: mapping anything else to
// linux would hand a Windows host an unrunnable binary, the exact bug
// class the cross-compile fixes (review finding on #238).
if (process.platform !== 'darwin' && process.platform !== 'linux') {
throw new Error(
`${nativeErr.message}\n` +
`Container fallback does not support host platform "${process.platform}". ` +
'Update Go, or pass --rpk-bin <path> to use an existing rpk binary.'
)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Move the host-platform guard before the Docker check.

Line [1392] runs after the Docker availability check. If an unsupported host has no available Docker daemon, the function throws the earlier Docker error and does not identify the unsupported platform. Move this guard to the start of the catch block. This ensures that unsupported hosts always receive the platform-specific error and the --rpk-bin escape hatch.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tools/rpk-docs/rpk-docs-handler.js` around lines 1389 - 1398, Move the
host-platform validation in the `catch` block to its beginning, before the
Docker availability check and related fallback handling. Ensure unsupported
platforms always throw the platform-specific error containing the `--rpk-bin`
escape hatch, while supported macOS and Linux hosts retain the existing Docker
error behavior.

@micheleRP micheleRP left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. This is exactly suggestion 3 from the #238 review, implemented minimally: unsupported hosts throw instead of being mapped to linux, the original nativeErr message is preserved so the Go-version cause is not lost, and the error names --rpk-bin as the way forward. macOS and Linux paths are untouched.

Two nits, neither blocking:

  1. The check sits after console.warn('...building in a container...'), so a Windows user is told a container build is starting and then told the platform is unsupported. Moving the guard above that warn would avoid announcing work that never happens.
  2. No test. Stubbing process.platform is awkward enough that I would not insist, and the code is a three-line guard, so this is optional.

Sequencing: since this has no version bump, it needs to merge before #228 so the 5.3.1 publish carries it.

@JakeSCahill
JakeSCahill merged commit fa1c577 into main Jul 31, 2026
14 checks passed
@JakeSCahill
JakeSCahill deleted the fix/container-build-unsupported-platform branch July 31, 2026 19:15
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