Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional targets_list argument #3

Merged
merged 2 commits into from
Jun 30, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions bin/blue_green_switch
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ REGION = "us-west-2".freeze
tg_name = ARGV[0]
color = ARGV[1]
color_port = ARGV[2]
targets_list = ARGV[3]

if color_port.nil?
fail "Cannot detect current color_port. Color_port not passed in cli?"
Expand All @@ -29,12 +30,22 @@ targets = AWSClient.elbv2.describe_target_health(target_group_arn: tg.target_gro
targets_port = targets.map(&:port).uniq.first

new_targets = []
targets.map(&:id).each do |i|
new_targets <<
{
id: i,
port: color_port
}
if targets_list.nil?
ptqa marked this conversation as resolved.
Show resolved Hide resolved
targets.map(&:id).each do |i|
new_targets <<
{
id: i,
port: color_port
}
end
else
targets_list.split(",").each do |i|
new_targets <<
{
id: i,
port: color_port
}
end
end

AWSClient.elbv2.register_targets({
Expand Down
4 changes: 2 additions & 2 deletions deploy-tools.gemspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Gem::Specification.new do |s|
s.name = 'deploy-tools'
s.version = '0.1.1'
s.date = '2022-02-01'
s.version = '0.1.2'
s.date = '2022-06-28'
s.summary = "Deploy tools"
s.description = "A set of script used for deployment"
s.authors = ["Tony Nyurkin", "Serhii Voronoi"]
Expand Down