Skip to content

fix ARCH detection and normalization#8658

Open
mubix wants to merge 2 commits intomakeplane:previewfrom
mubix:preview
Open

fix ARCH detection and normalization#8658
mubix wants to merge 2 commits intomakeplane:previewfrom
mubix:preview

Conversation

@mubix
Copy link

@mubix mubix commented Feb 24, 2026

Description

Fixes two bugs in the community self-hosted install script (deployments/cli/community/install.sh) that cause installation to fail on x86_64 systems:

Bug 1: checkLatestRelease failure not caught by parent script

When checkLatestRelease() fails (e.g., due to GitHub API rate limiting or no network access), it calls exit 1 — but because it runs inside a $(...) command substitution, that exit only terminates the subshell, not the parent script. The result is APP_RELEASE gets set to an empty string, which cascades into a broken docker manifest inspect call (invalid reference format) and eventually an offer to build images locally against a blank release tag.

Fix: Added a guard after the command substitution to check for an empty APP_RELEASE and exit cleanly with a clear error message.

Bug 2: UPPER_CPU_ARCH set before CPU architecture normalization

UPPER_CPU_ARCH is derived from CPU_ARCH at the top of the script, where uname -m returns the raw value (e.g., x86_64). The normalization block that maps x86_64amd64 and aarch64arm64 runs later near the bottom of the script, but UPPER_CPU_ARCH is never recalculated. This causes:

  • The docker manifest inspect grep to search for x86_64 instead of amd64, which never matches since Docker manifests use amd64
  • User-facing messages to display X86_64 instead of the correct AMD64

Fix: Moved the UPPER_CPU_ARCH assignment to after the normalization block so it reflects the corrected architecture name.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Screenshots and Media (if applicable)

Before (x86_64 system):

--------------------------------------------
 ____  _                          /////////
|  _ \| | __ _ _ __   ___         /////////
| |_) | |/ _` | '_ \ / _ \   /////    /////
|  __/| | (_| | | | |  __/   /////    /////
|_|   |_|\__,_|_| |_|\___|        ////
                                  ////
--------------------------------------------
Project management tool from the future
--------------------------------------------

Select a Action you want to perform:
   1) Install
   2) Start
   3) Stop
   4) Restart
   5) Upgrade
   6) View Logs
   7) Backup Data
   8) Exit

Action [2]: 1

Begin Installing Plane

Checking for the latest release...
Failed to check for the latest release. Exiting...
Please wait while we check the availability of Docker images for the selected release () with X86_64 support. [|]  invalid reference format



X86_64 images are not available for selected release ().

Do you want to continue with building the Docker images locally?
Continue? [y/N]:

Summary by CodeRabbit

  • Bug Fixes
    • Added checks to stop and report when the latest stable release cannot be resolved, preventing incorrect install/upgrade attempts.
    • Improved CPU architecture detection and normalization so installations use consistent architecture names and messages across install and upgrade flows.
@CLAassistant
Copy link

CLAassistant commented Feb 24, 2026

CLA assistant check
All committers have signed the CLA.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 24, 2026

📝 Walkthrough

Walkthrough

Added defensive checks for empty release lookups and normalized CPU architecture identifiers (x86_64/amd64 → amd64, aarch64/arm64 → arm64); UPPER_CPU_ARCH computation moved after normalization and normalization blocks added in multiple script locations for consistency.

Changes

Cohort / File(s) Summary
Release & Architecture Handling
deployments/cli/community/install.sh
Added checks ensuring resolved release variables are non-empty before proceeding (install and upgrade paths). Normalized CPU architecture values to Docker manifest names (x86_64/amd64 → amd64; aarch64/arm64 → arm64), moved/computed UPPER_CPU_ARCH after normalization, and duplicated normalization near top-level and after environment/setup to ensure consistent messages and behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 I nibble on scripts in the pale moonlight,
I tidy arch names so containers sleep tight.
If a release is missing, I loudly declare,
"Exit with a code, don't leave folks in despair!"
Hopping off now — stable builds, take flight. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix ARCH detection and normalization' directly and specifically summarizes the main changes—addressing CPU architecture detection and normalization issues in the install script.
Description check ✅ Passed The PR description comprehensively covers all template sections: detailed description of both bugs and fixes, correct type of change marked, before/after screenshots provided, and the description is well-structured and specific.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

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 the current code and only fix it if needed.

Inline comments:
In `@deployments/cli/community/install.sh`:
- Around line 218-223: The upgrade() flow still assigns APP_RELEASE via command
substitution without checking for empty results, so a failed checkLatestRelease
can propagate an empty tag; update upgrade() to call checkLatestRelease into
APP_RELEASE (or a temp var) and validate it's non-empty before proceeding,
logging an error and exiting (similar to the install path) if the release lookup
failed; reference the upgrade() function and the checkLatestRelease/APP_RELEASE
symbols when making the change.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9425c66 and 89e19f3.

📒 Files selected for processing (1)
  • deployments/cli/community/install.sh
Add error handling for missing latest release in upgrade function.
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
deployments/cli/community/install.sh (1)

430-434: SC2155 on Line 430 still present — split declaration and assignment.

The guard on lines 431-434 correctly catches the empty string, so this is functionally safe. However, local latest_release=$(checkLatestRelease) still masks the subshell's exit code because local always exits 0 (SC2155). The past review's suggested fix included splitting this into two statements:

🔧 Suggested fix
-    local latest_release=$(checkLatestRelease)
+    local latest_release
+    latest_release=$(checkLatestRelease)
     if [ -z "$latest_release" ]; then
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@deployments/cli/community/install.sh` around lines 430 - 434, Split the
`local latest_release=$(checkLatestRelease)` into two statements so the subshell
exit status isn't masked: first declare the variable with `local
latest_release`, then assign it with `latest_release=$(checkLatestRelease)` and
keep the existing guard that checks `-z "$latest_release"`. Update the usage in
this block (the variable `latest_release` and the call to `checkLatestRelease`)
only — do not change the guard logic that exits on empty value.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@deployments/cli/community/install.sh`:
- Around line 430-434: Split the `local latest_release=$(checkLatestRelease)`
into two statements so the subshell exit status isn't masked: first declare the
variable with `local latest_release`, then assign it with
`latest_release=$(checkLatestRelease)` and keep the existing guard that checks
`-z "$latest_release"`. Update the usage in this block (the variable
`latest_release` and the call to `checkLatestRelease`) only — do not change the
guard logic that exits on empty value.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 89e19f3 and 08e20be.

📒 Files selected for processing (1)
  • deployments/cli/community/install.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants