Gitlab Runner 指向错误 URL

Gitlab Runner points to wrong URL

我已经在本地 Ubuntu 服务器(18.04)上安装了 Gitlab-CE,并且能够通过 http://192.168.xxx.xxx/

成功访问它

我正在尝试在存储库中设置一个 CI/CD 管道,此时有一个示例作业来测试管道 运行 是否成功。这是我的 .gitlab-ci.yml:

stages:
    - build
    - test

build:
    stage: build
    script:
        - echo "Building"
        - mkdir build
        - touch build/info.txt
    artifacts:
        paths:
            - build/

test:
    stage: test
    script:
        - echo "Testing"
        - test -f "build/info.txt"

但是,当我运行 管道失败并出现未解析主机错误,指向错误的URL - 即http://gitlab.example.com,而不是 http://192.168.xxx.xxx/。 这是错误消息:

Reinitialized existing Git repository in /builds/root/sast-dast-security-testing/.git/ fatal: unable to access 'http://gitlab.example.com/root/sast-dast-security-testing.git/': Could not resolve host: gitlab.example.com

我正在使用特定于 GitLab 的 运行ner,它使用 Docker 执行并使用 ruby:2.6 作为图像。 这是 运行ner config.toml:

concurrent = 1
check_interval = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "pipeline"
  url = "http://192.168.xxx.xxx/"
  token = "XXX"
  executor = "docker"
  dns = ["8.8.8.8"]
  [runners.custom_build_dir]
  [runners.cache]
    [runners.cache.s3]
    [runners.cache.gcs]
    [runners.cache.azure]
  [runners.docker]
    tls_verify = false
    image = "ruby:2.6"
    privileged = false
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/cache"]
    shm_size = 0

我尝试了多个建议的修复方法,例如添加 dns 配置行,但没有任何效果。

感谢任何帮助!

我设法通过将 /etc/gitlab/config.toml 中的 EXTERNAL_URL 值更改为 http://192.168.xxx.xxx/ 然后 运行 gitlab-ctl reconfigure 和 [=14= 来解决我的问题].显然这是安装 Gitlab 时的错误配置,那是重定向管道的 URL。