Задать вопрос
@ton1_rose

GitLab CI/CD не выполняет jobs // Failed to connect to port 80 // в чем проблема?

// p.s. не дает опубликовать, может из за ссылок х3, оставлю пока только текст.

Пытаюсь разобраться в базовых вещах CI/CD.

Работаю в локальной среде, на windows 11 запущен докер-десктоп.

Запустил 2 контейнера в сети net1:
spoiler
"Driver": "bridge",
"Subnet": "172.18.0.0/16",
"Gateway": "172.18.0.1"

"Name": "gitlab",
"EndpointID": "677f29be33d8d440a3f02bc7c2f72869ff3f34575ceedb9d8ba9b491b4a4228e",
"MacAddress": "02:42:ac:12:00:02",
"IPv4Address": "172.18.0.2/16",
"IPv6Address": ""

"Name": "gitlab-runner",
"EndpointID": "ef8445006de7e70b3e7793c02d312b88a1f479999228ac766cb20f97e57bf5c1",
"MacAddress": "02:42:ac:12:00:03",
"IPv4Address": "172.18.0.3/16",
"IPv6Address": ""

spoiler
-gitlab

docker run --detach \
--privileged \
--hostname gitlab.localhost \
--add-host gitlab-runner:172.18.0.3 \
--env GITLAB_OMNIBUS_CONFIG="external_url 'gitlab.localhost'; gitlab_rails['lfs_enabled'] = true;" \
--network net1 \
--ip 172.18.0.2 \
--publish 22:22 \
--publish 80:80 \
--publish 443:443 \
--name gitlab \
--restart always \
--volume ${GITLAB_HOME}/config:/etc/gitlab \
--volume ${GITLAB_HOME}/logs:/var/log/gitlab \
--volume ${GITLAB_HOME}/data:/var/opt/gitlab \
--shm-size 256m \
gitlab-data-gitlab:latest

- gitlab-runner

docker run -d --name gitlab-runner --hostname gitlab-runner \
--network net1 \
--ip 172.18.0.3 \
--add-host gitlab.localhost:172.18.0.2 \
--restart always \
-v /srv/gitlab-runner/config:/etc/gitlab-runner \
-v /var/run/docker.sock:/var/run/docker.sock \
gitlab/gitlab-runner:latest

$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
59d27608fb03 gitlab/gitlab-runner:latest "/usr/bin/dumb-init" About an hour ago Up About an hour gitlab-runner
1f86c011a95d gitlab-data-gitlab:latest "/assets/wrapper" About an hour ago Up About an hour (healthy) 0.0.0.0:22->22/tcp, 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp gitlab

В веб интерфейсе гитлаб создал проект
gitlab.localhost /root/ devopstest.git
В нем самый простой скрипт .gitlab-ci.yml
stages:
  - test

job:
  stage: test
  script:
    - echo "Hello, GitLab CI!"

При переходе в pipelines видно что jobs уходит в Failed с ошибкой: Failed to connect to gitlab.localhost port 80 after 0 ms: Could not connect to server
spoiler
Running with gitlab-runner 17.7.0 (3153ccc6)
on gtl-runner t3_Lustg6, system ID: r_8oeC7Ycdpjz4
Preparing the "docker-windows" executor
00:05 Using Docker executor with image ubuntu:22.04 ...
Pulling docker image ubuntu:22.04 ...
Using docker image sha256:0e5e4a57c2499249aafc3b40fcd541e9a456aab7296681a3994d631587203f97 for ubuntu:22.04 with digest ubuntu@sha256:0e5e4a57c2499249aafc3b40fcd541e9a456aab7296681a3994d631587203f97 ...
Preparing environment
00:02 Running on runner-t3lustg6-project-2-concurrent-0 via
gitlab-runner...
Getting source from Git repository
00:01 Fetching changes with git depth set to 20...
Reinitialized existing Git repository in /builds/root/devopstest/.git/
fatal: unable to access 'gitlab.localhost/root/devopstest.git': Failed to connect to gitlab.localhost port 80 after 0 ms: Could not connect to server
Cleaning up project directory and file based variables
00:02 ERROR: Job failed: exit code 128

В логе gitlab runner следующий вывод:
spoiler
Initializing executor providers builds=0 max_builds=1
Checking for jobs... received job=3 repo_url=gitlab.localhost/root/devopstest.git runner=t3_Lustg6
Added job to processing list builds=1 job=3 max_builds=1 project=2 repo_url=gitlab.localhost/root/devopstest.git time_in_queue_seconds=1
Appending trace to coordinator...ok code=202 job=3 job-log=0-329 job-status=running runner=t3_Lustg6 sent-log=0-328 status=202 Accepted update-interval=3s
Appending trace to coordinator...ok code=202 job=3 job-log=0-849 job-status=running runner=t3_Lustg6 sent-log=329-848 status=202 Accepted update-interval=3s
WARNING: Job failed: exit code 128
duration_s=9.673737248 job=3 project=2 runner=t3_Lustg6
Appending trace to coordinator...ok code=202 job=3 job-log=0-3451 job-status=running runner=t3_Lustg6 sent-log=849-3450 status=202 Accepted update-interval=3s
Appending trace to coordinator...ok code=202 job=3 job-log=0-3552 job-status=running runner=t3_Lustg6 sent-log=3451-3551 status=202 Accepted update-interval=3s
Updating job... bytesize=3552 checksum=crc32:353fe18f job=3 runner=t3_Lustg6
WARNING: Submitting job to coordinator... job failed bytesize=3552 checksum=crc32:353fe18f code=200 job=3 job-status=failed runner=t3_Lustg6 status=200 OK update-interval=0s
Removed job from processing list builds=0 job=3 max_builds=1 project=2 repo_url=gitlab.localhost/root/devopstest.git time_in_queue_seconds=1

С хоста gitlab-runner curl проходит:
spoiler

root@gitlab-runner:/# curl gitlab.localhost
You are being redirected root .. ссылка

Подскажите пожалуйста, как дальше диагностировать ? уже 3 дня пытаюсь с этим разобраться GPT не помогает (
  • Вопрос задан
  • 40 просмотров
Подписаться 1 Средний 3 комментария
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы