feat(workflow): Provides a common workflow

It runs all pipelines but prevents that a branch pipelines is started when there is an open merge request.

https://docs.gitlab.com/ee/ci/yaml/workflow.html#switch-between-branch-pipelines-and-merge-request-pipelines
This commit is contained in:
Timo Beller 2022-09-20 16:52:35 +02:00
parent 68854a9f3e
commit cd47250147
3 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,12 @@
:gitlab-ci-file: common/common-ci-workflow.gitlab-ci.yml
[[Common-Workflow]]
== Common Workflow
Within the `{gitlab-ci-file}` file we provide a common workflow.
This workflow runs all pipelines (including branch pipelines, tag pipelines, merge request pipelines, triggerd pipelines, shedules-pipelines ...).
However, it prevents that a branch pipeline starts, when there is an open merge request.
To use our common workflow, just import the template.
:template: {gitlab-ci-file}
include::../../../template-printer.adoc[]

View File

@ -35,6 +35,7 @@ toc::[]
include::generalInformation.adoc[leveloffset=1]
include::chapters/templates/common/common-ci-variablen.adoc[leveloffset=1]
include::chapters/templates/common/common-ci-workflow.adoc[leveloffset=1]
== Contribution

View File

@ -0,0 +1,6 @@
workflow:
rules:
# Prevent branch pipelines when there is an open merge request
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
when: never
- when: always