LoginSignup
2
1

More than 5 years have passed since last update.

[gitlab-runner] Shell executorが古いファイルの削除ができずfetchに失敗する

Posted at

一度pushして、テストを行なった後再度テスト行うと以下のようなエラーが発生した。

Running with gitlab-ci-multi-runner 1.6.1 (c52ad4f)
Using Shell executor...
Running on ubuntu-vm...
Fetching changes...
warning: failed to remove dist/app.html
...
ERROR: Build failed: exit status 1

https://gitlab.com/gitlab-org/gitlab-runner/issues/1839 から抜粋した。
↑によると権限の問題でgit cleanができないことが問題らしい。
実際手動で前のテストでcloneされたものを削除したところ正常に実行できた。

実行中のgitlab-runnerのserviceを下記のコマンドで調べてみる。

# ps aux | grep gitlab

その結果、--user gitlab-runnerとなっており、実際にテストを行う時はgitlab-runnerというuserで実行していることがわかった。
このserviceはregister時にinstallされたものをそのまま使っていた。
一度これを

# gitlab-runner uninstall

で削除する。その後

# gitlab-runner install --working-directory /home/gitlab-runner --config /etc/gitlab-runner/config.toml --service gitlab-runner --user root
# gitlab-runner start

でuserをrootに指定してinstallし、serviceをstartさせる。

この後再度pushを行なったところ問題なく実行できた。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1