Commit 0f60698f authored by Robert Speicher's avatar Robert Speicher Committed by John Skarbek

Update auto_deploy:pick task to use AutoDeployBranch

parent 44d3177a
...@@ -17,43 +17,44 @@ namespace :auto_deploy do ...@@ -17,43 +17,44 @@ namespace :auto_deploy do
task :pick do task :pick do
icon = ->(result) { result.success? ? "✓" : "✗" } icon = ->(result) { result.success? ? "✓" : "✗" }
auto_deploy_branch = ENV['AUTO_DEPLOY_BRANCH'] auto_deploy_branch = ENV.fetch('AUTO_DEPLOY_BRANCH') do |name|
abort('AUTO_DEPLOY_BRANCH must be set for this rake task'.colorize(:red)) unless auto_deploy_branch abort("`#{name}` must be set for this rake task".colorize(:red))
puts "We'll pick into #{auto_deploy_branch}" end
scrub_version = auto_deploy_branch.match(/^(\d+-\d+)-auto-deploy.*/)[1].tr('-', '.') scrub_version = auto_deploy_branch.match(/^(\d+-\d+)-auto-deploy.*/)[1].tr('-', '.')
version = ReleaseTools::Version.new(scrub_version).to_ee version = ReleaseTools::Version.new(scrub_version).to_ee
$stdout.puts "--> Picking for #{version}..."
$stdout.puts "Cherry-picking for EE..." target = ReleaseTools::AutoDeployBranch.new(version, auto_deploy_branch)
$stdout.puts "--> Picking for #{version}..."
ee_results = ReleaseTools::CherryPick::Service ee_results = ReleaseTools::CherryPick::Service
.new(ReleaseTools::Project::GitlabEe, version, auto_deploy_branch) .new(ReleaseTools::Project::GitlabEe, version, target)
.execute .execute
ee_results.each do |result| ee_results.each do |result|
$stdout.puts " #{icon.call(result)} #{result.url}" $stdout.puts " #{icon.call(result)} #{result.url}"
end end
$stdout.puts "Cherry-picking for CE..." version = version.to_ce
version = ReleaseTools::Version.new(scrub_version).to_ce $stdout.puts "--> Picking for #{version}..."
ce_results = ReleaseTools::CherryPick::Service ce_results = ReleaseTools::CherryPick::Service
.new(ReleaseTools::Project::GitlabCe, version, auto_deploy_branch) .new(ReleaseTools::Project::GitlabCe, version, target)
.execute .execute
results.each do |result| ce_results.each do |result|
$stdout.puts " #{icon.call(result)} #{result.url}" $stdout.puts " #{icon.call(result)} #{result.url}"
end end
if ee_results.none?(&:success?) && ce_results.nonde?(&:success?) if ee_results.none?(&:success?) && ce_results.none?(&:success?)
raise "Nothing was picked, bailing..." raise "Nothing was picked, bailing..."
end end
ReleaseTools::GitlabOpsClient.run_trigger( ReleaseTools::GitlabOpsClient.run_trigger(
ReleaseTools::Project::MergeTrain, ReleaseTools::Project::MergeTrain,
ENV.fetch['MERGE_TRAIN_TRIGGER_TOKEN'], ENV.fetch['MERGE_TRAIN_TRIGGER_TOKEN'],
master, master,
{} {}
) ) unless ReleaseTools::SharedStatus.dry_run?
end end
end end
......
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