Skip to content

Make it possible to control build status using exit codes

Description

It may be an interesting feature to be able to control build status using .gitlab-ci.yml and exit codes.

Using the environment variables may be quite simple yet powerful approach.

Proposal

New proposal

my-job:
  script:
    - echo Hello world!
  status:
    success: [0, 21]
    warning: [3]

Old proposal

my-job:
  variables:
    SKIP_EXIT_STATUS: 137
    CANCEL_EXIT_STATUS: 138
  script: # ...

References

It would be used by https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8121

Idea from @ayufan during Slack conversation :)

Edited by Grzegorz Bizon