Исполнитель Docker в Gitlab CI получает неправильный URL-адрес в репозиторий Git

У меня есть установка сервера Gitlab на внутреннем сервере в домене типа http://gitlab.example.com. Я также зарегистрировал как бегун, использующий shell executor, так и бегун, использующий docker executor, оба на том же компьютере, что и сервер Gitlab.

У меня есть очень простой файл .gitlab-ci.yml

runtest:
    script:
        - npm install

Когда я запускаю это через бегун, используя shell executor, все работает нормально. Репо проверяется, и запускается установка npm.

Однако, когда я запускаю это через бегун, настроенный как docker executor. Я получаю следующую ошибку:

Running with gitlab-ci-multi-runner 9.4.2 (6d06f2e)
  on Test runner (fe943c63)
Using Docker executor with image node:6 ...
Using docker image 
sha256:81e132bdd65c157234d121b7c1743360c0d0d60f9bb6322f75ffa87c8f561ad8 for 
predefined container...
Pulling docker image node:6 ...
Using docker image node:6 
ID=sha256:3d258692b9fa0ba9568a891e1c702eee61d43e35286bec1b6fb0964700ca1dea for 
build container...
Running on runner-fe943c63-project-5-concurrent-0 via gitlab...
Cloning repository...
Cloning into '/builds/internal/boilerplate'...
fatal: repository 'http://example.com/internal/boilerplate.git/' not found
ERROR: Job failed: exit code 1

Проблема в том, что мой сервер Gitlab находится в субдомене с именем gitlab.example.com, и бегун пытается проверить код из http://example.com. Это как если бы исполнителю докера был передан неправильный URL-адрес сервера, и поэтому он не может правильно проверить репозиторий Git.

Я не могу понять, почему существует разница между двумя бегунами и где, возможно, настроить Gitlab для использования правильного пути к репозиторию git для всех бегунов?

Изменить: вот результат работы ps aux | grep gitlab

