Skip to content

fix(config): wire --ssh-key-file flag into resolveSSHKeys#94

Merged
mrhillsman merged 2 commits into
mainfrom
fix/ssh-key-file-implementation
May 26, 2026
Merged

fix(config): wire --ssh-key-file flag into resolveSSHKeys#94
mrhillsman merged 2 commits into
mainfrom
fix/ssh-key-file-implementation

Conversation

@mrhillsman

@mrhillsman mrhillsman commented May 26, 2026

Copy link
Copy Markdown
Contributor

Add tests that verify:

  • reading a public key from --ssh-key-file
  • reading multiple --ssh-key-file flags
  • merging --ssh-key and --ssh-key-file
  • error on nonexistent --ssh-key-file path

All tests currently fail because the flag is not registered in BindFlags() and resolveSSHKeys() does not read files.

resolveSSHKeys now reads public key files from --ssh-key-file paths and merges them with inline --ssh-key values. Both CLI flag sources share highest priority, followed by VIRTWORK_SSH_AUTHORIZED_KEYS env var, then YAML config.

Returns an error if a specified key file cannot be read, rather than silently producing VMs without SSH access.

Also registers --ssh-key-file in BindFlags for test coverage.

Resolves #93

Add tests that verify:
- reading a public key from --ssh-key-file
- reading multiple --ssh-key-file flags
- merging --ssh-key and --ssh-key-file
- error on nonexistent --ssh-key-file path

All tests currently fail because the flag is not registered
in BindFlags() and resolveSSHKeys() does not read files.

resolveSSHKeys now reads public key files from --ssh-key-file paths
and merges them with inline --ssh-key values. Both CLI flag sources
share highest priority, followed by VIRTWORK_SSH_AUTHORIZED_KEYS
env var, then YAML config.

Returns an error if a specified key file cannot be read, rather than
silently producing VMs without SSH access.

Also registers --ssh-key-file in BindFlags for test coverage.

Signed-off-by: Melvin Hillsman <mhillsma@redhat.com>
Apply filepath.Clean to normalize user-supplied key file paths and
add nolint directive — this is a CLI tool where the user intentionally
specifies the file path.

Signed-off-by: Melvin Hillsman <mhillsma@redhat.com>
@exe-prow-github-app
exe-prow-github-app Bot requested a review from OchiengEd May 26, 2026 00:06
@exe-prow-github-app

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mrhillsman

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@exe-prow-github-app exe-prow-github-app Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 26, 2026
@mrhillsman
mrhillsman merged commit 6c19af1 into main May 26, 2026
3 of 4 checks passed
@mrhillsman
mrhillsman removed the request for review from OchiengEd May 26, 2026 00:11
@mrhillsman
mrhillsman deleted the fix/ssh-key-file-implementation branch May 28, 2026 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: --ssh-key-file flag is registered but never implemented — SSH keys silently not injected

1 participant