Allow `needs: []` to specify a job that can always be started immediately, regardless of stage

Problem to solve

For the MVC of the directed acyclic graph, we're lacking support for defining an empty needs: array to specify that something has no predecessor. If we supported this, users could mark a job in a second or beyond stage as eligible to start immediately.

Intended users

Individual contributor automation engineers

Further details

Consider the following yaml which has a build, setup_test_env, and test job:

build:
  stage: build
  script: echo Hello World

setup_test_env:
  stage: test

test:
  stage: test
  needs: [build, setup_test_env]

With this new keyword, we could allow setup_test_env as follows to allow it to run as soon as the pipeline starts, but still appear in the test stage where it makes more logical sense:

setup_test_env:
  stage: test
  needs: []

Proposal

Allow for needs: [] which will indicate to GitLab that a job, regardless of what stage it's in, can always start immediately.

Permissions and Security

N/A

Documentation

  • We may need to remove: It is impossible for now to have needs: [] (empty needs), the job always needs to depend on something, unless this is the job in the first stage. However, support for an empty needs array is planned.

Testing

What does success look like, and how can we measure that?

Links / references

Edited Feb 15, 2020 by Furkan Ayhan
Assignee Loading
Time tracking Loading