Skip to content

Fix E2E log collection SSH identity selection#223

Open
bcho with Copilot wants to merge 9 commits into
mainfrom
copilot/e2e-fix-ssh-key-issue
Open

Fix E2E log collection SSH identity selection#223
bcho with Copilot wants to merge 9 commits into
mainfrom
copilot/e2e-fix-ssh-key-issue

Conversation

Copilot AI commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

The E2E log collection step could run in a fresh shell after infra deployment and lose the generated VM SSH identity. That made run.sh logs/cleanup fall back to the runner’s default SSH key and fail to collect VM diagnostics.

  • SSH identity reuse

    • Resolve the private key matching the VM public key used for provisioning.
    • Reuse the generated ${E2E_WORK_DIR}/e2e_ssh_key across standalone logs and cleanup invocations.
  • SSH/SCP option handling

    • Pass the managed identity through SSH/SCP argv arrays to preserve paths safely.
    • Keep caller-provided E2E_SSH_OPTS as an explicit whitespace-delimited option list.
  • Existing identity detection

    • Avoid overriding user-specified identities via -i, -i/path, or IdentityFile.
./hack/e2e/run.sh all      # may generate ${E2E_WORK_DIR}/e2e_ssh_key
./hack/e2e/run.sh logs     # now reuses that key for VM log collection

Copilot AI assigned Copilot and bcho Jul 7, 2026
Copilot AI linked an issue Jul 7, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix e2e logs collect step to use correct ssh key Fix E2E log collection SSH identity selection Jul 7, 2026
Copilot finished work on behalf of bcho July 7, 2026 00:16
Copilot AI requested a review from bcho July 7, 2026 00:16
@bcho bcho marked this pull request as ready for review July 7, 2026 03:14
Copilot AI review requested due to automatic review settings July 7, 2026 03:14

Copilot AI 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.

Pull request overview

This PR improves the reliability of the E2E SSH/SCP flows by selecting an appropriate SSH identity (especially across separate run.sh invocations like logs/cleanup) and by switching SSH/SCP calls to argv arrays to preserve paths safely.

Changes:

  • Add configure_ssh_identity and _build_ssh_opts helpers to centralize SSH identity selection and option building.
  • Update SSH/SCP helpers (wait_for_ssh, remote_exec, remote_copy) to pass options via arrays instead of relying on unquoted $E2E_SSH_OPTS expansion.
  • Invoke SSH identity configuration during both main entry (run.sh) and infra deploy (infra.sh) so standalone logs/cleanup runs can reuse identities.

Reviewed changes

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

File Description
hack/e2e/run.sh Configures SSH identity during common initialization so logs/cleanup in a fresh shell can still connect.
hack/e2e/lib/infra.sh Uses centralized SSH identity configuration during infra provisioning (but needs a guard against stale work-dir keys).
hack/e2e/lib/common.sh Introduces identity resolution and builds SSH/SCP argv options safely via arrays.

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

Comment thread hack/e2e/lib/infra.sh
Comment on lines 72 to 76
# Resolve SSH key
local ssh_key
ssh_key="$(_resolve_ssh_key)"
if [[ -f "${E2E_WORK_DIR}/e2e_ssh_key" && "${ssh_key}" == "$(cat "${E2E_WORK_DIR}/e2e_ssh_key.pub")" ]]; then
export E2E_SSH_OPTS="-i ${E2E_WORK_DIR}/e2e_ssh_key -o IdentitiesOnly=yes ${E2E_SSH_OPTS}"
fi
configure_ssh_identity

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.

e2e: e2e logs collect step is using wrong ssh key

3 participants