Commit 16792fd7 authored by Doug Stull's avatar Doug Stull Committed by Rémy Coutable

Add condition to danger file for changelog placement

- for db changes we should always be in non ee.
parent e67656f5
...@@ -46,13 +46,17 @@ def check_changelog_path(path) ...@@ -46,13 +46,17 @@ def check_changelog_path(path)
ee_changes = helper.all_ee_changes.dup ee_changes = helper.all_ee_changes.dup
ee_changes.delete(path) ee_changes.delete(path)
if ee_changes.any? && !changelog.ee_changelog? if ee_changes.any? && !changelog.ee_changelog? && !changelog.db_changes?
warn "This MR has a Changelog file outside `ee/`, but code changes in `ee/`. Consider moving the Changelog file into `ee/`." warn "This MR has a Changelog file outside `ee/`, but code changes in `ee/`. Consider moving the Changelog file into `ee/`."
end end
if ee_changes.empty? && changelog.ee_changelog? if ee_changes.empty? && changelog.ee_changelog?
warn "This MR has a Changelog file in `ee/`, but no code changes in `ee/`. Consider moving the Changelog file outside `ee/`." warn "This MR has a Changelog file in `ee/`, but no code changes in `ee/`. Consider moving the Changelog file outside `ee/`."
end end
if ee_changes.any? && changelog.ee_changelog? && changelog.db_changes?
warn "This MR has a Changelog file inside `ee/`, but there are database changes which [requires](https://docs.gitlab.com/ee/development/changelog.html#what-warrants-a-changelog-entry) the Changelog placement to be outside of `ee/`. Consider moving the Changelog file outside `ee/`."
end
end end
if git.modified_files.include?("CHANGELOG.md") if git.modified_files.include?("CHANGELOG.md")
......
...@@ -2,9 +2,7 @@ ...@@ -2,9 +2,7 @@
gitlab_danger = GitlabDanger.new(helper.gitlab_helper) gitlab_danger = GitlabDanger.new(helper.gitlab_helper)
SCHEMA_NOT_UPDATED_MESSAGE_SHORT = <<~MSG SCHEMA_NOT_UPDATED_MESSAGE_SHORT = "New %<migrations>s added but %<schema>s wasn't updated"
New %<migrations>s added but %<schema>s wasn't updated.
MSG
SCHEMA_NOT_UPDATED_MESSAGE_FULL = <<~MSG SCHEMA_NOT_UPDATED_MESSAGE_FULL = <<~MSG
**#{SCHEMA_NOT_UPDATED_MESSAGE_SHORT}** **#{SCHEMA_NOT_UPDATED_MESSAGE_SHORT}**
......
...@@ -39,6 +39,7 @@ module Gitlab ...@@ -39,6 +39,7 @@ module Gitlab
def required? def required?
git.added_files.any? { |path| path =~ %r{\Adb/(migrate|post_migrate)/} } git.added_files.any? { |path| path =~ %r{\Adb/(migrate|post_migrate)/} }
end end
alias_method :db_changes?, :required?
def optional? def optional?
categories_need_changelog? && without_no_changelog_label? categories_need_changelog? && without_no_changelog_label?
......
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