Add configurable SSH port for agent connections#545
Open
ToshipSo wants to merge 2 commits intojenkinsci:developfrom
Open
Add configurable SSH port for agent connections#545ToshipSo wants to merge 2 commits intojenkinsci:developfrom
ToshipSo wants to merge 2 commits intojenkinsci:developfrom
Conversation
Previously the SSH port was hardcoded to 22 in ComputeEngineComputerLauncher. This adds a user-configurable SSH port field to the instance configuration, defaulting to 22 for backward compatibility. Resolves google-compute-engine-plugin/issues/134
gauravhighlevel
approved these changes
Apr 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SSH_PORT = 22constant fromComputeEngineComputerLauncherResolves #134
Changes
InstanceConfiguration- newsshPortfield with@DataBoundSetter, descriptor validation (1-65535), builder supportComputeEngineInstance- storessshPortwith backward-compatible getter for older serialized configsComputeEngineComputerLauncher- usesnode.getSshPort()instead of hardcodedSSH_PORTconstantconfig.jelly- SSH Port number field in Launch Configuration sectionhelp-sshPort.html- inline helpTesting done
Automated Tests
Six tests in
InstanceConfigurationTestcover the new SSH port logic:testSshPortDefaultValuesetSshPort(null)falls back to default port 22testSshPortCustomValuesetSshPort(2222)stores and returns 2222testSshPortInvalidValuesFallBackToDefaulttestSshPortBoundaryValuesdescriptorSshPortValidationtestConfigRoundtripsshPort— verifies the field survives a Jenkins save/load cycle through the UI formmvn test -Dtest=InstanceConfigurationTest.Manual Testing
Launched Jenkins locally with
mvn hpi:runand verified:Submitter checklist