minimal_pipeline 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/minimal_pipeline/cloudformation.rb +38 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80704d7d13d62a58a13a017e5f242eb80906b05b3b7157949951ea517efb5aa8
|
4
|
+
data.tar.gz: 505337f7502811f804f59161f5b3394a9304baf0b770d5ff01b487228f359425
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38f5fed90b82c12bc0623b15d54b0b60d860eb53dac6e9e09584abe4053250f75ada61e7c6cd1580c180ab5bc885ab2e039abbc8c1f1348ba0e2a59ed1c1cb8c
|
7
|
+
data.tar.gz: f3f2ab864e9f30c8f1634f1b602ea60c0c5a15ba3879f4a17752c8c81641057db67b269f2380c32b9f943a49b05024847c3faefc83dcd0f912c9d18a18841426
|
@@ -96,6 +96,42 @@ class MinimalPipeline
|
|
96
96
|
stack_outputs(stack, attempt)
|
97
97
|
end
|
98
98
|
|
99
|
+
def attempt_to_update_stack(stack_name, stack_parameters, wait_options,
|
100
|
+
attempt = 1)
|
101
|
+
unless @client.describe_stacks(stack_name: stack_name).stacks.empty?
|
102
|
+
puts 'Updating the existing stack' if ENV['DEBUG']
|
103
|
+
@client.update_stack(stack_parameters)
|
104
|
+
@client.wait_until(:stack_update_complete, { stack_name: stack_name },
|
105
|
+
wait_options)
|
106
|
+
end
|
107
|
+
rescue Aws::CloudFormation::Errors::Throttling => error
|
108
|
+
raise 'Unable to attempt stack update' if attempt > 5
|
109
|
+
|
110
|
+
delay = attempt * 15
|
111
|
+
puts "#{error.message} - Retrying in #{delay}"
|
112
|
+
sleep delay
|
113
|
+
attempt += 1
|
114
|
+
attempt_to_update_stack(stack_name, stack_parameters, wait_options,
|
115
|
+
attempt)
|
116
|
+
end
|
117
|
+
|
118
|
+
def attempt_to_create_stack(stack_name, stack_parameters, wait_options,
|
119
|
+
attempt = 1)
|
120
|
+
puts 'Creating a new stack' if ENV['DEBUG']
|
121
|
+
@client.create_stack(stack_parameters)
|
122
|
+
@client.wait_until(:stack_create_complete, { stack_name: stack_name },
|
123
|
+
wait_options)
|
124
|
+
rescue Aws::CloudFormation::Errors::Throttling => error
|
125
|
+
raise 'Unable to attempt stack create' if attempt > 5
|
126
|
+
|
127
|
+
delay = attempt * 15
|
128
|
+
puts "#{error.message} - Retrying in #{delay}"
|
129
|
+
sleep delay
|
130
|
+
attempt += 1
|
131
|
+
attempt_to_create_stack(stack_name, stack_parameters, wait_options,
|
132
|
+
attempt)
|
133
|
+
end
|
134
|
+
|
99
135
|
# Creates or Updates a CloudFormation stack. Checks to see if the stack
|
100
136
|
# already exists and takes the appropriate action. Pauses until a final
|
101
137
|
# stack state is reached.
|
@@ -116,22 +152,14 @@ class MinimalPipeline
|
|
116
152
|
parameters: params(parameters)
|
117
153
|
}
|
118
154
|
|
119
|
-
|
120
|
-
puts 'Updating the existing stack' if ENV['DEBUG']
|
121
|
-
@client.update_stack(stack_parameters)
|
122
|
-
@client.wait_until(:stack_update_complete, { stack_name: stack_name },
|
123
|
-
wait_options)
|
124
|
-
end
|
155
|
+
attempt_to_update_stack(stack_name, stack_parameters, wait_options)
|
125
156
|
rescue Aws::CloudFormation::Errors::ValidationError => error
|
126
157
|
if error.to_s.include? 'No updates are to be performed.'
|
127
158
|
puts 'Nothing to do.' if ENV['DEBUG']
|
128
159
|
elsif error.to_s.include? 'Template error'
|
129
160
|
raise error
|
130
161
|
else
|
131
|
-
|
132
|
-
@client.create_stack(stack_parameters)
|
133
|
-
@client.wait_until(:stack_create_complete, { stack_name: stack_name },
|
134
|
-
wait_options)
|
162
|
+
attempt_to_create_stack(stack_name, stack_parameters, wait_options)
|
135
163
|
end
|
136
164
|
end
|
137
165
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minimal_pipeline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mayowa Aladeojebi
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-12-
|
12
|
+
date: 2018-12-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk-cloudformation
|