Gitlab CI,SSH运行程序

srz*_*ppa 5 ssh gitlab gitlab-ci

当我尝试在部署控制台中创建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
Run Code Online (Sandbox Code Playgroud)

在我的服务器上,我创建了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
Run Code Online (Sandbox Code Playgroud)

如何在服务器上部署应用程序?当我想在其上部署我的angular2应用程序时,如何在服务器上配置我的运行程序?

Ale*_*ndr 2

您需要检查 config.toml 的放置位置。您可以通过搜索来完成。

find / -name 'config.toml'

如果结果是

/etc/gitlab-runner/config.toml

你作为跑步者root。并且您需要指定完整路径,例如/root/.ssh/id_rsa.

如果没有 - 您在其他用户下运行它,并且您需要指定目录,例如/home/user/.ssh/id_rsa.

要找出您是哪个用户 - 注册shell执行器并运行pwdwhoami


gitlab-runner我相信如果没有的话也会是这样root