Skip to content

Gitlab CI script doesn't pass exit code of previous command properly

Example gitlab-ci.yml:

build_1:
  script:
    - false && true
    - echo $?

Current build result:

gitlab-ci-multi-runner 1.3.2 (0323456)
Using Shell executor...
Running on gitlabci-runner03...
Fetching changes...
HEAD is now at 9f64dee Test commit
From https://myserver/gdubicki/gitlab-ci-test
 * [new branch]      test-false-and-true -> origin/test-false-and-true
Checking out 810aa8c5 as test-false-and-true...
$ false && true
$ echo $?
0

Build succeeded

Expected build result:

like above but echo $? should print 1 instead of 0.

Edited by Greg Dubicki