Skip to content

Make it easy for includes to add jobs at beginning/end of pipeline

What does this MR do?

Related issue #31441 (closed)
Documentation MR: !18664 (merged)

This adds two new pre-defined stages called .pre and .post to pipelines. These exist alongside the other predefined stages, build, test, deploy, and are sequenced as follows:

  • .pre
  • build
  • test
  • deploy
  • .post

.pre would always be guaranteed to be the first stage, and .post would always be guaranteed to be the last.
Unlike build, test, deploy, these stages can not be overriden and they will always be present in the pipeline, wrapping the user defined stages.

If you write a job in your include that needs to run at the beginning, you'd insert it as follows:

my_job:
  stage: .pre

Any other includes that also need to run at the beginning would use this pre-defined .pre stage, and all of these would run in parallel. .post is used and works the same, but is always at the end of the pipeline.

Does this MR meet the acceptance criteria?

Conformity

Performance and Testing

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 Marius Bobin

Merge request reports