Commit 2fdd4ce2 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '277398-follow-up-from-resolve-admin-license-timeout-on-large-instances' into 'master'

Add danger alert for misplaced changelogs with db changes

See merge request gitlab-org/gitlab!48401
parents dbb363fd 16792fd7
...@@ -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