File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ lb_name = ARGV[0]
77lb_port = 443
88domain = ARGV [ 1 ]
99tg_prefix = ARGV [ 2 ]
10+ color = ARGV [ 3 ]
1011
1112class AWSClient
1213 class << self
@@ -23,14 +24,14 @@ rule = AWSClient.elbv2.describe_rules(listener_arn: listener.listener_arn).rules
2324tg_green = AWSClient . elbv2 . describe_target_groups . target_groups . find { |x | x . target_group_name == "#{ tg_prefix } -green" }
2425tg_blue = AWSClient . elbv2 . describe_target_groups . target_groups . find { |x | x . target_group_name == "#{ tg_prefix } -blue" }
2526
26- if rule . actions . first . target_group_arn . include? "blue "
27- puts "Detected blue tg, switching to green"
27+ if color == "green "
28+ puts "Switching to green"
2829 tg_color = tg_green . target_group_arn
29- elsif rule . actions . first . target_group_arn . include? "green "
30- puts "Detected green tg, switching to blue"
30+ elsif color == "blue "
31+ puts "Switching to blue"
3132 tg_color = tg_blue . target_group_arn
3233else
33- fail "Cannot detect current color"
34+ fail "Cannot detect current color. Color not passed in cli? "
3435end
3536
3637targets = AWSClient . elbv2 . describe_target_health ( target_group_arn : tg_color )
Original file line number Diff line number Diff line change 11Gem ::Specification . new do |s |
22 s . name = 'deploy-tools'
3- s . version = '0.0.4 '
4- s . date = '2020-09-15 '
3+ s . version = '0.0.5 '
4+ s . date = '2021-03-17 '
55 s . summary = "Deploy tools"
66 s . description = "A set of script used for deployment"
77 s . authors = [ "Tony Nyurkin" ]
You can’t perform that action at this time.
0 commit comments