0

最近のマイナー 8.x アップグレードの後、別のリポジトリも取得する GitLab CI テストを実行できません。以前はすべて機能していましたが、有名なホスト キーの検証に失敗しました。ssh からのエラー メッセージ。これの原因は何ですか?

/etc/gitlab-runner/config.toml:

concurrent = 1

[[runners]]
  name = "python-runner@localhost"
  # ...
  executor = "docker"
  [runners.docker]
    image = "edoburu/python-runner"
    privileged = false
    cap_drop = ["DAC_OVERRIDE"]
    volumes = [
        "/cache",
        "/home/deploy/.ssh:/root/.ssh:ro"
    ]
    # ...

ご覧のとおり、.ssh既知のすべてのホストのリストをコンテナーに提供するために、フォルダーが公開されています ( /home/deploy/.ssh/known_hosts)。これにより、リポジトリでデプロイ キーとして有効にした既知の SSH キーもコンテナーに与えられます。

ただし、ビルドは最近失敗します。これは以前にはありませんでした。

Obtaining python-extra from git+git@git.example.org:myproject/python-repo.git@889f8fa0fe485d246d106ccee47aa60b2dd2523e#egg=python-extra (from -r src/requirements.txt (line 63))
  Cloning git@git.example.org:myproject/python-extra.git (to 889f8fa0fe485d246d106ccee47aa60b2dd2523e) to /builds/myproject/env/src/python-extra
Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Command "git clone -q git@git.example.org:myproject/python-extra.git /builds/project/env/src/python-extra" failed with error code 128 in None

.gitlab-ci.ymlファイルには次が含まれます。

test:
  image: edoburu/python-runner:base
  stage: test
  script:
  - virtualenv --no-site-packages ../env
  - source ../env/bin/activate
  - pip install --exists-action=w -r src/requirements.txt
  - pip install coverage
  - coverage run --source=src --omit='*/migrations/*' ./src/runtests.py -v2
  - coverage report -m

ただし、コンテナーに手動で入ると、すべて正常に動作します。

root@git.example.org ~ $ docker run -it --volume="/home/deploy/.ssh:/root/.ssh:ro" edoburu/python-runner:base /bin/bash
root@feed357355ad:/# ssh git@git.example.org
PTY allocation request failed on channel 0
Welcome to GitLab, Anonymous!
Connection to git.example.org closed.
root@feed357355ad:/# git clone git@git.example.org:myproject/python-extra.git  
Cloning into 'python-extra'...
remote: Counting objects: 387, done.
remote: Compressing objects: 100% (176/176), done.
remote: Total 387 (delta 215), reused 374 (delta 208)
Receiving objects: 100% (387/387), 5.97 MiB | 0 bytes/s, done.
Resolving deltas: 100% (215/215), done.
Checking connectivity... done.
root@feed357355ad:/# exit
root@git.example.org ~ $

GitLab が異なる点はありますか? ビルドが失敗する原因となる IP アドレスなどを割り当てますか?

4

1 に答える 1

0

解決しましたが--cap-drop=DAC_OVERRIDE、ボリュームにアクセスできないことがわかりました。所有者をルートに変更すると解決しました。

.gitlab-ci.ymlファイルにいくつかのデバッグ コードを追加することで見つかりました。

 script:
  - ping -c 1 git.edoburu.nl
  - ssh-keyscan git.edoburu.nl
  - ls -la ~/.ssh/
  - cat ~/.ssh/known_hosts
于 2016-04-12T11:28:37.750 に答える