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 the exit 1
command
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.