feat: set the CI_SERVER_SHELL_SSH_HOST predefined variable
Merged
CR
9d ago+3+3+0123456789-0-0-0123456789
Closes #1972.
GitLab defines CI_SERVER_SHELL_SSH_HOST, the SSH host of the instance for Git access, next to CI_SERVER_SHELL_SSH_PORT. gitlab-ci-local only defined the port, so scripts that clone with git@$CI_SERVER_SHELL_SSH_HOST:... got an empty host.
CI_SERVER_SHELL_SSH_HOST now defaults to CI_SERVER_HOST, which is also GitLab's value unless a separate SSH host is configured. Like the other CI_SERVER_* variables, it can be overridden with --variable or a variables file.
Tests:
- Added
CI_SERVER_SHELL_SSH_HOST: "gitlab.com"to the expected variables intests/test-cases/predefined-variables/integration.test.ts. I couldn't run that suite locally: the shell executor needsrsync, which isn't available on my Windows machine, so I'm relying on CI for it. - Called
init()frompredefined-variables.tsdirectly, with an SSH remote ongitlab.example.com:2222:- no overrides:
CI_SERVER_SHELL_SSH_HOST=gitlab.example.com CI_SERVER_HOST=gitlab.internal:CI_SERVER_SHELL_SSH_HOST=gitlab.internalCI_SERVER_SHELL_SSH_HOST=ssh.gitlab.example.com: that value, withCI_SERVER_HOSTunchanged
- no overrides:
eslintandtsc --noEmitare clean.
Summary by cubic
Defines the CI_SERVER_SHELL_SSH_HOST predefined variable so scripts that clone with git@$CI_SERVER_SHELL_SSH_HOST no longer get an empty host.
- The variable defaults to
CI_SERVER_HOST, matching GitLab's behavior unless a separate SSH host is configured, and can be overridden with--variableor a variables file. - Updates the predefined-variables integration test to expect the new variable.
Closes #1972.