Commit 1d5eecc7 authored by Sean McGivern's avatar Sean McGivern

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

[EE] Move Danger to test stage

Closes gitlab-ce#49185

See merge request gitlab-org/gitlab-ee!6531
parents 2497cd1e d5dcf9ab
......@@ -483,25 +483,6 @@ ee-specific-lines-check:
script:
- scripts/ee-specific-lines-check
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
......@@ -592,6 +573,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
# EE jobs
rspec-pg-ee 0 2: *rspec-ee-pg
rspec-pg-ee 1 2: *rspec-ee-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