Jobs Run with Skipped Needs

Summary

When a job is canceled (or fails) and its dependencies are skipped, jobs that depend on the skipped jobs using needs start running.

Steps to reproduce

stages: [build, test, deploy]

image: busybox

Build:
  stage: build
  script:
  - sleep 30
  - exit 1

Test:
  stage: test
  script:
  - sleep 30

Deploy:
  stage: deploy
  script:
  - sleep 30
  needs:
  - Test
  1. Start the pipeline
  2. Cancel the first job

Example Project

https://gitlab.com/deckar01/gitlab-ce-permissions-test/pipelines/111850213

What is the current bug behavior?

The jobs that "need" the canceled job are skipped, but the jobs that "need" the skipped job are executed. Jobs that error (rather than being canceled) also fail to prevent the transitive dependent from running.

What is the expected correct behavior?

Jobs that "need" skipped jobs should also be skipped. Implicit stage dependencies and explicit dependencies behave correctly.

Relevant logs and/or screenshots

Needs behavior:

Screen_Shot_2020-01-23_at_2.03.05_PM

Default behavior:

Screen_Shot_2020-01-23_at_2.09.22_PM

Output of checks

This bug happens on GitLab.com

Edited by Jared Deckard