checkpoint

parent 73906155
......@@ -16,6 +16,8 @@ namespace :auto_deploy do
desc 'Pick commits into the auto deploy branches'
task :pick do
icon = ->(result) { result.success? ? "✓" : "✗" }
auto_deploy_branch = ENV['AUTO_DEPLOY_BRANCH']
abort('AUTO_DEPLOY_BRANCH must be set for this rake task'.colorize(:red)) unless auto_deploy_branch
puts "We'll pick into #{auto_deploy_branch}"
......@@ -27,28 +29,32 @@ namespace :auto_deploy do
$stdout.puts "Cherry-picking for EE..."
results = ReleaseTools::CherryPick::Service
.new(ReleaseTools::Project::GitlabEe, version, auto_deploy_branch)
.dry_run
.execute
results.each do |result|
puts result.web_url
$stdout.puts " #{icon.call(result)} #{result.url}"
end
$stdout.puts "Cherry-picking for CE..."
version = ReleaseTools::Version.new(scrub_version).to_ce
results = ReleaseTools::CherryPick::Service
.new(ReleaseTools::Project::GitlabCe, version, auto_deploy_branch)
.dry_run
.execute
results.each do |result|
puts result.web_url
$stdout.puts " #{icon.call(result)} #{result.url}"
end
ReleaseTools::UpstreamMerge.new(
conflicts = ReleaseTools::UpstreamMerge.new(
origin: ReleaseTools::Project::GitlabEe.remotes[:gitlab],
upstream: ReleaseTools::Project::GitlabCe.remotes[:gitlab],
source_branch: auto_deploy_branch,
target_branch: auto_deploy_branch
).dry_run
).execute!
unless conflicts.nil?
raise "Conflicts in CE to EE merge."
end
end
end
......
......@@ -26,6 +26,7 @@ module ReleaseTools
# unpicked - Array of failure Results
def summary(picked, unpicked)
return if picked.empty? && unpicked.empty?
return unless prep_mr
message = []
......@@ -51,6 +52,7 @@ module ReleaseTools
def blog_post_summary(picked)
return if version.rc?
return if picked.empty?
return unless prep_mr
message = <<~MSG
The following merge requests were picked into #{prep_mr.url}:
......@@ -70,6 +72,8 @@ module ReleaseTools
end
def successful_comment(pick_result)
return unless prep_mr
comment = <<~MSG
Automatically picked into #{prep_mr.url}, will merge into
`#{version.stable_branch}` ready for `#{version}`.
......
......@@ -65,8 +65,7 @@ module ReleaseTools
def checkout_new_branch(branch, base: 'master')
fetch(base)
# output, status = run_git %W[checkout --quiet -b #{branch} #{base}]
output, status = run_git %W[checkout --quiet #{branch}]
output, status = run_git %W[checkout --quiet -b #{branch} #{base}]
status.success? || raise(CannotCheckoutBranchError.new(branch, output))
end
......@@ -228,6 +227,12 @@ module ReleaseTools
[cmd_output, $CHILD_STATUS]
end
def configure_upstream_to(remote)
_, status = run_git %W[branch --set-upstream-to origin/#{remote}]
status.success?
end
private
# Given a Hash of remotes {name: url}, add each one to the repository
......
......@@ -49,7 +49,8 @@ module ReleaseTools
# We fetch CE first to make sure our EE copy is more up-to-date!
repository.fetch(target_branch, remote: :upstream)
repository.fetch(target_branch, remote: :origin)
repository.checkout_new_branch(source_branch, base: "origin/#{target_branch}")
repository.ensure_branch_exists(source_branch)
repository.configure_upstream_to(target_branch)
end
def execute_upstream_merge
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment