Commit e661896b authored by Sean McGivern's avatar Sean McGivern

Merge branch 'move-danger-to-test-stage' into 'master'

Move Danger to test stage

Closes #49185

See merge request gitlab-org/gitlab-ce!20654
parents aaeec1c1 8ce6381f
......@@ -350,25 +350,6 @@ retrieve-tests-metadata:
- wget -O $FLAKY_RSPEC_SUITE_REPORT_PATH http://${TESTS_METADATA_S3_BUCKET}.s3.amazonaws.com/$FLAKY_RSPEC_SUITE_REPORT_PATH || rm $FLAKY_RSPEC_SUITE_REPORT_PATH
- '[[ -f $FLAKY_RSPEC_SUITE_REPORT_PATH ]] || echo "{}" > ${FLAKY_RSPEC_SUITE_REPORT_PATH}'
danger-review:
image: registry.gitlab.com/gitlab-org/gitaly/dangercontainer:latest
stage: prepare
allow_failure: true
before_script:
- source scripts/utils.sh
- retry gem install danger --no-ri --no-rdoc
cache: {}
only:
refs:
- branches@gitlab-org/gitlab-ce
- branches@gitlab-org/gitlab-ee
except:
variables:
- $CI_COMMIT_REF_NAME =~ /^ce-to-ee-.*/
script:
- git version
- danger --fail-on-errors=true
update-tests-metadata:
<<: *tests-metadata-state
<<: *only-canonical-masters
......@@ -457,6 +438,27 @@ setup-test-env:
- config/secrets.yml
- vendor/gitaly-ruby
danger-review:
image: registry.gitlab.com/gitlab-org/gitaly/dangercontainer:latest
stage: test
allow_failure: true
before_script:
- source scripts/utils.sh
- retry gem install danger --no-ri --no-rdoc
cache: {}
only:
refs:
- branches@gitlab-org/gitlab-ce
- branches@gitlab-org/gitlab-ee
except:
refs:
- master
variables:
- $CI_COMMIT_REF_NAME =~ /^ce-to-ee-.*/
script:
- git version
- danger --fail-on-errors=true
rspec-pg 0 30: *rspec-metadata-pg
rspec-pg 1 30: *rspec-metadata-pg
rspec-pg 2 30: *rspec-metadata-pg
......
......@@ -2,15 +2,13 @@
require 'yaml'
NO_CHANGELOG_LABELS = %w[backstage QA test].freeze
NO_CHANGELOG_LABELS = %w[backstage Documentation QA test].freeze
SEE_DOC = "See [the documentation](https://docs.gitlab.com/ce/development/changelog.html).".freeze
MISSING_CHANGELOG_MESSAGE = <<~MSG.freeze
**[CHANGELOG missing](https://docs.gitlab.com/ce/development/changelog.html).**
CREATE_CHANGELOG_MESSAGE = <<~MSG.freeze
You can create one with:
```
bin/changelog -m %<mr_iid>s
bin/changelog -m %<mr_iid>s "%<mr_title>s"
```
If your merge request doesn't warrant a CHANGELOG entry,
......@@ -56,13 +54,15 @@ changelog_needed = (gitlab.mr_labels & NO_CHANGELOG_LABELS).empty?
changelog_found = git.added_files.find { |path| path =~ %r{\A(ee/)?(changelogs/unreleased)(-ee)?/} }
if git.modified_files.include?("CHANGELOG.md")
fail "CHANGELOG.md was edited. Please remove the additions and create an entry with `bin/changelog -m #{gitlab.mr_json["iid"]}` instead."
fail "**CHANGELOG.md was edited.** Please remove the additions and create a CHANGELOG entry.\n\n" +
format(CREATE_CHANGELOG_MESSAGE, mr_iid: gitlab.mr_json["iid"], mr_title: gitlab.mr_json["title"], labels: presented_no_changelog_labels)
end
if changelog_needed
if changelog_found
check_changelog(changelog_found)
else
warn format(MISSING_CHANGELOG_MESSAGE, mr_iid: gitlab.mr_json["iid"], labels: presented_no_changelog_labels)
warn "**[CHANGELOG missing](https://docs.gitlab.com/ce/development/changelog.html).**\n\n" +
format(CREATE_CHANGELOG_MESSAGE, mr_iid: gitlab.mr_json["iid"], mr_title: gitlab.mr_json["title"], labels: presented_no_changelog_labels)
end
end
NO_SPECS_LABELS = %w[backstage Documentation QA].freeze
NO_NEW_SPEC_MESSAGE = <<~MSG.freeze
You've made some app changes, but didn't add any tests.
That's OK as long as you're refactoring existing code,
but please consider adding the ~backstage label in that case.
but please consider adding any of the %<labels>s labels.
MSG
def presented_no_changelog_labels
NO_SPECS_LABELS.map { |label| "~#{label}" }.join(', ')
end
has_app_changes = !git.modified_files.grep(%r{\A(ee/)?(app|lib|db/(geo/)?(post_)?migrate)/}).empty?
has_spec_changes = !git.modified_files.grep(/spec/).empty?
has_spec_changes = !git.modified_files.grep(%r{\A(ee/)?spec/}).empty?
new_specs_needed = (gitlab.mr_labels & NO_SPECS_LABELS).empty?
if has_app_changes && !has_spec_changes
warn NO_NEW_SPEC_MESSAGE, sticky: false
if has_app_changes && !has_spec_changes && new_specs_needed
warn format(NO_NEW_SPEC_MESSAGE, labels: presented_no_changelog_labels), sticky: false
end
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