Failed to connect to gitlab.mydomain.tld port 443

It’s been a while since I used CI/CD in my gitlab. Today I wanted to add a runner to a project to execute a deployment when the main branch is modified.

I have simplified it without testing or anything.

But once again I have problems with the famous theme:

fatal: unable to access 'https://gitlab.mydomain.tld/user/project.git/': Failed to connect to gitlab.mydomain.tld port 443 after 130986 ms: Couldn't connect to server

Scenario

has a VPS with docker running

root@docker:~# /usr/local/bin/gitlab-runner --version
Version:      16.2.0
Git revision: 782e15da
Git branch:   16-2-stable
GO version:   go1.20.5
Built:        2023-07-21T22:52:35+0000
OS/Arch:      linux/amd64

/etc/gitlab-runner/config.toml

concurrent = 2
check_interval = 0
shutdown_timeout = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "docker"
  url = "https://gitlab.mydomain.tld"
  id = 23
  token = "glrt-VN8GzAtAi6m4fZnErQKw"
  token_obtained_at = 2023-08-01T17:00:04Z
  token_expires_at = 0001-01-01T00:00:00Z
  executor = "docker"
  [runners.cache]
    MaxUploadedArchiveSize = 0
  [runners.docker]
    tls_verify = false
    image = "alpine:latest"
    privileged = false
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/cache"]
    shm_size = 0
    extra_hosts = ["gitlab.mydomain.tld:XXX.31.31.225"]

Error job

Running with gitlab-runner 16.2.0 (782e15da)
  on docker VN8GzAtAi, system ID: s_9a44f2bb7723
Preparing the "docker" executor
00:01
Using Docker executor with image alpine ...
Pulling docker image alpine ...
Using docker image sha256:c1aabb73d2339c5ebaa3681de2e9d9c18d57485045a4e311d9f8004bec208d67 for alpine with digest alpine@sha256:82d1e9d7ed48a7523bdebc18cf6290bdb97b82302a8a9c27d4fe885949ea94d1 ...
Preparing environment
00:01
Running on runner-vn8gzatai-project-206-concurrent-0 via docker...
Getting source from Git repository
02:11
Fetching changes with git depth set to 20...
Reinitialized existing Git repository in /builds/user/project/.git/
fatal: unable to access 'https://gitlab.mydomain.tld/user/project.git/': Failed to connect to gitlab.mydomain.tld port 443 after 130986 ms: Couldn't connect to server
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1

Software

  • Gitlab v16.2.1-ee
  • Runner in docker separate
  • Ip in other mchines are in firewall white list (test also with firewall disabled)
/usr/local/bin/gitlab-runner --version
Version:      16.2.0
Git revision: 782e15da
Git branch:   16-2-stable
GO version:   go1.20.5
Built:        2023-07-21T22:52:35+0000
OS/Arch:      linux/amd64

.gitlab-ci.yaml

stages:
  - deploy

deploy:
  stage: deploy
  image: alpine
  before_script:
    - 'which ssh-agent || ( apk update -y && apk add openssh-client -y )'
    - eval $(ssh-agent -s)
    - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
    - mkdir -p ~/.ssh
    - chmod 700 ~/.ssh
    - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
    - chmod 644 ~/.ssh/known_hosts
  script:
    - ssh $LIVE_SERVER_USERNAME@$LIVE_SERVER_IP "cd /home/user/web/subdomain.domain.tld/deploy && git pull && yarn install && yarn prod"
  only:
    - main

Any idea?

1 Like

We have the same problem connecting to gitlab.com. Did you find any solution?