Как заставить gitlab CI использовать s sh для клонирования хранилища? - PullRequest
0 голосов
/ 14 апреля 2020

В компании, в которой я работаю, есть частный сервер gitlab, который поддерживает только протокол s sh при клонировании репозитория.

Внутри этого сервера у меня есть файл gitlab-ci.yml, который использует docker executor для запуска некоторых сценариев.

Выполнение сценария завершается неудачно, поскольку на ранней стадии он извлекает хранилище с https. Он генерирует это сообщение об ошибке: fatal: unable to access 'https://gitlab.mycompany.com/path/to/the/repository/my_repo.git/': SSL certificate problem: unable to get local issuer certificate.

Где я могу настроить gitlab runner, чтобы он использовал s sh для клонирования хранилища?

Вот полный журнал выполнения.

Running with gitlab-runner 12.7.1 (003fe500)
  on my Group Runner Yh_yL3A2
Using Docker executor with image www.mycompany.com/path/to/the/image:1.0 ...
Pulling docker image www.mycompany.com/path/to/the/image:1.0 ...
Using docker image sha256:474e110ba44ddfje8ncoz4c44e91f2442547281192d4a82b88capmi9047cd8cb for www.mycompany.com/path/to/the/image:1.0 ...
Running on runner-Yh_yL3A2-project-343-concurrent-0 via b55d8c5ba21f...
Fetching changes...
Initialized empty Git repository in /path/to/the/repository/.git/
Created fresh repository.
fatal: unable to access 'https://gitlab.mycompany.com/path/to/the/repository/my_repo.git/': SSL certificate problem: unable to get local issuer certificate
ERROR: Job failed: exit code 1

Вот мой .gitlab-ci.yml

image: www.mycompany.com/path/to/the/image:1.0

before_script:
  - eval $(ssh-agent -s)
  # Reference: https://docs.gitlab.com/ee/ci/ssh_keys/
  # Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
  # We're using tr to fix line endings which makes ed25519 keys work
  # without extra base64 encoding.
  # https://gitlab.com/gitlab-examples/ssh-private-key/issues/1#note_48526556
  #
  - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
  #
  # Create the SSH directory and give it the right permissions
  #
  - mkdir -p ~/.ssh
  - chmod 700 ~/.ssh
  - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config

stages:
  - deploy

deploy:
  stage: deploy
  tags:
    - infra
  only:
    refs:
      - master
  script:
    - /bin/sh run.sh

Я не могу найти опцию, чтобы указать, должен ли исполнитель docker использовать s sh или https для клонирования хранилища.

...