Can't upload artifacts due to DNS Problems

Hi. I have an issue that is causing me to slowly lose my mind. I’m using GitLab CI with the docker executor. I am able to clone the code and build it. I need to pack up some artifacts for the testing phase, but I get the following error:

ERROR: Uploading artifacts to coordinator... error couldn't execute POST against http://gitlab.local/ci/api/v1/builds/44/artifacts: Post http://gitlab.local/ci/api/v1/builds/44/artifacts: dial tcp: lookup gitlab.local on 8.8.8.8:53: no such host

But I can ping and dig gitlab.local. I even pull from it correctly at the beginning of the build. I have no clue what’s going on…

Issues #1037, #14212, and #1036 all pertain to this issue. I have done my best to implement all of their solutions, but it still doesn’t work.

What I have done:

  1. Added extra_hosts = ["gitlab.local:192.168.x.x"] to /etc/gitlab-runner/config.toml
  2. Rewrote the containers /etc/resolv.conf file to include only the entry nameserver 192.168.x.x

My bare bones .gitlab-ci.yml:

before_script:
  - echo "nameserver 192.168.x.x" > /etc/resolv.conf
  - apt-get update
  - apt-get install dnsutils -y

stages:
  - build

node:
  stage: build
  image: registry.local:5000/base:latest
  script:
    - cat /etc/resolv.conf
    - cat /etc/hosts
    - dig gitlab.local
    - ping gitlab.local -c 1
  artifacts:
    paths:
      - /build/

The build log which prints the containers /etc/resolv.conf and /etc/hosts

gitlab-ci-multi-runner 1.1.4 (9e2fd1a)
Using Docker executor with image registry.local:5000/base:latest ...
Pulling docker image registry.local:5000/base:latest ...

Running on runner-39580068-project-2-concurrent-0 via wintermute...
Fetching changes...
HEAD is now at 8a69869 .
From http://gitlab.local/my_company/repository
   8a69869..7c03759  master     -> origin/master
Checking out 7c037597 as master...
Previous HEAD position was 8a69869... .
HEAD is now at 7c03759... please don't be this...

$ echo "nameserver 192.168.x.x" > /etc/resolv.conf
$ apt-get update
[whole bunch of apt-get crud]
$ apt-get install dnsutils -y
[more crud]
$ cat /etc/resolv.conf
nameserver 192.168.x.x
$ cat /etc/hosts
127.0.0.1	localhost
::1	localhost ip6-localhost ip6-loopback
fe00::0	ip6-localnet
ff00::0	ip6-mcastprefix
ff02::1	ip6-allnodes
ff02::2	ip6-allrouters
192.168.x.x	gitlab.local
172.17.0.2	runner-39580068-project-2-concurrent-0
$ dig gitlab.local

; <<>> DiG 9.9.5-3ubuntu0.8-Ubuntu <<>> gitlab.local
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 35681
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 2

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;gitlab.local.			IN	A

;; ANSWER SECTION:
gitlab.local.		604800	IN	A	192.168.x.x

;; AUTHORITY SECTION:
local.			604800	IN	NS	ns.local.

;; ADDITIONAL SECTION:
ns.local.			604800	IN	A	192.168.x.x

;; Query time: 0 msec
;; SERVER: 192.168.251.13#53(192.168.x.x)
;; WHEN: Thu May 19 19:13:37 UTC 2016
;; MSG SIZE  rcvd: 88

$ ping gitlab.local -c 1
PING gitlab.local (192.168.x.x) 56(84) bytes of data.
64 bytes from gitlab.local (192.168.x.x): icmp_seq=1 ttl=63 time=0.436 ms

--- gitlab.local ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.436/0.436/0.436/0.000 ms

Uploading artifacts...
WARNING: /build/: no matching files                
ERROR: Uploading artifacts to coordinator... error couldn't execute POST against http://gitlab.local/ci/api/v1/builds/44/artifacts: Post http://gitlab.local/ci/api/v1/builds/44/artifacts: dial tcp: lookup gitlab.local on 8.8.8.8:53: no such host  id=44 token=7MWjN6rV
WARNING: Retrying...                               
ERROR: Uploading artifacts to coordinator... error couldn't execute POST against http://gitlab.local/ci/api/v1/builds/44/artifacts: Post http://gitlab.local/ci/api/v1/builds/44/artifacts: dial tcp: lookup gitlab.local on 8.8.8.8:53: no such host  id=44 token=7MWjN6rV
WARNING: Retrying...                               
ERROR: Uploading artifacts to coordinator... error couldn't execute POST against http://gitlab.local/ci/api/v1/builds/44/artifacts: Post http://gitlab.local/ci/api/v1/builds/44/artifacts: dial tcp: lookup gitlab.local on 8.8.8.8:53: no such host  id=44 token=7MWjN6rV
FATAL: invalid argument                            

ERROR: Build failed: exit code 1

I would be incredibly grateful if anyone could help me resolve this problem :slight_smile: