Commit 72421e8e authored by Lin Jen-Shin's avatar Lin Jen-Shin

Add a new job running danger as local to test it

parent d1d85326
...@@ -247,10 +247,14 @@ danger-review: ...@@ -247,10 +247,14 @@ danger-review:
script: script:
- > - >
if [ -z "$DANGER_GITLAB_API_TOKEN" ]; then if [ -z "$DANGER_GITLAB_API_TOKEN" ]; then
# Force danger to skip CI source GitLab and fallback to "local only git repo". run_timed_command danger_as_local
unset GITLAB_CI
# We need to base SHA to help danger determine the base commit for this shallow clone.
run_timed_command "bundle exec danger dry_run --fail-on-errors=true --verbose --base='$CI_MERGE_REQUEST_DIFF_BASE_SHA'"
else else
run_timed_command "bundle exec danger --fail-on-errors=true --verbose" run_timed_command "bundle exec danger --fail-on-errors=true --verbose"
fi fi
danger-review-local:
extends:
- danger-review
- .review:rules:danger-local
script:
- run_timed_command danger_as_local
...@@ -330,6 +330,12 @@ ...@@ -330,6 +330,12 @@
- ".dockerignore" - ".dockerignore"
- "qa/**/*" - "qa/**/*"
.code-backstage-danger-patterns: &code-backstage-danger-patterns
# Backstage changes
- "Dangerfile"
- "danger/**/*"
- "tooling/danger/**/*"
################ ################
# Shared rules # # Shared rules #
################ ################
...@@ -1284,6 +1290,11 @@ ...@@ -1284,6 +1290,11 @@
rules: rules:
- if: '$CI_MERGE_REQUEST_IID' - if: '$CI_MERGE_REQUEST_IID'
.review:rules:danger-local:
rules:
- if: '$CI_MERGE_REQUEST_IID'
changes: *code-backstage-danger-patterns
############### ###############
# Setup rules # # Setup rules #
############### ###############
......
...@@ -134,3 +134,10 @@ function fail_pipeline_early() { ...@@ -134,3 +134,10 @@ function fail_pipeline_early() {
scripts/api/cancel_pipeline.rb scripts/api/cancel_pipeline.rb
fi fi
} }
function danger_as_local() {
# Force danger to skip CI source GitLab and fallback to "local only git repo".
unset GITLAB_CI
# We need to base SHA to help danger determine the base commit for this shallow clone.
bundle exec danger dry_run --fail-on-errors=true --verbose --base="${CI_MERGE_REQUEST_DIFF_BASE_SHA}"
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment