Skip to content

Commit

Permalink
CI require a 'lgtm' or 'ok-to-test' labels to pass (kubernetes-sigs#1…
Browse files Browse the repository at this point in the history
…1251)

- Require a 'lgtm' or 'ok-to-test' label for running CI after the
  moderator stage

Signed-off-by: ant31 <[email protected]>
  • Loading branch information
ant31 authored May 31, 2024
1 parent 6cf11a9 commit ef6d24a
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
stages:
- build
- unit-tests
- deploy-part1
- moderator
- deploy-part1
- deploy-part2
- deploy-part3
- deploy-special
Expand Down Expand Up @@ -65,14 +65,30 @@ before_script:

# For failfast, at least 1 job must be defined in .gitlab-ci.yml
# Premoderated with manual actions
ci-authorized:
extends: .job
ci-not-authorized:
stage: moderator
before_script: []
after_script: []
rules:
# LGTM or ok-to-test labels
- if: $PR_LABELS =~ /.*,(lgtm|ok-to-test).*|^(lgtm|ok-to-test).*/i
variables:
CI_OK_TO_TEST: '0'
when: always
- if: $CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "trigger"
variables:
CI_OK_TO_TEST: '0'
- if: $CI_COMMIT_BRANCH == "master"
variables:
CI_OK_TO_TEST: '0'
- when: always
variables:
CI_OK_TO_TEST: '1'
script:
- /bin/sh scripts/premoderator.sh
except: ['triggers', 'master']
# Disable ci moderator
only: []
- exit $CI_OK_TO_TEST
tags:
- light


include:
- .gitlab-ci/build.yml
Expand Down

0 comments on commit ef6d24a

Please sign in to comment.