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:
authorSami Hiltunen <shiltunen@gitlab.com>2021-02-22 17:05:40 +0300
committerSami Hiltunen <shiltunen@gitlab.com>2021-02-22 17:05:40 +0300
commit771df64aaf511cc3c64d7b55aee2d961941bfdab (patch)
tree60bc2932f3d2efbe2c3db16e77e3cf95556dfff2
parent83065e36a1bc2c814b7429cde6eba6f9634ab6c7 (diff)
parent2f205ff116ffd9fa152dc333f0a80365595a5428 (diff)
Merge branch 'zj-spring-clean' into 'master'
_support: Remove unused files See merge request gitlab-org/gitaly!3150
-rwxr-xr-x_support/generate_changelog71
-rwxr-xr-x_support/update-downstream-server-version125
2 files changed, 0 insertions, 196 deletions
diff --git a/_support/generate_changelog b/_support/generate_changelog
deleted file mode 100755
index f34b17d5e..000000000
--- a/_support/generate_changelog
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/usr/bin/env ruby
-# Generates the changelog from the yaml entries in changelogs/unreleased
-
-require 'yaml'
-require 'fileutils'
-
-class ChangelogEntry
- attr_reader :title, :merge_request, :type, :author
-
- def initialize(file_path)
- yaml = YAML.safe_load(File.read(file_path))
-
- @title = yaml['title']
- @merge_request = yaml['merge_request']
- @type = yaml['type']
- @author = yaml['author']
- end
-
- def to_s
- str = ""
- str << "- #{title}\n"
- str << " https://gitlab.com/gitlab-org/gitaly/merge_requests/#{merge_request}\n"
- str << " Contributed by #{author}\n" if author
-
- str
- end
-end
-
-ROOT_DIR = File.expand_path('../..', __FILE__)
-UNRELEASED_ENTRIES = File.join(ROOT_DIR, 'changelogs', 'unreleased')
-CHANGELOG_FILE = File.join(ROOT_DIR, 'CHANGELOG.md')
-
-def main(version)
- entries = []
- Dir["#{UNRELEASED_ENTRIES}/*.yml"].each do |yml|
- entries << ChangelogEntry.new(yml)
- FileUtils.rm(yml)
- end
-
- sections = []
- types = entries.map(&:type).uniq.sort
- types.each do |type|
- text = ''
- text << "#### #{type.capitalize}\n"
-
- entries.each do |e|
- next unless e.type == type
-
- text << e.to_s
- end
-
- sections << text
- end
-
- new_version_entry = ["## v#{version}\n\n", sections.join("\n"), "\n"].join
-
- current_changelog = File.read(CHANGELOG_FILE).lines
- header = current_changelog.shift(2)
-
- new_changelog = [header, new_version_entry, current_changelog.join]
-
- File.write(CHANGELOG_FILE, new_changelog.join)
-end
-
-unless ARGV.count == 1
- warn "Usage: #{$0} VERSION"
- warn "Specify version as x.y.z"
- abort
-end
-
-main(ARGV.first)
diff --git a/_support/update-downstream-server-version b/_support/update-downstream-server-version
deleted file mode 100755
index b61b237d7..000000000
--- a/_support/update-downstream-server-version
+++ /dev/null
@@ -1,125 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'net/http'
-require 'uri'
-require 'json'
-require_relative 'run.rb'
-
-def gitlab_api(url, body=nil)
- uri = URI.parse(url)
-
- header = {
- 'Content-Type': 'application/json',
- 'PRIVATE-TOKEN': ENV['GITLAB_TOKEN']
- }
-
- # Create the HTTP objects
- Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
- if body
- request = Net::HTTP::Post.new(uri.request_uri, header)
- request.body = body.to_json
- else
- request = Net::HTTP::Get.new(uri.request_uri, header)
- end
-
- response = http.request(request)
- raise "Request to #{url} failed: #{response.body}" unless Integer(response.code) < 400
-
- JSON.parse(response.body)
- end
-end
-
-def find_user_id
- return ENV["GITLAB_USER_ID"] if ENV["GITLAB_USER_ID"]
-
- response = gitlab_api("https://gitlab.com/api/v4/user")
- response['id']
-end
-
-def find_project_id(project_name)
- encoded_project_name = URI.encode_www_form_component(project_name)
- response = gitlab_api("https://gitlab.com/api/v4/projects/#{encoded_project_name}")
-
- response['id']
-end
-
-def find_tag
- return ENV["CI_COMMIT_TAG"] if ENV["CI_COMMIT_TAG"]
-
- capture!(%w[git tag --points-at HEAD]).chomp
-end
-
-def update_gitaly_version(project_id, tag_version)
- version = tag_version.sub(/^v/, "")
-
- server_version_commit = {
- "branch": "gitaly-version-#{tag_version}",
- "start_branch": "master",
- "commit_message": "Update Gitaly version to #{tag_version}",
- "actions": [{
- "action": "update",
- "file_path": "GITALY_SERVER_VERSION",
- "content": "#{version}\n"
- }]
- }
-
- gitlab_api("https://gitlab.com/api/v4/projects/#{project_id}/repository/commits", server_version_commit)
-end
-
-def create_mr(project_id, tag_version, assignee_id)
- anchor = 'v' + tag_version.tr('.', '')
- description = <<~MR
- Upgrade Gitaly to #{tag_version}.
-
- See the [Gitaly changelog](https://gitlab.com/gitlab-org/gitaly/blob/master/CHANGELOG.md##{anchor})
- for an overview of the changes.
- MR
-
- merge_request = {
- "source_branch": "gitaly-version-#{tag_version}",
- "target_branch": "master",
- "title": "Upgrade Gitaly to #{tag_version}",
- "assignee_id": assignee_id,
- "description": description,
- "labels": "devops::create,group::gitaly,backstage",
- "remove_source_branch": true,
- "squash": true
- }
-
- gitlab_api("https://gitlab.com/api/v4/projects/#{project_id}/merge_requests", merge_request)
-end
-
-def add_changelog(project_id, tag_version, merge_request_number)
- changelog_commit = {
- "branch": "gitaly-version-#{tag_version}",
- "start_branch": "gitaly-version-#{tag_version}",
- "commit_message": "Add changelog entry",
- "actions": [{
- "action": "create",
- "file_path": "changelogs/unreleased/gitaly-version-#{tag_version}.yml",
- "content": <<~HEREDOC
- ---
- title: Upgrade to Gitaly #{tag_version}
- merge_request: #{merge_request_number}
- author:
- type: changed
- HEREDOC
- }]
- }
-
- gitlab_api("https://gitlab.com/api/v4/projects/#{project_id}/repository/commits", changelog_commit)
-end
-
-abort "Please set GITLAB_TOKEN env var" unless ENV['GITLAB_TOKEN']
-
-project_id = find_project_id("gitlab-org/gitlab")
-tag_version = find_tag
-assignee_id = find_user_id
-
-abort "Unable to determine tag for current HEAD" unless tag_version
-
-update_gitaly_version(project_id, tag_version)
-merge_request = create_mr(project_id, tag_version, assignee_id)
-add_changelog(project_id, tag_version, merge_request['iid'])
-
-puts merge_request['web_url']