Commit 0cc4a51c authored by Albert Salim's avatar Albert Salim

Merge branch 'test-danger-local' into 'master'

Add a new job running danger as local to test it

See merge request gitlab-org/gitlab!66171
parents 370f2a34 72421e8e
......@@ -247,10 +247,14 @@ danger-review:
script:
- >
if [ -z "$DANGER_GITLAB_API_TOKEN" ]; then
# 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.
run_timed_command "bundle exec danger dry_run --fail-on-errors=true --verbose --base='$CI_MERGE_REQUEST_DIFF_BASE_SHA'"
run_timed_command danger_as_local
else
run_timed_command "bundle exec danger --fail-on-errors=true --verbose"
fi
danger-review-local:
extends:
- danger-review
- .review:rules:danger-local
script:
- run_timed_command danger_as_local
......@@ -330,6 +330,12 @@
- ".dockerignore"
- "qa/**/*"
.code-backstage-danger-patterns: &code-backstage-danger-patterns
# Backstage changes
- "Dangerfile"
- "danger/**/*"
- "tooling/danger/**/*"
################
# Shared rules #
################
......@@ -1284,6 +1290,11 @@
rules:
- if: '$CI_MERGE_REQUEST_IID'
.review:rules:danger-local:
rules:
- if: '$CI_MERGE_REQUEST_IID'
changes: *code-backstage-danger-patterns
###############
# Setup rules #
###############
......
......@@ -40,7 +40,7 @@ function bundle_install_script() {
bundle config set path 'vendor'
bundle config set clean 'true'
echo $BUNDLE_WITHOUT
echo "${BUNDLE_WITHOUT}"
bundle config
run_timed_command "bundle install ${BUNDLE_INSTALL_FLAGS} ${extra_install_args} && bundle check"
......@@ -134,3 +134,10 @@ function fail_pipeline_early() {
scripts/api/cancel_pipeline.rb
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