问题
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
--loginflag 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_logoutthat 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.
Update your bash profile to exit with error:
echo "exit 1" > ~/.bash_logoutRun
gitlab-runneras the user that has the.bash_logutwith theexit 1commandIf you want to see the error in the
masterbranch, make sure you have an empty /builds directory so that you can see the error:cd No such file or directoryerror onmaster.
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