Skip to content

Explicit `stage` is required with `needs`

Summary

When using needs the stage field becomes required and does not default to test anymore. The following job automatically defaults to the test stage:

my_job:
  script:
    - "true"

This job results in a YAML error complaining that stage must be defined:

my_job:
  script:
    - "true"
  needs: []

This fixes the issue by explicitly defining the implicit stage:

my_job:
  script:
    - "true"
  stage: test
  needs: []

Steps to reproduce

Use needs keyword without a stage directive.

Example Project

N/A

What is the current bug behavior?

The default stage is not used.

What is the expected correct behavior?

The default stage is used.

Relevant logs and/or screenshots

N/A

Output of checks

This bug happens on GitLab.com

Possible fixes

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