Implement needs:job:optional for CI pipelines [RUN ALL RSPEC] [RUN AS-IF-FOSS]
What does this MR do?
This MR adds the support of the optional
attribute for needs
.
More info is available in the documentation change of this MR.
Copied from the new documentation:
Use
optional: false
(default) oroptional: true
to control if the needed job is required to persist in the pipeline.
Related to #30680 (closed)
This is behind a feature flag ci_needs_optional
=> #323891 (closed).
Screenshots (strongly suggested)
Example config:
build:
stage: build
rules:
- if: $CI_COMMIT_REF_NAME == "master"
rspec:
stage: test
needs:
- job: build
optional: true
If the rules
condition is not satisfied;
Before this MR:
After this MR:
Database outputs
Up
== 20210301193412 AddOptionalToCiBuildNeeds: migrating ========================
-- add_column(:ci_build_needs, :optional, :boolean, {:default=>false, :null=>false})
-> 0.0056s
== 20210301193412 AddOptionalToCiBuildNeeds: migrated (0.0056s) ===============
Down
== 20210301193412 AddOptionalToCiBuildNeeds: reverting ========================
-- remove_column(:ci_build_needs, :optional, :boolean, {:default=>false, :null=>false})
-> 0.0099s
== 20210301193412 AddOptionalToCiBuildNeeds: reverted (0.0128s) ===============
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability 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 -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
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 Furkan Ayhan