Gitlab CI 推送到 ssh 远程时未触发构建

Gitlab CI build not triggered on push to ssh remote

我们有 gitlab ci 当前设置(据说)在任何东西被推送到远程时触发构建。但是,我发现如果有人推送到 ssh 远程(例如:git@gitlab.com:Project.git),构建不会被触发。如果他们推送到 https 远程(例如:https://gitlab.com/Project.git),构建将被正常触发。关于我们的问题可能是什么的任何想法?我们的 .gitlab-ci.yml 看起来像这样:

stages:
  - test
  - deploy

cache:
  paths:
  - node_modules/

run_project1_tests:
  stage: test
  script:
    - set -xe
    - wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
    - echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list
    - apt-get update -yqqq
    - apt-get install -y xvfb google-chrome-stable
    - npm i -g npm@3.7.5 && npm i -g gulp@3.9.1 && npm i -g typings@1.3.1
    - cd project1
    - npm i
    - typings install && gulp check.versions && npm prune
    - Xvfb :1 -screen 0 800x600x16 &
    - export DISPLAY=:1.0
    - npm test

run_project2_tests:
  stage: test
  script:
    - npm i -g npm@3.7.5 && npm i -g typings@1.3.1 && npm i -g jasmine
    - cd project2
    - npm i
    - npm test

deploy_to_docker:
  stage: deploy
  only:
    - develop
  script:
    - chmod +x /usr/local/bin/docker-compose
    - export DOCKER_HOST="tcp://REMOTE_IP:2375"
    - docker-compose up -d --build

提前致谢!

如果 HTTPS 有效,但 SSH 无效,那么问题出在 Gitlab,而不是你的 .gitlab-ci.yml

查看日志并搜索错误,运行 gitlab-rake gitlab:check 查看是否一切正常。听起来 gitlab-shell(它与 Gitlab 的连接)不能正常工作。

如果一切正常,请在 https://gitlab.com/gitlab-org/gitlab-ce/issues 提交错误报告。