3

Gitlab-CI seems allow the build to succeed even though the script is returning a non-zero exit. I have the following minimal .gitlab-ci.yml:

# Run linter
lint:
  stage: build
  script:
    - exit 1

Producing the following result:

Running with gitlab-runner 11.1.0 (081978aa)
  on gitlab-runner 72348d01
Using Shell executor...
Running on [hostname]
Fetching changes...
HEAD is now at 9f6f309 Still having problems with gitlab-runner
From https://[repo]
   9f6f309..96fc77b  dev        -> origin/dev
Checking out 96fc77bb as dev...
Skipping Git submodules setup
$ exit 1
Job succeeded

Running on GitLab Community Edition 9.5.5 with gitlab-runner version 11.1.0. Closest post doesn't propose a resolution nor does this issue. A related question shows this setup should fail.

What are the conditions of failing a job? Isn't it a non-zero return code?

nuric
  • 11,027
  • 3
  • 27
  • 42

1 Answers1

0

The cause of the problem was su was wrapped to call ksu as the shared machines are authenticated using Kerberos. In that case the wrapped ksu succeeds even though the script command might fail, indicating the job succeeded. This affected gitlab-runner since the shell executor was running su to run as the indicated user.

nuric
  • 11,027
  • 3
  • 27
  • 42