git        373  1.5  9.5 657036 385916 ?       Sl   13:08   0:04 unicorn worker[0] -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
gitlab-+   389  0.0  0.7 1121208 30444 ?       Ss   13:08   0:00 postgres: gitlab gitlabhq_production [local] idle
gitlab-+   406  0.0  0.5 1115624 23832 ?       Ss   13:09   0:00 postgres: gitlab gitlabhq_production [local] idle
gitlab-+   407  0.0  0.5 1116772 24104 ?       Ss   13:09   0:00 postgres: gitlab gitlabhq_production [local] idle
gitlab-+   409  0.0  0.6 1116852 24784 ?       Ss   13:09   0:00 postgres: gitlab gitlabhq_production [local] idle
gitlab-+   412  0.0  0.6 1117364 24644 ?       Ss   13:09   0:00 postgres: gitlab gitlabhq_production [local] idle
root       615  0.0  0.0   4252  1120 ?        Ss   Aug14   0:00 runsvdir -P /opt/gitlab/service log: ....................................................................................................................................................................................................$
root       674  0.0  0.0   4100   644 ?        Ss   Aug14   0:00 runsv gitlab-monitor
root       680  0.0  0.0   4100   676 ?        Ss   Aug14   0:00 runsv gitlab-workhorse
root       689  0.0  0.0   4244  1156 ?        S    Aug14   0:00 svlogd -tt /var/log/gitlab/prometheus
root       707  0.0  0.0   4244  1236 ?        S    Aug14   0:00 svlogd -tt /var/log/gitlab/gitaly
root       708  0.0  0.0   4244  1240 ?        S    Aug14   0:01 svlogd -tt /var/log/gitlab/gitlab-workhorse
root       709  0.0  0.0   4244  1068 ?        S    Aug14   0:00 svlogd -tt /var/log/gitlab/unicorn
root       710  0.0  0.0   4244  1228 ?        S    Aug14   0:00 svlogd -tt /var/log/gitlab/sidekiq
root       711  0.0  0.0   4244  1064 ?        S    Aug14   0:00 svlogd -tt /var/log/gitlab/logrotate
root       712  0.0  0.0   4244   696 ?        S    Aug14   0:00 svlogd -tt /var/log/gitlab/nginx
root       713  0.0  0.0   4244  1216 ?        S    Aug14   0:00 svlogd -tt /var/log/gitlab/postgresql
root       714  0.0  0.0   4244  1156 ?        S    Aug14   0:00 svlogd -tt /var/log/gitlab/redis-exporter
root       715  0.0  0.0   4244  1128 ?        S    Aug14   0:00 svlogd -tt /var/log/gitlab/postgres-exporter
root       716  0.0  0.0   4244  1228 ?        S    Aug14   0:00 svlogd -tt /var/log/gitlab/gitlab-monitor
root       717  0.0  0.0   4244  1244 ?        S    Aug14   0:00 svlogd -tt /var/log/gitlab/node-exporter
root       739  0.0  0.0   4244  1060 ?        S    Aug14   0:00 svlogd -tt /var/log/gitlab/redis
gitlab-+  1546  0.0  0.5 1115740 21052 ?       Ss   13:14   0:00 postgres: gitlab gitlabhq_production [local] idle
gitlab-+  1547  0.0  0.4 1114536 18512 ?       Ss   13:14   0:00 postgres: gitlab gitlabhq_production [local] idle
gitlab-+  1548  0.0  0.4 1114884 19224 ?       Ss   13:14   0:00 postgres: gitlab gitlabhq_production [local] idle
srv       1565  0.0  0.0  12740  2248 pts/0    S+   13:14   0:00 grep gitlab
root     27235  0.1  0.4  56260 20132 ?        Ssl  12:30   0:03 /usr/bin/gitlab-ci-multi-runner run --working-directory /home/gitlab-runner --config /etc/gitlab-runner/config.toml --service gitlab-runner --syslog --user gitlab-runner
git      27266  0.0  0.3 130316 14280 ?        Ssl  12:30   0:00 /opt/gitlab/embedded/bin/gitaly /var/opt/gitlab/gitaly/config.toml
git      27271  0.1  0.7 311376 32044 ?        Ssl  12:30   0:04 /opt/gitlab/embedded/bin/ruby /opt/gitlab/embedded/bin/gitlab-mon web -c /var/opt/gitlab/gitlab-monitor/gitlab-monitor.yml
git      27274  0.0  0.3 228128 15244 ?        Ssl  12:30   0:01 /opt/gitlab/embedded/bin/gitlab-workhorse -listenNetwork unix -listenUmask 0 -listenAddr /var/opt/gitlab/gitlab-workhorse/socket -authBackend http://localhost:8080 -authSocket /var/opt/gitlab/gitlab-rails/sockets/gitlab.socket -docum$
root     27282  0.0  0.0   4340  1576 ?        Ss   12:30   0:00 /bin/sh /opt/gitlab/embedded/bin/gitlab-logrotate-wrapper
root     27288  0.0  0.1  42056  5532 ?        Ss   12:30   0:00 nginx: master process /opt/gitlab/embedded/sbin/nginx -p /var/opt/gitlab/nginx
gitlab-+ 27289  0.0  0.1  46688  7700 ?        S    12:30   0:00 nginx: worker process
gitlab-+ 27290  0.0  0.0  42260  3088 ?        S    12:30   0:00 nginx: cache manager process
gitlab-+ 27293  0.0  0.3 119656 14768 ?        Ssl  12:30   0:01 /opt/gitlab/embedded/bin/node_exporter -web.listen-address=localhost:9100 -collector.textfile.directory=/var/opt/gitlab/node-exporter/textfile_collector
gitlab-+ 27298  0.0  0.2 116904 11336 ?        Ssl  12:30   0:00 /opt/gitlab/embedded/bin/postgres_exporter -web.listen-address=localhost:9187 -extend.query-path=/var/opt/gitlab/postgres-exporter/queries.yaml
gitlab-+ 27305  0.0  1.2 1103620 52328 ?       Ss   12:30   0:00 /opt/gitlab/embedded/bin/postgres -D /var/opt/gitlab/postgresql/data
gitlab-+ 27307  0.0  0.7 1103736 29220 ?       Ss   12:30   0:00 postgres: checkpointer process
gitlab-+ 27308  0.0  0.2 1103620 10880 ?       Ss   12:30   0:00 postgres: writer process
gitlab-+ 27309  0.0  0.5 1103620 20664 ?       Ss   12:30   0:00 postgres: wal writer process
gitlab-+ 27310  0.0  0.1 1104192 6284 ?        Ss   12:30   0:00 postgres: autovacuum launcher process
gitlab-+ 27311  0.0  0.0  31808  3952 ?        Ss   12:30   0:00 postgres: stats collector process
gitlab-+ 27314  0.2  1.4 370924 59220 ?        Ssl  12:30   0:05 /opt/gitlab/embedded/bin/prometheus -web.listen-address=localhost:9090 -storage.local.path=/var/opt/gitlab/prometheus/data -storage.local.chunk-encoding-version=2 -storage.local.target-heap-size=109384826 -config.file=/var/opt/gitlab$
gitlab-+ 27323  0.4  0.1  41556  5648 ?        Ssl  12:30   0:12 /opt/gitlab/embedded/bin/redis-server 127.0.0.1:0
gitlab-+ 27328  0.0  0.2  39396 10968 ?        Ssl  12:30   0:00 /opt/gitlab/embedded/bin/redis_exporter -web.listen-address=localhost:9121 -redis.addr=unix:///var/opt/gitlab/redis/redis.socket
git      27333  1.7  9.7 714348 396880 ?       Ssl  12:30   0:46 sidekiq 5.0.0 gitlab-rails [0 of 25 busy]
git      27357  0.0  0.0  20124  2956 ?        Ss   12:30   0:00 /bin/bash /opt/gitlab/embedded/bin/gitlab-unicorn-wrapper
git      27376  0.5  7.8 577152 320180 ?       Sl   12:30   0:14 unicorn master -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
gitlab-+ 27382  0.0  0.4 1115236 18844 ?       Ss   12:30   0:01 postgres: gitlab-psql postgres [local] idle
git      27485  0.4  9.9 687964 405976 ?       Sl   12:31   0:10 unicorn worker[1] -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru
gitlab-+ 27517  0.0  0.9 1130316 39788 ?       Ss   12:31   0:00 postgres: gitlab gitlabhq_production [local] idle
gitlab-+ 30455  0.0  0.6 1117852 26280 ?       Ss   12:50   0:00 postgres: gitlab gitlabhq_production [local] idle

