Skip to content

feat(ssh): add --instance option to target a running instance by ID - #1123

Open
mehdi653 wants to merge 1 commit into
CleverCloud:masterfrom
mehdi653:feat/ssh-instance-option
Open

feat(ssh): add --instance option to target a running instance by ID#1123
mehdi653 wants to merge 1 commit into
CleverCloud:masterfrom
mehdi653:feat/ssh-instance-option

Conversation

@mehdi653

@mehdi653 mehdi653 commented Aug 12, 2026

Copy link
Copy Markdown

Summary

When several instances are running, clever ssh currently requires an interactive prompt and fails in non-interactive mode. This adds --instance instance-id so users and scripts can target a specific running instance without a prompt.

Instance IDs are used rather than instance numbers, which are not stable across deployments (per hsablonniere feedback on #1067). Support for number / any / all selection is left for a follow-up (judu).

Fixes #1067

Change

  • Add --instance instance-id option to clever ssh
  • When set, select that running instance and skip the interactive prompt
  • When the ID does not match a running instance of the app, fail with a clear error
  • Update ssh docs and generated skill reference

Spec notes

  • Selection key is the Clever Cloud instance ID (not the ephemeral instance number)
  • Existing behavior is unchanged when --instance is omitted (single instance auto-select, multi-instance TTY prompt, non-TTY failure)
  • Works with -c / --command for non-interactive one-shot commands

Test plan

  • run validate on this branch
  • valid instance id connects without prompt
  • bogus instance id fails with a clear error
  • multi-instance non-TTY with option succeeds
  • multi-instance non-TTY without option still fails as before

E2E results (2026-08-13)

Tested against a real Clever Cloud Node app with the local CLI from this PR checkout (HOME/.local/bin clever, which exposes --instance).

App: ssh-instance-e2e-1123 (app_99596987-df36-4925-8bab-26f50b2e1ba5), scaled to 2 instances, dedicated ed25519 key registered on the account.

  1. Valid instance id, agent disabled, remote echo:
    -> OK, exit 0, no prompt
  2. Bogus instance id:
    -> clear error: Instance bogus is not a running instance of this application, exit 1
  3. Non-TTY multi-instance WITH --instance (stdin closed) on the second instance id:
    -> OK, exit 0
  4. Non-TTY multi-instance WITHOUT --instance:
    -> clear error: Multiple instances are running. Cannot select in non-interactive mode., exit 1

Also: validate passed on 5898785 (lint, prettier, typecheck, docs:check). Working tree clean; no docs rewrite and no force-push needed.

Test app and temporary SSH key were deleted after the run.

When several instances are running, clever ssh currently requires an interactive
prompt (and fails in non-interactive mode). Accept --instance <instance-id> to
select the target directly, as requested in CleverCloud#1067.

Instance IDs are used rather than instance numbers, which are not stable across
deployments.

Fixes CleverCloud#1067
@mehdi653
mehdi653 requested a review from a team as a code owner August 12, 2026 22:39
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.

Add --instance option to clever ssh

1 participant