Gitlab CI: Gitlab Runner Can’t Fetch Changes from Repository
Symptoms
Gitlab Runner can’t fetch changes from repository while running jobs:
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in /builds/root/unity-ci-test/.git/
fatal: unable to access 'http://gitlab.example.com/root/unity-ci-test.git/': Could not resolve host: gitlab.example.com
ERROR: Job failed: exit code 1
Environment
- Gitlab CE 12.7.6
- Gitlab Runner 12.7.1
Solution
For some reason, such as firewall setup, the runner can’t reach the Gitlab’s exposed URL. You need to set a reachable clone_url
in Gitlab Runner’s config.toml
.
For example:
[[runners]]
name = "test-runner"
url = "https://gitlab.example.com"
token = "PzgMxRCqfHiNiPJyLQRC"
executor = "docker"
clone_url = "http://192.168.1.23"
Then restart the Gitlab Runner:
# gitlab-runner restart
Leave a Comment