person SuneRadich    schedule 14.08.2017    source источник
comment
используйте ps aux | grep gitlab и проверьте, имеют ли они одинаковые параметры командной строки   -  person Tarun Lalwani    schedule 14.08.2017
comment
Я не совсем уверен, как я могу использовать вывод этого, чтобы убедиться в этом (я не эксперт по Linux)   -  person SuneRadich    schedule 15.08.2017
comment
Опубликуйте выходные данные с обоих серверов в своем вопросе, и мы постараемся вам помочь.   -  person Tarun Lalwani    schedule 15.08.2017
comment
Все на одном сервере. Бегуны бывают всего в двух разных конфигурациях. Вот почему мне кажется странным, что URL-адрес Gitlab CI, который пытается оформить заказ, неверен при использовании исполнителя докеров :)   -  person SuneRadich    schedule 15.08.2017
comment
Затем прошейте свою конфигурацию   -  person Tarun Lalwani    schedule 15.08.2017


Ответы (1)


Это было вызвано настройками сети на бегунке. Сетевой мост, который был автоматически настроен между хостом и исполнителем докера, находился «за пределами» нашей локальной сети. Таким образом, докер-контейнер не смог увидеть URL-адрес gitlab.example.com.

Я решил это, добавив

network_mode = "host"

В config.toml для docker runner.

Таким образом, бегун использует ту же сеть, что и хост, и, таким образом, получает необходимый доступ.

person SuneRadich    schedule 23.08.2017