minimal_pipeline 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/minimal_pipeline/cloudformation.rb +19 -3
- 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: 70ee3fc89fe1178164328913afe51b3a51d192978bd7168e742fb63d9b109621
|
4
|
+
data.tar.gz: 33eb25e6e4adf7c97019622fdc42ae1ec63cc65e5f6c6d3d48ad4fe63296270c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c02f89eb7fca1e0fb2b21c572597f9550d1ae059d56a43cdb1facdcb5bee923e4778e07b542a0f00bb3408ac4ddff52d7f0dc44d5209ff047d9b9aa0893448bb
|
7
|
+
data.tar.gz: e73597301e43d16a5ce8fd3303a1e4b616eecc01613a0fbb28b6676499c53b612f51dbd7dc5dd98febc337ae82ceb42a6b2e8557db53701d3cfe8b5c432f1662
|
@@ -31,15 +31,24 @@ class MinimalPipeline
|
|
31
31
|
class Cloudformation
|
32
32
|
# Instance of `Aws::CloudFormation::Client`
|
33
33
|
attr_reader(:client)
|
34
|
+
attr_accessor(:wait_max_attempts)
|
35
|
+
attr_accessor(:wait_delay)
|
34
36
|
|
35
37
|
# Sets up `Aws::CloudFormation::Client`
|
36
38
|
# Requires environment variable `AWS_REGION` or `region` to be set.
|
37
|
-
|
39
|
+
#
|
40
|
+
# @param wait_max_attempts [Fixnum] Number of attempts to wait until all
|
41
|
+
# stack create or update is complete.
|
42
|
+
# @param wait_delay [Fixnum] The sleep interval for checking the status of
|
43
|
+
# a stack's status
|
44
|
+
def initialize(wait_max_attempts = 120, wait_delay = 30)
|
38
45
|
raise 'You must set env variable AWS_REGION or region.' \
|
39
46
|
if ENV['AWS_REGION'].nil? && ENV['region'].nil?
|
40
47
|
|
41
48
|
region = ENV['AWS_REGION'] || ENV['region']
|
42
49
|
@client = Aws::CloudFormation::Client.new(region: region)
|
50
|
+
@wait_max_attempts = wait_max_attempts
|
51
|
+
@wait_delay = wait_delay
|
43
52
|
end
|
44
53
|
|
45
54
|
# Converts a parameter Hash into a CloudFormation friendly structure
|
@@ -79,10 +88,16 @@ class MinimalPipeline
|
|
79
88
|
# @param stack_name [String] The name of the CloudFormation stack
|
80
89
|
# @param stack_parameters [Hash] Parameters to be passed into the stack
|
81
90
|
def deploy_stack(stack_name, stack_parameters)
|
91
|
+
wait_options = {
|
92
|
+
max_attempts: @wait_max_attempts,
|
93
|
+
delay: @wait_delay
|
94
|
+
}
|
95
|
+
|
82
96
|
unless @client.describe_stacks(stack_name: stack_name).stacks.empty?
|
83
97
|
puts 'Updating the existing stack' if ENV['DEBUG']
|
84
98
|
@client.update_stack(stack_parameters)
|
85
|
-
@client.wait_until(:stack_update_complete, stack_name: stack_name
|
99
|
+
@client.wait_until(:stack_update_complete, { stack_name: stack_name },
|
100
|
+
wait_options)
|
86
101
|
end
|
87
102
|
rescue Aws::CloudFormation::Errors::ValidationError => error
|
88
103
|
if error.to_s.include? 'No updates are to be performed.'
|
@@ -92,7 +107,8 @@ class MinimalPipeline
|
|
92
107
|
else
|
93
108
|
puts 'Creating a new stack' if ENV['DEBUG']
|
94
109
|
@client.create_stack(stack_parameters)
|
95
|
-
@client.wait_until(:stack_create_complete, stack_name: stack_name
|
110
|
+
@client.wait_until(:stack_create_complete, { stack_name: stack_name },
|
111
|
+
wait_options)
|
96
112
|
end
|
97
113
|
end
|
98
114
|
end
|
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.0.
|
4
|
+
version: 0.0.11
|
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-10-
|
12
|
+
date: 2018-10-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk
|