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-04-23 12:53:05 +0300
committerZeger-Jan van de Weg <git@zjvandeweg.nl>2018-04-23 15:59:58 +0300
commit820958bf9c58bf36fa07d7b7fe196c06e4463e1f (patch)
treec2849b807a79337c264b47e298ac8334a676baa0
parentf7fa70ae1c601d9bfde7583a06406d1973bf58ea (diff)
Use danger-gitlab to auto review merge requests
Given failures to check simple things in the past, like if a changelog was present, danger-gitlab is introduced to automatically perform these tasks. A warning was added when a changelog entry is skipped, and failures are due to missing MR descriptions or gitaly-proto versions being incorrect. To force diff highlighting to work, `.gitattributes` was added.
-rw-r--r--.gitattributes1
-rw-r--r--.gitlab-ci.yml7
-rw-r--r--Dangerfile19
3 files changed, 27 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 000000000..f1c41c9bb
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+Dangerfile gitlab-language=ruby
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index deed4ed78..a2ed59b72 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -14,6 +14,13 @@ verify:
script:
- make verify
+danger-review:
+ stage: build
+ script:
+ - git version
+ - gem install danger-gitlab --no-document
+ - danger
+
.ruby_template: &ruby_definition
before_script:
# Override gemfile config (for some reasong `config --delete` doesn't do it)
diff --git a/Dangerfile b/Dangerfile
new file mode 100644
index 000000000..c1ffd180f
--- /dev/null
+++ b/Dangerfile
@@ -0,0 +1,19 @@
+unless git.modified_files.include?("CHANGELOG.md")
+ warn("This MR is missing a CHANGLOG entry")
+end
+
+fail("Please provide a MR description") if gitlab.mr_body.empty?
+
+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") }
+
+ unless proto["version"] && proto["version"] =~ /\Av\d+\./
+ fail("gitaly-proto version is incorrect")
+ end
+end