CICD, Rules and pipelines
job01: ... rules: - 'something' job02: ... rules: - 'else' job03: ...
This ends up in two pipelines:
- Pipeline 1:
job01, job02, job03in the default pipeline context
- Pipeline 2:
job01, job02in the MR pipeline context.
rules in Pipeline 2, only the jobs containing the
rules parameter are used. In combination with
needs dependencies might not be met and the pipeline run in the MR context can fail.
Found errors in your .gitlab-ci.yml: * 'job x' job needs 'job y' job but 'job y' is not in any previous stage 'job x' job needs 'job z' job but 'job z' is not in any previous stage
The reason why the usage of "rules" starts its own pipeline-run is unclear.
The suggested solution is to either
- To disable the run of pipelines in the MR context on a per job basis or
- if: $CI_MERGE_REQUEST_ID
- when: always
- to disable the run of pipelines in the MR context globally for the complete pipeline configuration for a given project.
workflow: rules: - if: $CI_MERGE_REQUEST_ID when: never - when: always ```