Add initial support for DAG
What does this MR do?
This adds a DAG support for GitLab CI. This works.
Design
It implements the simple extension to CI job:
build:
stage: build
script: echo Hello World
setupenv:
stage: build
rspec:
stage: test
needs: [build]
This makes the rspec
to run right after the build
finishes regardless of status of other jobs in stage: build
.
needs:
The logic of - If defined, the
dependencies:
needs to be subset ofneeds:
, - If defined, and the
dependencies:
are not defined, the job will depend by default on all jobs that are defined inneeds:
only, - If defined, runs the pipeline out of order,
- If defined, the
needs:
need to depend on a job from prior stages, - If defined, if the needed job is a parallel, it is expanded to need all parallel jobs,
- If not defined, it runs pipeline as with stages (backward compatibility),
- The
needs:
is opt-in approach, by default pipeline runs in stages, if needs is defined it changes the behaviour of just single job, -
needs: []
is invalid and is todays limitation, so you cannot start the job in second stage withneeds: []
Notes
- It is quite performant, we validate dependent jobs only on finish of the job that this depends on,
- It is backend only, no frontend,
- Actually, this is pretty complete, except tests,
- It should cover every aspect I think: a. parallel, b. validation of dependencies, c. ensure that needs has to be from prior stages, etc.
- The processing part of DAG is currently disabled, and can be enabled with
ci_dag_support
, - The DAG processing is extension to current stages processing, once job finishes it is validated if it affects other jobs, and other jobs can be started then,
Resolves https://gitlab.com/gitlab-org/gitlab-ce/issues/47063
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry for user-facing changes, or community contribution. Check the link for other scenarios. -
Documentation created/updated or follow-up review issue created -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Performance and testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Edited by Kamil Trzciński (Back 2025-01-01)