Skip to content

Commit bb765e7

Browse files
committed
chore: Do not use gitlab merge request pipelines
## Summary If we define pipelines to trigger on merge requests, they will take precedence over branch pipelines, which is currently the way our old pipelines are still triggered. This means that we can have a merge request with green pipelines, but actually the external pipelines failed. Therefore, we need to only rely on branch pipelines, to ensure that we don't ignore the results from external pipelines. More information here: - https://forum.gitlab.com/t/merge-request-considering-merge-request-pipelines-instead-of-branch-pipelines/111248/2 - https://docs.gitlab.com/17.6/ci/jobs/job_rules/#run-jobs-only-in-specific-pipeline-types
1 parent 1008160 commit bb765e7

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

.gitlab-ci.yml

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,30 @@ default:
2020
exit 0
2121
fi
2222
23+
## A set of predefined rules to use on the different jobs
24+
.default_rules:
25+
# Rules to run the job only on the master branch
26+
run_on_master:
27+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
28+
when: always
29+
- when: never
30+
# Rules to run the job only on branches that are not master. This is needed because for now
31+
# we need to keep a similar behavior due to the integration with teamcity, which requires us
32+
# to not trigger pipelines on tags and/or merge requests.
33+
run_on_branch:
34+
- if: $CI_COMMIT_TAG
35+
when: never
36+
- if: $CI_PIPELINE_SOURCE != "merge_request_event" && $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
37+
when: always
38+
- when: never
39+
2340
# -----------------------------------------------
2441
# Stage 1: Build on every PR
2542
# -----------------------------------------------
2643
build_cloudflared_macos: &build
2744
stage: build
2845
rules:
29-
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_COMMIT_BRANCH != "master"
30-
when: always
31-
- when: never
46+
- !reference [.default_rules, run_on_branch]
3247
tags:
3348
- "macstadium-${RUNNER_ARCH}"
3449
parallel:
@@ -55,14 +70,11 @@ build_cloudflared_macos: &build
5570
# -----------------------------------------------
5671
build_and_sign_cloudflared_macos:
5772
<<: *build
58-
extends: .check_tag
5973
rules:
60-
- if: $CI_COMMIT_BRANCH == "master"
61-
when: always
62-
- when: never
74+
- !reference [.default_rules, run_on_master]
6375
secrets:
6476
APPLE_DEV_CA_CERT:
65-
vault: gitlab/cloudflare/tun/cloudflared/_branch/master/apple_dev_ca_cert/data@kv
77+
vault: gitlab/cloudflare/tun/cloudflared/_branch/master/apple_dev_ca_cert_v2/data@kv
6678
file: false
6779
CFD_CODE_SIGN_CERT:
6880
vault: gitlab/cloudflare/tun/cloudflared/_branch/master/cfd_code_sign_cert_v2/data@kv
@@ -93,9 +105,7 @@ release_cloudflared_macos_to_github:
93105
dependencies:
94106
- build_and_sign_cloudflared_macos
95107
rules:
96-
- if: $CI_COMMIT_BRANCH == "master"
97-
when: always
98-
- when: never
108+
- !reference [.default_rules, run_on_master]
99109
cache:
100110
paths:
101111
- .cache/pip

0 commit comments

Comments
 (0)