简体   繁体   English

通过NPM实现GitLab + GitLab CI +相关SSH项目

[英]GitLab + GitLab CI + Dependent SSH projects via NPM

Currently we're using GitLab to manage our repos and GitLab CI as our CI. 目前我们正在使用GitLab管理我们的回购和GitLab CI作为我们的CI。

I have a project which includes another GitLab project as a dependency (via NPM). 我有一个项目,其中包含另一个GitLab项目作为依赖项(通过NPM)。 The project is internal and the URL in package.json starts with git+ssh://git@ , which is what we use on our local machines. 该项目是内部的,package.json中的URL以git+ssh://git@开头,这是我们在本地机器上使用的。 We have SSH keys set up. 我们设置了SSH密钥。

However, GitLab CI doesn't seem to be able to use this same mechanism to install this dependent project (via npm install ). 但是,GitLab CI似乎无法使用相同的机制来安装此依赖项目(通过npm install )。

The error I get is: 我得到的错误是:

npm install
npm ERR! git clone git@my.domain.com:developers/my-repo.git Cloning into bare repository '/home/gitlab_ci_runner/.npm/_git-remotes/git-my-domain-com-developers-my-git-26043eba'...
npm ERR! git clone git@my.domain.com:developers/my-repo.git
npm ERR! git clone git@my.domain.com:developers/my-repo.git Host key verification failed.
npm ERR! git clone git@my.domain.com:developers/my-repo.git fatal: The remote end hung up unexpectedly
npm ERR! Error: Command failed: Host key verification failed.
npm ERR! fatal: The remote end hung up unexpectedly
npm ERR! 
npm ERR!     at ChildProcess.exithandler (child_process.js:658:15)
npm ERR!     at ChildProcess.emit (events.js:98:17)
npm ERR!     at maybeClose (child_process.js:766:16)
npm ERR!     at Socket.<anonymous> (child_process.js:979:11)
npm ERR!     at Socket.emit (events.js:95:17)
npm ERR!     at Pipe.close (net.js:466:12)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Linux 3.2.0-68-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! cwd /home/gitlab_ci_runner/gitlab-ci-runner/tmp/builds/project-9
npm ERR! node -v v0.10.37
npm ERR! npm -v 1.4.28
npm ERR! code 128
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/gitlab_ci_runner/gitlab-ci-runner/tmp/builds/project-9/npm-debug.log
npm ERR! not ok code 0

What are we missing? 我们缺少什么? I need a solution that doesn't require me to change the URL in the package.json . 我需要一个不需要我更改package.json的URL的解决方案。

You need to put the correct host ( my.domain.com ) key in your ~/.ssh/known_hosts on the CI server. 您需要在CI服务器上的~/.ssh/known_hosts放置正确的主机( my.domain.com )密钥。

Usually just removing the line with the key from ~/.ssh/known_hosts , and then ssh ing into it at least once to cache the key. 通常只是移除从关键线路~/.ssh/known_hosts ,然后ssh荷兰国际集团到它至少一次缓存的关键。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM