Gitlab CI cannot connect via gitlab-ci-token to Gitlab

Hi,
i created a new Project on my Gitlab Server which Needs also Gitlab-CI.
It run’s before very well (a long time not used/needed), but now Gitlab-Ci cannot connect any more to Gitlab to clone Repository via gitlab-ci-token. I use Docker run Tests in.
Gitlab and Gitlab-Ci are running on the same machine.

Blockquote
Using Docker executor with image ruby:2.3 …
Using docker image sha256:1929606e8374ad6403b85848b4740af5d872a3034e5989893d67f9ba591cbc3c for predefined container…
Pulling docker image ruby:2.3 …
Using docker image ruby:2.3 ID=sha256:03ff8cebf24fa355353a00dae607155efd56f565c82ef22bf4dd7599a34cd026 for build container…
Running on runner-4ea268f6-project-9-concurrent-0 via gitlab.walhalla.local…
Cloning repository…
Cloning into ‘/builds/thomas/puppet’…
fatal: unable to access ‘http://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@192.168.98.27/thomas/puppet.git/’: Failed to connect to 192.168.98.27 port 80: Host is unreachable
ERROR: Job failed: exit code 1

If if try to checkout Repository via user: gitlab-ci-token, and a CI-Token as Password on local Gitlab Server i got this:

Blockquote
[09:35h][root@gitlab][:~]$ git clone http://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@192.168.98.27/thomas/puppet.git
Klone nach ‘puppet’ …
remote: HTTP Basic: Access denied
fatal: Authentication failed for ‘http://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@192.168.98.27/thomas/puppet.git/

Gitlab-runner Verify says, everything is ok:

Blockquote
[09:35h][root@gitlab][:~]$ gitlab-runner verify
Running in system-mode.
Verifying runner… is alive runner=XXXXXX
Verifying runner… is alive runner=XXXXXX

/etc/giltlab-runner/config.toml looks like this:

Blockquote
concurrent = 2
check_interval = 0
[[runners]]
name = “CI-Docker1”
url = “http://gitlab.walhalla.local
token = “XXXXXXXXXXXXXXXXXXXXXXXXXXXX”
executor = “docker”
[runners.docker]
tls_verify = false
image = “debian:latest”
privileged = false
disable_cache = false
volumes = ["/cache"]
extra_hosts = [“gitlab.walhalla.local:192.168.98.27”]
shm_size = 0
[[runners]]
name = “CI-Docker2”
url = “http://gitlab.walhalla.local
token = “XXXXXXXXXXXXXXXXXXXXXXXXXXXX”
executor = “docker”
[runners.docker]
tls_verify = false
image = “debian:latest”
privileged = false
disable_cache = false
volumes = ["/cache"]
extra_hosts = [“gitlab.walhalla.local:192.168.98.27”]
shm_size = 0
Blockquote

I don’t know what has been changed on Gitlab or Giltab-CI, but i would be very happy if someone could help me to get Gitlab-CI and Gitlab work together again.

with regards,
cloudclimber

Have you find the solution? I have the same problem.

Same issue here.

“Host is unreachable” when I run a job.

If I try and do a clone I do a clone as the runner “Access denied”.

I can get into the gitlab-runner container and ping my url just fine.

Anyone find a solution?

This is quite annoying because the first post is almost a year old now and there are people (like me) with that same issue left here in the dust - without any idea on how to fix this and get the CI up and running :roll_eyes:

This looks like the docker container does not have access to the same network your machine does.
These are the things I would try:

  • setting a hostname to your gitlab server (and hope docker resolves this)
  • try with the runner in a different machine
  • setting the CI_REPOSITORY_URL variable in your .gitlab-ci.yaml file.
  • check if there’s something with the extra_hosts settings in your gitlab-runner/config.toml file
1 Like

Thanks, @rsvargas! I just tried with the runner on a different machine and it worked like a charm. I think the main problem for me here was that I was trying to have the runner as a Docker container in the same server that I have GL running - as a docker container as well.

Then, I stumbled upon this detail - very subtle but documented:

I don’t know if this make sense in the overall problem (a really different server and not just in a different container, etc), but it worked. I guess this could be emphasized in the Runners documentation, just my two cents here. Perhaps I’ll drop a note in there.

Again, thanks a lot.

1 Like

Just spent days trying to figure this out. Didn’t even work while having the runner on a kvm virtual server on the same physical server as docker. Really wish it would give more helpful error messages or be clearly documented.

Why is this happening? It doesn’t seem to be a simple networking error?

Thank you for helping me along

@qoOp the Gitlab team seems to be working on it regarding this error to be more (or clearly) documented :wink: