Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gitlab CI, ssh runner

When I try to create ssh runner in deploy console I have this error:

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

On my server I created ssh key, and this key is in directory ~/.ssh/id_rsa.pub. My .gitlab-ci.yml file:

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

How can I deploy my application on server? How must I configure my runner on the server, when I want to deploy my angular2 application on it?

like image 928
srzeppa Avatar asked Nov 17 '16 14:11

srzeppa


1 Answers

You need to check, where config.toml is placed. You can do it with a search.

find / -name 'config.toml'

If result would be

/etc/gitlab-runner/config.toml

You running runner as root. And you need to specify full path like /root/.ssh/id_rsa.

If no - you running it under other user and you'll need to specify directory like /home/user/.ssh/id_rsa.

To find out which user you are - register shell executor and run pwd or whoami


I believe it would be gitlab-runner if not root.

like image 65
Alexandr Avatar answered Oct 01 '22 15:10

Alexandr