Gitlab CI,SSH Runner

6
当我尝试在部署控制台创建ssh运行程序时,出现以下错误:
Running with gitlab-ci-multi-runner 1.7.1 (f896af7)
Using SSH executor...
ERROR: Preparation failed: open ~/.ssh/id_rsa.pub: no such file or directory
Will be retried in 3s ...
Using SSH executor...
ERROR: Preparation failed: open ~/.ssh/id_rsa.pub: no such file or directory
Will be retried in 3s ...
Using SSH executor...
ERROR: Preparation failed: open ~/.ssh/id_rsa.pub: no such file or directory
Will be retried in 3s ...
ERROR: Build failed (system failure): open ~/.ssh/id_rsa.pub: no such file or directory

在我的服务器上,我创建了SSH密钥,并将该密钥保存在目录~/.ssh/id_rsa.pub中。 我的.gitlab-ci.yml文件:
stages:
- deploy
before_script:
    - whoami
mate-finder:
  stage: deploy
  script:
    - sudo apt-get update -qy
    - sudo apt-get install -y nodejs
    - sudo npm install
    - sudo ng build
    - sudo ng serve

我该如何在服务器上部署我的应用程序?当我想要在服务器上部署我的Angular2应用程序时,我必须如何配置我的运行环境?


我看到你在那里执行了一个“whoami”。我的第一反应是家目录没有对齐。 - louahola
@louahola 当我将id_rsa.pub移动到另一个目录时,问题并没有得到解决。 - srzeppa
https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/issues/202;我会试一下 - louahola
2个回答

2

您需要检查 config.toml 的位置。您可以通过搜索来执行此操作。

find / -name 'config.toml'

如果结果为

/etc/gitlab-runner/config.toml

你正在以“root”身份运行runner。你需要指定完整路径,例如“/root/.ssh/id_rsa”。
如果不是这样,你正在以其他用户身份运行它,需要指定目录,例如“/home/user/.ssh/id_rsa”。
要查找你是哪个用户,请注册“shell”执行器并运行“pwd”或“whoami”。

我相信如果不是 root 的话,它应该是 gitlab-runner


0
在我的情况下,我将~/.ssh/id_rsa路径更改为/root/id_rsa
当我在config.toml中更改时没有起作用,但重新配置运行程序可以解决问题。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接