Skip to content

fix: tenant selector in configure and false update banner#33

Merged
slashben merged 3 commits into
mainfrom
fix/configure-tenant-and-update-banner
May 18, 2026
Merged

fix: tenant selector in configure and false update banner#33
slashben merged 3 commits into
mainfrom
fix/configure-tenant-and-update-banner

Conversation

@slashben

@slashben slashben commented May 18, 2026

Copy link
Copy Markdown
Member

Summary

  • Configure tenant bug: Interactive armoctl configure only prompted for api-url (dashboard host), never api-base-url (API host). US tenant users got Unauthorized on every call because the EU default api.armosec.io was hardcoded. Replaced the raw URL field with a Tenant selector (EU / US / Custom). Custom reveals the raw URL fields for dev/staging overrides.
  • False update banner: Goreleaser strips the v prefix (0.0.11) but CDN latest.txt returns v0.0.11. semver.IsValid("0.0.11") → false → string comparison always differs → false "0.0.11 -> v0.0.11" banner. Added ensureVPrefix() normalization.

Test plan

  • armoctl configure → select US tenant → Whoami succeeds with US credentials
  • armoctl configure → select Custom → second form appears with URL fields pre-filled
  • armoctl configure → select EU → works as before
  • armoctl inventory list after US configure → no Unauthorized
  • No false update banner when binary version matches CDN version (with/without v prefix)
  • go test ./... passes

Summary by CodeRabbit

Release Notes

  • Documentation

    • Updated extension installation instructions for simplified setup process.
  • New Features

    • Added tenant selection during credential configuration with support for custom tenant setup.
  • Bug Fixes

    • Improved version comparison logic for more accurate update detection.

Review Change Stack

slashben added 2 commits May 4, 2026 23:28
The Gemini CLI install instructions were a vague one-liner pointing
at the Install section to install the binary manually first. With
v0.0.11 the SessionStart hook is portable across Claude Code and
Gemini CLI, so the binary auto-installs on the first session under
Gemini exactly as it does under Claude.

- Show the actual 'gemini extension install' command users should run.
- Note the GitHub-Releases-asset 404 fallthrough and the 'git clone'
  fallback prompt (matches what users see today and what the docs
  hub gemini-cli.md describes).
- State that the same SessionStart hook handles binary install and
  version pinning under Gemini — no manual install needed.
Signed-off-by: Ben <ben@armosec.io>
Two bugs:

1. Interactive configure only prompted for api-url (dashboard host) but
   never for api-base-url (the API host used by Whoami and every skill
   command). US tenant users were stuck with the EU default api.armosec.io
   and got Unauthorized on every call. Replace the raw URL text field with
   a Tenant selector (EU / US / Custom) that sets both hosts consistently.

2. Goreleaser strips the v prefix (Version = "0.0.11") but the CDN
   latest.txt contains "v0.0.11". semver.IsValid("0.0.11") returns false,
   falling through to string != which always differs, showing a false
   "0.0.11 -> v0.0.11" update notification. Normalize both versions with
   ensureVPrefix before comparison.
Signed-off-by: Ben <ben@armosec.io>
Copilot AI review requested due to automatic review settings May 18, 2026 19:53
@slashben slashben added the release Trigger release on merge label May 18, 2026
@coderabbitai

coderabbitai Bot commented May 18, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Free

Run ID: ecf9ca28-ea63-4b14-85f4-d6fec0e94daf

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR introduces tenant-aware credential configuration for interactive setup and normalizes version strings during update detection. It includes updates to README installation instructions, configuration handling with tenant-specific API endpoints, version comparison logic with prefix normalization, and supporting test coverage.

Changes

Configuration and Version Updates

Layer / File(s) Summary
Tenant-aware credential configuration
internal/config/config.go, README.md
Adds internal tenant data structures (tenant struct, built-in tenants list, label-matching helper) to the configuration module. Updates interactive credential prompting to select a tenant dropdown (built-in or custom), compute API endpoints from the chosen tenant, and persist the new APIBaseURL field. Refactors PromptAllCredentials to support custom API URL entry when "Custom" is selected. Updates credential guidance messaging and documents the new Gemini CLI extension installation process via gemini extension install with fallback and feature parity notes.
Version prefix normalization for update detection
internal/version/version.go, internal/version/version_test.go
Adds ensureVPrefix helper function to normalize version strings by prepending v when absent. Refactors CheckForUpdates to apply prefix normalization to both current and latest versions before semver validation and comparison. Adds test cases validating version comparison behavior when versions omit the leading v prefix, confirming that numeric-only versions are treated as equal and updates are detected when they differ.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A tenancy of configs blooms so fair,
With versions normalized with utmost care,
No leading v shall stumble updates hence,
Just gentle prompts and tenant preference! 🌟


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes two user-facing issues: interactive armoctl configure now correctly supports selecting the right tenant (EU/US) to set both api-base-url and api-url, and the update-check logic no longer reports a false update when the only difference is a missing/extra v prefix in version strings.

Changes:

  • Replace the interactive configure prompt’s raw API URL input with a Tenant selector (EU/US/Custom), with Custom prompting for both host fields.
  • Normalize version strings in the update checker via ensureVPrefix() and extend tests to cover v-prefix mismatches.
  • Update README Gemini CLI instructions with the concrete gemini extension install ... command and behavior notes.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
README.md Clarifies Gemini CLI extension installation flow and removes the “install binary first” implication.
internal/version/version.go Normalizes versions before semver comparison to avoid false update banners.
internal/version/version_test.go Adds coverage for v-prefix/no-prefix version combinations.
internal/config/config.go Adds tenant selection (EU/US/Custom) and ensures both API hosts are configured for the selected tenant.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/config/config.go Outdated
Address Copilot review: avoid duplicating default host literals.
Signed-off-by: Ben <ben@armosec.io>
@slashben slashben merged commit f888c11 into main May 18, 2026
4 checks passed
@slashben slashben deleted the fix/configure-tenant-and-update-banner branch May 18, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release Trigger release on merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants