@@ -25,13 +25,16 @@ stages:
25
25
- test
26
26
- fuzz
27
27
28
- # Do not run the test stage on pipeline schedule trigger.
29
28
.base_rules_for_test_jobs : &rules_for_test_stage
30
29
rules :
31
- - if : $CI_PIPELINE_SOURCE != 'schedule'
32
- when : always
30
+ # Do not run the test stage on pipeline schedule trigger.
33
31
- if : $CI_PIPELINE_SOURCE == 'schedule'
34
32
when : never
33
+ # Prevent duplicate pipelines.
34
+ - if : $CI_OPEN_MERGE_REQUESTS && $CI_COMMIT_BRANCH == null
35
+ when : never
36
+ # On any other event, including push to MR branch and push to master.
37
+ - when : always
35
38
36
39
are-database-scripts-in-sync :
37
40
stage : test
@@ -155,15 +158,17 @@ fuzz:
155
158
matrix :
156
159
- SANITIZER : [address, undefined]
157
160
rules :
161
+ # Prevent duplicate pipelines.
162
+ - if : $CI_OPEN_MERGE_REQUESTS && $CI_COMMIT_BRANCH == null
163
+ when : never
158
164
# On merge request.
159
- - if : $CI_PIPELINE_SOURCE == "merge_request_event"
165
+ - if : $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
160
166
variables :
161
167
MODE : " code-change"
162
168
when : manual
163
169
allow_failure : true
164
- # And on push to master.
165
- - if : $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
166
- when : always
170
+ # Run on any other event, including push to MR branch and push to master.
171
+ - when : always
167
172
before_script :
168
173
# Get GitLab's container id.
169
174
- export CFL_CONTAINER_ID=`docker ps -q -f "label=com.gitlab.gitlab-runner.job.id=$CI_JOB_ID" -f "label=com.gitlab.gitlab-runner.type=build"`
@@ -313,6 +318,10 @@ flawfinder-sast:
313
318
when : never
314
319
- if : $SAST_EXCLUDED_ANALYZERS =~ /flawfinder/
315
320
when : never
321
+ # Prevent duplicate pipelines.
322
+ - if : $CI_OPEN_MERGE_REQUESTS && $CI_COMMIT_BRANCH == null
323
+ when : never
324
+ # Run on any other event, including push to master.
316
325
- when : always
317
326
318
327
semgrep-sast :
@@ -322,6 +331,8 @@ semgrep-sast:
322
331
when : never
323
332
- if : $CI_PIPELINE_SOURCE == 'schedule'
324
333
when : never
325
- - if : $SAST_EXCLUDED_ANALYZERS =~ /semgrep/
334
+ # Prevent duplicate pipelines.
335
+ - if : $CI_OPEN_MERGE_REQUESTS && $CI_COMMIT_BRANCH == null
326
336
when : never
337
+ # Run on any other event, including push to MR branch and push to master.
327
338
- when : always
0 commit comments