Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <git@zjvandeweg.nl>2018-05-15 13:04:48 +0300
committerZeger-Jan van de Weg <git@zjvandeweg.nl>2018-05-17 10:47:22 +0300
commit1dc8d51ea225b0385e22d9182a6b0d5de5d4291e (patch)
treeba1f54cddf895d3114ac6711786563920b53f222 /Dangerfile
parent0e8cb5ad07960952a94c7eb0ec3167cccd7ae9ec (diff)
Generate changelog and its entries
In GitLab CE/EE, changelog entries aren't put directly into the CHANGELOG.md but generated using `bin/changelog`. This system has been copied and a script created to generate output once `_support/release` is executed. This prevents us from rebasing/merging master to remove merge conflicts.
Diffstat (limited to 'Dangerfile')
-rw-r--r--Dangerfile33
1 files changed, 19 insertions, 14 deletions
diff --git a/Dangerfile b/Dangerfile
index 3afa7a26d..ee7e37498 100644
--- a/Dangerfile
+++ b/Dangerfile
@@ -1,30 +1,35 @@
-CHANGELOG_FILE = "CHANGELOG.md"
+require 'yaml'
+require 'json'
-def check_changelog
- unless git.modified_files.include?(CHANGELOG_FILE)
- warn("This MR is missing a CHANGELOG entry")
+fail("Please provide a MR description") if gitlab.mr_body.empty?
+
+def check_changelog(path)
+ if git.modified_files.include?("CHANGELOG.md")
+ fail("CHANGELOG.md was edited. Please remove the additions and create an entry with _support/changelog")
return
end
- patch = git.diff_for_file(CHANGELOG_FILE).patch
- unless patch.match?(/^\+- #{Regexp.quote(gitlab.mr_title)}\n/)
- fail('Changelog entry should match the MR title')
- end
+ if git.added_files.include?(path)
+ warn("No changelog entry was generated, please do so by executing _support/changelog")
+ else
+ yaml = YAML.safe_load(yaml)
- unless patch.match?(/^\+\s+#{Regexp.quote(gitlab.mr_json['web_url'])}\n/)
- fail('Changelog entry URL does not match the web url')
+ unless yaml['merge_request'] == gitlab.mr["iid"]
+ fail("Merge request ID was set to #{yaml['merge_request']}, expected #{gitlab.mr['iid']}")
+ end
+
+ unless yaml['title'] == gitlab.mr_title
+ fail('Changelog entry should match the MR title')
+ end
end
end
-check_changelog
-
-fail("Please provide a MR description") if gitlab.mr_body.empty?
+check_changelog(File.join('changelogs', 'unreleased', "#{gitlab.branch_for_base}.yml}"))
VENDOR_JSON = 'vendor/vendor.json'
fail("Expected #{VENDOR_JSON} to exist") unless File.exist?(VENDOR_JSON)
if git.modified_files.include?(VENDOR_JSON)
- require 'json'
parsed_json = JSON.parse(File.read(VENDOR_JSON))
proto = parsed_json["package"]&.find { |h| h["path"].start_with?("gitlab.com/gitlab-org/gitaly-proto") }