VirtualBox执行程序失败,并显示“准备环境:进程退出,状态为1” [英] VirtualBox executer fails with “prepare environment: Process exited with status 1”
问题描述
我使用 gitlab-runner register
并选择 virtualbox
作为执行者,注册了VirtualBox CI运行程序。
但是,如果我在Gitlab中启动运行器管道,它将失败并显示以下错误:
PS:我使用的是macOS 10.15.5,VirtualBox运行Ubuntu 20.04 LTS。
文档中提到:
对于某些执行者,Runner将通过
-登录
标志,如上所示,加载外壳程序配置文件。
.bashrc
,.bash_logout
中的所有内容
如果作业在准备环境阶段失败,则可能是Shell配置文件中的某些原因导致了失败。一个常见的失败是当您有一个
.bash_logout
试图清除控制台时。
所以首先检查 .bashrc
, .bash_logout
或VM计算机<$ c $中任何其他点文件的内容c> $ HOME 帐户。
该步骤被标记为系统故障的事实。表示您正在根据合并请求1915 <使用GitLab 13.1(2020年6月)。
将此标记为系统故障将使
用户更清楚问题出在Runner环境,我们在
文档中添加了一个链接,以使他们更容易理解
可能发生的情况。
相同的MR很好地说明了可能是什么问题:
最简单的测试方法是使用 shell执行器。
更新您的bash个人资料以错误退出:
echo exit 1; > 〜/ .bash_logout
运行
gitlab-runner
作为具有.bash_logut
和exit 1
命令的用户
如果您想在
master
分支中看到错误,请确保您有一个空的/构建目录,以便可以看到错误:cd
错误。master
上没有这样的文件或目录
再次:如果在您的 .bashrc
/ .bash_logout
或VM计算机 $ HOME
帐户中的任何其他点文件,有一条命令失败(状态错误!= 0),则会触发该错误消息。
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.
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.
Update your bash profile to exit with error:
echo "exit 1" > ~/.bash_logout
Run
gitlab-runner
as the user that has the.bash_logut
with theexit 1
commandIf 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 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.
这篇关于VirtualBox执行程序失败,并显示“准备环境:进程退出,状态为1”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!