ssh - Gitlab CI、ssh 运行程序

标签 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

在我的服务器上,我创建了 ssh key ,该 key 位于目录 ~/.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 应用程序时,我必须如何在服务器上配置我的运行器?

最佳答案

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

查找/-name'config.toml'

如果结果是

/etc/gitlab-runner/config.toml

您以root身份运行运行者。并且您需要指定完整路径,例如 /root/.ssh/id_rsa

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

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

<小时/>

我相信如果不是root,它就是gitlab-runner

关于ssh - Gitlab CI、ssh 运行程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40657461/

相关文章:

macos - Gitlab CI 无法获取 repo,因为一直要求输入钥匙串(keychain)密码

docker - 用于通过 gitlab-ci 将 minio docker 容器作为服务运行以进行测试的配置

gitlab - 无法获取 .gitlab-ci.yaml 中工作的 !reference

gitlab - 如何使 Gitlab CI shell runner 上的构建失败

git - 无法从远程克隆 repo - ssh key 识别错误

visual-studio-code - VScode 远程连接错误 : The process tried to write to a nonexistent pipe

gitlab - 在 ECS 集群上安装 Gitlab 运行器

linux - 为每个服务器上的多个用户生成 ssh-key 文件

javascript - '类型错误 : Object is not a function' when using tunnel-ssh

gitlab - 当我们在前一阶段失败时如何停止 gitlab-ci.yml 中的工作