Skip to content

shell executor failing due to .bash_logout

Summary

Using the shell executor, jobs fail if there is a .bash_logout containing a command which exits with non-zero status.

Steps to reproduce

  1. Set up gitlab-runner to run with shell executor, as a non-root user

  2. Create or edit the user's ~/.bash_logout file and insert a line:

    false

  3. Start the runner with "gitlab-runner run"

  4. Trigger a build (push a commit, or retry a previously run pipeline)

Actual behavior

Output is seen similar to this:

Running with gitlab-runner 11.5.0 (3afdaba6)
  on my-ci-runner 0078f850
Using Shell executor...
Running on freia013...
bash: line 59: cd: /home/chah/builds/0078f850/0/chah/glr-test: No such file or directory
ERROR: Job failed: exit status 1
  • The Prepare stage fails
  • gitlab-runner does not report this failure
  • gitlab-runner then appears to try to run a GetSources stage, without writing any commands into the script to achieve that; as a result, there is no cloned repository into which it can cd.

Expected behavior

The runner should fetch/clone the repository and run the test script

Suggested fix

Output "set +e" before "exit 0" when generating shell scripts.

Relevant logs and/or screenshots

See my forum post for config.toml .gitlab-ci.yml and other gory details.

Environment description

GitLab Community Edition 11.0.1

gitlab-runner being run on a separate linux x64_64 host.

Used GitLab Runner version

Version: 11.5.0 Git revision: 3afdaba6 Git branch: 11-5-stable GO version: go1.8.7 Built: 2018-11-22T09:20:06+0000 OS/Arch: linux/amd64

Edited by Colin Hogben