VirtualBox executer fails with “prepare environment: Process exited with status 1”

耗尽温柔 提交于 2020-08-05 09:37:17

问题


I registered the VirtualBox CI runner using gitlab-runner register and by choosing virtualbox as an executor.

However, if I start the runner pipeline in Gitlab, it fails with the following error:

What would be causing this error and how to fix it?

Here's a link mentioned in the error message: https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading

P.S: I'm using macOS 10.15.5 and the VirtualBox runs Ubuntu 20.04 LTS.


回答1:


The documentation mentions:

For certain executors, the Runner will pass the --login flag as shown above, which also loads the shell profile.
Anything that you have in your .bashrc, .bash_logout, or any other dotfile, will be executed in your job.

If a job fails on the Prepare environment stage, it is likely that something in the shell profile is causing the failure. A common failure is when you have a .bash_logout that tries to clear the console.

So check first the content of your .bashrc, .bash_logout, or any other dotfile in the VM machine $HOME account.

The fact that step is marked as a "system failure" means you are using GitLab 13.1 (June 2020), per Merge Request 1915.

Having this marked as a system failure would make it more clear to the user that the problem is with the Runner environment, we add a link to the documentation to make it more simple for them to understand what might be going on.

The same MR gives a good illustration of what a problem might be:

The easiest way to test this is to use the shell executor.

  1. Update your bash profile to exit with error:

    echo "exit 1" > ~/.bash_logout
    
  2. Run gitlab-runner as the user that has the .bash_logut with the exit 1 command

  3. If you want to see the error in the master branch, make sure you have an empty /builds directory so that you can see the error: cd No such file or directory error on master.

Again: if, on your .bashrc/.bash_logout, or any other dotfile in the VM machine $HOME account, there is a command which fails (status error != 0), that would trigger that error message.



来源:https://stackoverflow.com/questions/63083624/virtualbox-executer-fails-with-prepare-environment-process-exited-with-status

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!