ubuntusshgitlabrunner

gitlab ssh runner fails. What's wrong?


I'm trying to set up gitlab ci/cd pipeline with ssh runner. But when I start pipeline i have following mistakes:

gitlab pipeline results

/etc/gitlab-runner/config.toml is following:

concurrent = 1
check_interval = 0
log_level = "debug"

[session_server]
  session_timeout = 1800

[[runners]]
  name = "runner"
  url = "https://gitlab.com/"
  token = "XXXXXXXXXX"
  executor = "ssh"
  [runners.ssh]
    host = "gitlab.com"
    port = "22"
    user = "gitlab-runner"
    identity_file = "/home/gitlab-runner/.ssh/id_rsa"
  [runners.custom_build_dir]
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]
    [runners.cache.azure]

Runner is installed under Ubuntu 20.04. I will be very appreciated any advise! Thank u in advance!


Solution

  • The SSH executor is:

    It makes GitLab Runner connect to an external server and runs the builds there.
    We have some success stories from organizations using this executor, but usually we recommend using one of the other types.

    It makes sense your SSH executor fails, considering it tries and connect to gitlab.com itself, and run something there: that is most certainly impossible, since GitLab would only answer ssh queries for Git repository operation purposes, not for a random user script.

    A GitLab runner is meant to be installed on a user-controller server, (like a GitHub webhook would), i order to be called by a GitLab job.