diff options
Diffstat (limited to 'danger')
-rw-r--r-- | danger/bundle_size/Dangerfile | 6 | ||||
-rw-r--r-- | danger/changelog/Dangerfile | 6 | ||||
-rw-r--r-- | danger/commit_messages/Dangerfile | 13 | ||||
-rw-r--r-- | danger/database/Dangerfile | 4 | ||||
-rw-r--r-- | danger/pipeline/Dangerfile | 19 |
5 files changed, 40 insertions, 8 deletions
diff --git a/danger/bundle_size/Dangerfile b/danger/bundle_size/Dangerfile index a7102cd0e38..b824edb5dab 100644 --- a/danger/bundle_size/Dangerfile +++ b/danger/bundle_size/Dangerfile @@ -33,6 +33,8 @@ comparison_cmd = [ comment = `cat #{markdown_result}` -markdown(<<~MARKDOWN) +unless comment.strip.empty? + markdown(<<~MARKDOWN) #{comment} -MARKDOWN + MARKDOWN +end diff --git a/danger/changelog/Dangerfile b/danger/changelog/Dangerfile index 971c6a2a7b9..06593a04093 100644 --- a/danger/changelog/Dangerfile +++ b/danger/changelog/Dangerfile @@ -46,13 +46,17 @@ def check_changelog_path(path) ee_changes = helper.all_ee_changes.dup 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/`." end 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/`." 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 if git.modified_files.include?("CHANGELOG.md") diff --git a/danger/commit_messages/Dangerfile b/danger/commit_messages/Dangerfile index 4e17db60471..816d7384a2d 100644 --- a/danger/commit_messages/Dangerfile +++ b/danger/commit_messages/Dangerfile @@ -1,6 +1,7 @@ # frozen_string_literal: true require_relative File.expand_path('../../lib/gitlab/danger/commit_linter', __dir__) +require_relative File.expand_path('../../lib/gitlab/danger/merge_request_linter', __dir__) COMMIT_MESSAGE_GUIDELINES = "https://docs.gitlab.com/ee/development/contributing/merge_request_workflow.html#commit-messages-guidelines" MORE_INFO = "For more information, take a look at our [Commit message guidelines](#{COMMIT_MESSAGE_GUIDELINES})." @@ -92,7 +93,7 @@ end def lint_mr_title(mr_title) commit = Struct.new(:message, :sha).new(mr_title) - Gitlab::Danger::CommitLinter.new(commit).lint_subject("merge request title") + Gitlab::Danger::MergeRequestLinter.new(commit).lint end def count_non_fixup_commits(commit_linters) @@ -139,4 +140,12 @@ def warn_or_fail_commits(failed_linters, default_to_fail: true) end end -lint_commits(git.commits) +# As part of https://gitlab.com/groups/gitlab-org/-/epics/4826 we are +# vendoring workhorse commits from the stand-alone gitlab-workhorse +# repo. There is no point in linting commits that we want to vendor as +# is. +def workhorse_changes? + git.diff.any? { |file| file.path.start_with?('workhorse/') } +end + +lint_commits(git.commits) unless workhorse_changes? diff --git a/danger/database/Dangerfile b/danger/database/Dangerfile index 2ccfdcffaea..67a9b53fe3a 100644 --- a/danger/database/Dangerfile +++ b/danger/database/Dangerfile @@ -2,9 +2,7 @@ gitlab_danger = GitlabDanger.new(helper.gitlab_helper) -SCHEMA_NOT_UPDATED_MESSAGE_SHORT = <<~MSG -New %<migrations>s added but %<schema>s wasn't updated. -MSG +SCHEMA_NOT_UPDATED_MESSAGE_SHORT = "New %<migrations>s added but %<schema>s wasn't updated" SCHEMA_NOT_UPDATED_MESSAGE_FULL = <<~MSG **#{SCHEMA_NOT_UPDATED_MESSAGE_SHORT}** diff --git a/danger/pipeline/Dangerfile b/danger/pipeline/Dangerfile new file mode 100644 index 00000000000..0342a39554b --- /dev/null +++ b/danger/pipeline/Dangerfile @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +MESSAGE = <<~MESSAGE +## Pipeline Changes + +This Merge Request contains changes to the pipeline configuration for the GitLab project. + +Please consider the effect of the changes in this Merge Request on the following: +- Effects on different [pipeline types](https://docs.gitlab.com/ee/development/pipelines.html#pipelines-for-merge-requests) +- Effects on non-canonical projects (`gitlab-foss`, `security`, etc) +- Effects on [pipeline performance](https://about.gitlab.com/handbook/engineering/quality/performance-indicators/#average-merge-request-pipeline-duration-for-gitlab) +- Effects on fork pipelines + +Please consider communicating these changes to the broader team following the [communication guideline for pipeline changes](https://about.gitlab.com/handbook/engineering/quality/engineering-productivity-team/#pipeline-changes) +MESSAGE + +if helper.has_ci_changes? + markdown(MESSAGE) +end |