Gitlab-runner shell执行器在ssl上突然出错

时间:2018-01-12 08:36:10

标签: gitlab gitlab-ci gitlab-ci-runner

昨天我的shell执行程序正常使用默认测试yml:

stages:
  - test
  - build
  - deploy

test:
  stage: test
  script: echo "Running tests"

build:
  stage: build
  script: echo "Building the app"

deploy_staging:
  stage: deploy
  script:
    - echo "Deploy to staging server"
    - export
  environment:
    name: staging
    url: https://staging.example.com
  only:
  - master

但现在我收到了以下错误:

Running with gitlab-runner 10.3.0 (5cf5e19a)
  on gitlab01ShellSQLRunner (9ec36953)
Using Shell executor...
Running on debian...
Cloning repository...
Cloning into '/home/gitlab-runner/builds/9ec36953/0/dev/SQL'...
fatal: unable to access 'https://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@10.45.18.14/dev/SQL.git/': SSL: certificate subject name (Gitlab01) does not match target host name '10.45.18.14'
ERROR: Job failed: exit status 1

由于三件事,我无法理解:
1.跑者网址为https://gitlab01(为什么突然使用ip?)
2. ip匹配网址https://gitlab01.YXNET.local〜别名https://gitlab01
它昨天奏效了:

Running with gitlab-runner 10.3.0 (5cf5e19a)
  on gitlabShellRunner (d36a5267)
Using Shell executor...
Running on debian...
Fetching changes...
HEAD is now at 6e9a125 added CI/CD file
From https://gitlab01/dev/SQL
   6e9a125..84de9fd  master     -> origin/master
Checking out 84de9fd7 as master...
Skipping Git submodules setup
$ echo "Running tests"
Running tests
Job succeeded

2 个答案:

答案 0 :(得分:0)

在这种情况下发生的事情是,我重新启动了debian机器,它重置了主机名......所以没有主机名使得gitlab默认使用IP ...

检查ip,对于SSL证书,它找不到它......

不知道为什么每次重启linux机器时它都会丢失我的主机名,但那是怎么回事......

答案 1 :(得分:0)

我在gitlab运行程序上的连接有相同的错误... 因此我添加到了.gitlab-ci.yml

variables:
       GIT_SSL_NO_VERIFY: "true"

和gitlab运行程序能够连接并克隆回购。