Job with needs will run even when needed job does not

Summary

A job with needs will run even if the job it needs does not if, for instance, a prior stage fails.

Steps to reproduce

The following .gitalb-ci.yml file will induce the error.

stages:
  - one
  - two
  - three

one:
  stage: one
  script:
    - exit 1

two:
  stage: two
  script:
    - echo "two"

three:
  stage: three
  script:
    - echo "three"
  needs:  ["two"]

What is the current bug behavior?

  • job one fails, as expected.
  • job two is skipped, as expected.
  • job three, which 'needs' job two, runs.

What is the expected correct behavior?

  • job one fails.
  • job two is skipped.
  • job three is skipped.

Results of GitLab environment info

12.5.0-ee

Assignee Loading
Time tracking Loading