Skip to content

Commit 3c6d109

Browse files
authored
Merge pull request #7 from simplepractice/feature/remove-targets-on-failure
Remove failed container from tg in case of failed deploy
2 parents dc9554a + 647df07 commit 3c6d109

2 files changed

Lines changed: 18 additions & 6 deletions

File tree

bin/blue_green_switch

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,23 @@ AWSClient.elbv2.register_targets({
5050
targets: new_targets
5151
})
5252

53-
AWSClient.elbv2.wait_until(
54-
:target_in_service,
55-
target_group_arn: tg.target_group_arn,
56-
targets: new_targets
57-
)
53+
begin
54+
AWSClient.elbv2.wait_until(
55+
:target_in_service,
56+
target_group_arn: tg.target_group_arn,
57+
targets: new_targets,
58+
)
59+
rescue
60+
puts "The new containers are failing the elb health check"
61+
62+
AWSClient.elbv2.deregister_targets({
63+
target_group_arn: tg.target_group_arn,
64+
targets: new_targets
65+
})
66+
67+
raise "The new containers are failing the elb health check"
68+
end
69+
5870

5971
puts "\n#{color.capitalize} target in service"
6072

deploy-tools.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Gem::Specification.new do |s|
22
s.name = 'deploy-tools'
3-
s.version = '0.1.2'
3+
s.version = '0.1.4'
44
s.date = '2022-06-28'
55
s.summary = "Deploy tools"
66
s.description = "A set of script used for deployment"

0 commit comments

Comments
 (0)