diff --git a/.common-ci.yml b/.common-ci.yml index 7a8b5135..926854c3 100644 --- a/.common-ci.yml +++ b/.common-ci.yml @@ -23,6 +23,7 @@ variables: BUILD_MULTI_ARCH_IMAGES: "true" stages: + - trigger - image - lint - go-checks @@ -34,22 +35,44 @@ stages: - scan - release -workflow: +.pipeline-trigger-rules: rules: - - if: $CI_PIPELINE_SOURCE == 'merge_request_event' + # We trigger the pipeline if started manually - if: $CI_PIPELINE_SOURCE == "web" + # We trigger the pipeline on the main branch - if: $CI_COMMIT_BRANCH == "main" + # We trigger the pipeline on the release- branches - if: $CI_COMMIT_BRANCH =~ /^release-.*$/ + # We trigger the pipeline on tags - if: $CI_COMMIT_TAG && $CI_COMMIT_TAG != "" +workflow: + rules: + # We trigger the pipeline on a merge request + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' + # We then add all the regular triggers + - !reference [.pipeline-trigger-rules, rules] + +# The main or manual job is used to filter out distributions or architectures that are not required on +# every build. .main-or-manual: rules: - - if: $CI_COMMIT_BRANCH == "main" - - if: $CI_COMMIT_BRANCH =~ /^release-.*$/ - - if: $CI_COMMIT_TAG && $CI_COMMIT_TAG != "" + - !reference [.pipeline-trigger-rules, rules] - if: $CI_PIPELINE_SOURCE == "schedule" when: manual +# The trigger-pipeline job adds a manualy triggered job to the pipeline on merge requests. +trigger-pipeline: + stage: trigger + script: + - echo "starting pipeline" + rules: + - !reference [.main-or-manual, rules] + - if: $CI_PIPELINE_SOURCE == "merge_request_event" + when: manual + allow_failure: false + - when: always + # Define the distribution targets .dist-amazonlinux2: rules: diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f3f2e14d..7a338002 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,11 +22,6 @@ build-dev-image: - make .build-image - docker login -u "${CI_REGISTRY_USER}" -p "${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY}" - make .push-build-image - rules: - - !reference [.main-or-manual, rules] - - if: $CI_PIPELINE_SOURCE == 'merge_request_event' - when: manual - - when: always .requires-build-image: image: "${BUILDIMAGE}"