GitLab CI job does not fail on non-zero exit code

Summary

Consider this .gitlab-ci.yml:

test:
  script:
    - false && true
    - echo why???

Which passes (see example), despite false && true exits with non-zero exit code. This can be observed by running below lines in any reasonable shell:

$ false && true
$ echo $?
1

This behaviour has been previously reported in gitlab-foss#20731 (comment 21596358).

Steps to reproduce

Example above should be pretty self-contained. Also see example project below.

Example Project

https://gitlab.com/yaroslav.admin/gitlab-ci-bug

What is the current bug behavior?

Job passes despite command exiting with non-zero exit code.

What is the expected correct behavior?

Job fails when command exits with non-zero exit code.

Relevant logs and/or screenshots

See job logs.

Output of checks

This bug happens on GitLab.com

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

(If you can, link to the line of code that might be responsible for the problem)

Edited Aug 27, 2020 by Yaroslav Admin
Assignee Loading
Time tracking Loading