Skip to content

Expose server SSH host and port in predefined CI variables

What does this MR do and why?

This exposes the server SSH port (and host) in predefined CI variables and makes it available in CI jobs, so it can be used for constructing/parsing SSH URLs on the runner or in the job itself.

Context:
Adding support for absolute submodule URLs in Add support for absolute submodule URLs (gitlab-runner!3198 - merged), this will help with additional scenarios when an instance uses a non-standard SSH port.

Screenshots or screen recordings

Successful run on GDK with local shell runner:

image

How to set up and validate locally

  1. Using GDK:
# in ./gitlab/:

git remote add community https://gitlab.com/gitlab-community/gitlab.git
git checkout community/feat/ci-server-ssh-port-variable

gdk start
  1. Follow GDK runner setup https://gitlab.com/gitlab-org/gitlab-development-kit/blob/main/doc/howto/runner.md#simple-configuration

  2. Run a simple job in a test repo, .gitlab-ci.yml:

test:
  script:
    - echo $CI_SERVER_SHELL_SSH_PORT
    - echo $CI_SERVER_SHELL_SSH_HOST

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Nejc Habjan

Merge request reports