Skip to content

Commit ef6d24a

Browse files
authored
CI require a 'lgtm' or 'ok-to-test' labels to pass (#11251)
- Require a 'lgtm' or 'ok-to-test' label for running CI after the moderator stage Signed-off-by: ant31 <[email protected]>
1 parent 6cf11a9 commit ef6d24a

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

.gitlab-ci.yml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
stages:
33
- build
44
- unit-tests
5-
- deploy-part1
65
- moderator
6+
- deploy-part1
77
- deploy-part2
88
- deploy-part3
99
- deploy-special
@@ -65,14 +65,30 @@ before_script:
6565

6666
# For failfast, at least 1 job must be defined in .gitlab-ci.yml
6767
# Premoderated with manual actions
68-
ci-authorized:
69-
extends: .job
68+
ci-not-authorized:
7069
stage: moderator
70+
before_script: []
71+
after_script: []
72+
rules:
73+
# LGTM or ok-to-test labels
74+
- if: $PR_LABELS =~ /.*,(lgtm|ok-to-test).*|^(lgtm|ok-to-test).*/i
75+
variables:
76+
CI_OK_TO_TEST: '0'
77+
when: always
78+
- if: $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "trigger"
79+
variables:
80+
CI_OK_TO_TEST: '0'
81+
- if: $CI_COMMIT_BRANCH == "master"
82+
variables:
83+
CI_OK_TO_TEST: '0'
84+
- when: always
85+
variables:
86+
CI_OK_TO_TEST: '1'
7187
script:
72-
- /bin/sh scripts/premoderator.sh
73-
except: ['triggers', 'master']
74-
# Disable ci moderator
75-
only: []
88+
- exit $CI_OK_TO_TEST
89+
tags:
90+
- light
91+
7692

7793
include:
7894
- .gitlab-ci/build.yml

0 commit comments

Comments
 (0)