1

I have two virtual machines both running docker. On one, I am hosting a GitLab instance according to https://docs.gitlab.com/ee/install/docker.html. On the other, I have a GitLab runner running inside a container https://docs.gitlab.com/runner/install/docker.html.

Due to some port constraints, I am running the GitLab instance on non-standard ports (4443 instead of 443, for instance).

I am able to successfully register the runner, and GitLab can send a job that the runner will pick up. However, when that runner pulls the git repo it is apparently looking at the wrong port for that git pull: a GitLab screenshot of a CI/CD error where a runner is pulling the wrong port

My GitLab is on port 4443 not port 443. The GitLab runner config has the correct port in the url field and is, again, able to connect and receive jobs.

concurrent = 1
check_interval = 0
[session_server]
  session_timeout = 1800
[[runners]]
  name = "runner1"
  url = "https://vm-pr01:4443/"
  token = "egZUzK44hYVrhy6DTfey"
  tls-ca-file = "/etc/gitlab-runner/certs/cert.crt"
  executor = "docker"
  [runners.custom_build_dir]
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]
    [runners.cache.azure]
  [runners.docker]
    tls_verify = false
    image = "docker:20.10.16"
    privileged = true
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/cache"]
    shm_size = 0

Finally, I did try to change the GitLab ssh port according to this question: Gitlab with non-standard SSH port (on VM with Iptable forwarding) But that wasn't effective after restarting GitLab.

Are there other angles to try? My last thought was to host my own docker image with the correct ports changed in SSH config but I imagine there's a better way.

Taylor F
  • 89
  • 1
  • 7

1 Answers1

1

Use the clone_url configuration for the runner to change this.

[[runners]]
# ...
clone_url = "https://hostname:port"

Make sure the scheme matches your instance (http or https).

For whatever reason, the default clone url will not precisely respect the setting from url (scheme and port are assumed) so you must provide both url and clone_url in your configuration scenario.

sytech
  • 29,298
  • 3
  • 45
  • 86