Gitlabs CI Runner does not resolve host names

I created a specific runner in the following guide: Install using the official GitLab repositories (Linux) . I was able to successfully register the runner in our company GitLab.

I also provided .gitlab-ci.yml for our gradle project. It is basically that simple:

image: java:8-jdk

before_script:
  - export GRADLE_USER_HOME=`pwd`/.gradle

build:
  stage: build
  script:
    - ./gradlew assemble

test:
  stage: test
  script:
    - ./gradlew check

After GitLab saw this file, it started to run the assembly, but could not:

$ ./gradlew assemble
Downloading https://services.gradle.org/distributions/gradle-2.12-bin.zip

Exception in thread "main" java.net.UnknownHostException: services.gradle.org

I worked on this issue by updating extra_hosts in local /etc/gitlab-runner/config.toml :

  [runners.docker]
    tls_verify = false
    image = "ruby:2.1"
    privileged = false
    disable_cache = false
    volumes = ["/cache"]
    extra_hosts = ["git.my.company.com:xxx.xxx.xxx.xxx","services.gradle.org:207.223.250.8","downloads.gradle.org:54.240.162.161","repo1.maven.org:151.101.36.209"]
  [runners.cache]

, , . GitLab CI, . , IP- DNS.

- ? ?

DNS :

[runners.docker]
    tls_verify = false
    image = "ruby:2.1"
    privileged = false
    disable_cache = false
    volumes = ["/cache"]
    dns = ["<my company DNS IP>"]

, . , , , .

+4

Source: https://habr.com/ru/post/1653775/


All Articles