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

Dangerfile - gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f1bb16150ece576621d4dda3ced3be2b9382c5a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
require 'yaml'
require 'json'

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

  if !git.added_files.include?(path)
    warn("No changelog entry was generated, please do so by executing _support/changelog")
  else
    yaml = YAML.safe_load(File.read(path))

    unless yaml['merge_request'] == gitlab.mr_json["iid"]
      fail("Merge request ID was not set to #{gitlab.mr_json['iid']}")
    end

    unless yaml['title'] == gitlab.mr_title
      fail('Changelog entry should match the MR title')
    end
  end
end

check_changelog(File.join('changelogs', 'unreleased', "#{gitlab.branch_for_head}.yml"))

VENDOR_JSON = 'vendor/vendor.json'
fail("Expected #{VENDOR_JSON} to exist") unless File.exist?(VENDOR_JSON)

if git.modified_files.include?(VENDOR_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

# vim: ft=ruby