ami_spec 1.8.0 → 1.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ami_spec/aws_instance.rb +6 -0
- data/lib/ami_spec/aws_instance_options.rb +1 -0
- data/lib/ami_spec/server_spec.rb +0 -2
- data/lib/ami_spec/server_spec_options.rb +0 -2
- data/lib/ami_spec/version.rb +1 -1
- data/lib/ami_spec.rb +11 -3
- metadata +8 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c83caf5c011d84b3e70d6a855cf6fff7a87d01e06910bab01aeea55530ebde1d
|
4
|
+
data.tar.gz: 6b40b0cff04fe050717d2c500a2c3a635c974f83c4a3335b65f1985b6db76f84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31de74ea052fafb212ce9ae126950c8882de96492cc2e40cd4c3f11821c1af17922de74825e6e3aaca9214b64e235c32a417845edff757880baca75e4f08341a
|
7
|
+
data.tar.gz: 01f976c2c436f1ddc1dd997524e788eb90ddad9d8f4ebe5fd2954c1078cfbb907f3323761850801709d865b35b4aaa557345dcf438c6f64f59baa47d7dca0e63
|
@@ -25,22 +25,28 @@ module AmiSpec
|
|
25
25
|
@tags = ec2ify_tags(options.fetch(:tags))
|
26
26
|
@user_data_file = options.fetch(:user_data_file, nil)
|
27
27
|
@iam_instance_profile_arn = options.fetch(:iam_instance_profile_arn, nil)
|
28
|
+
@logger = options.fetch(:logger)
|
28
29
|
end
|
29
30
|
|
30
31
|
def_delegators :@instance, :instance_id, :tags, :private_ip_address, :public_ip_address
|
31
32
|
|
32
33
|
def start
|
34
|
+
@logger.info "Creating AWS EC2 instance for #{@ami}"
|
33
35
|
client = Aws::EC2::Client.new(client_options)
|
34
36
|
placeholder_instance = client.run_instances(instances_options).instances.first
|
35
37
|
|
36
38
|
@instance = Aws::EC2::Instance.new(placeholder_instance.instance_id, client_options)
|
39
|
+
@logger.info "Waiting for AWS EC2 instance to start: #{@instance.id}"
|
37
40
|
@instance.wait_until_running
|
38
41
|
tag_instance
|
42
|
+
@logger.info "AWS EC2 instance started: #{@instance.id}"
|
39
43
|
end
|
40
44
|
|
41
45
|
def terminate
|
46
|
+
@logger.info "Terminating AWS EC2 instance: #{@instance.id}"
|
42
47
|
@instance.terminate
|
43
48
|
@instance.wait_until_terminated
|
49
|
+
@logger.info "AWS EC2 instance terminated: #{@instance.id}"
|
44
50
|
end
|
45
51
|
|
46
52
|
private
|
data/lib/ami_spec/server_spec.rb
CHANGED
@@ -16,8 +16,6 @@ module AmiSpec
|
|
16
16
|
@user = options.fetch(:ssh_user)
|
17
17
|
@key_file = options.fetch(:key_file)
|
18
18
|
@buildkite = options.fetch(:buildkite)
|
19
|
-
@user_data_file = options.fetch(:user_data_file)
|
20
|
-
@iam_instance_profile_arn = options.fetch(:user_data_file)
|
21
19
|
end
|
22
20
|
|
23
21
|
def run
|
data/lib/ami_spec/version.rb
CHANGED
data/lib/ami_spec.rb
CHANGED
@@ -83,17 +83,25 @@ module AmiSpec
|
|
83
83
|
|
84
84
|
instances = []
|
85
85
|
options[:amis].each_pair do |role, ami|
|
86
|
-
aws_instance_options = AwsInstanceOptions.new(options.merge(role: role, ami: ami))
|
86
|
+
aws_instance_options = AwsInstanceOptions.new(options.merge(role: role, ami: ami, logger: logger))
|
87
87
|
instances << AwsInstance.start(aws_instance_options)
|
88
88
|
end
|
89
89
|
|
90
90
|
results = []
|
91
91
|
instances.each do |instance|
|
92
92
|
ip_address = options[:aws_public_ip] ? instance.public_ip_address : instance.private_ip_address
|
93
|
+
logger.info("Waiting for SSH…")
|
93
94
|
WaitForSSH.wait(ip_address, options[:ssh_user], options[:key_file], options[:ssh_retries])
|
94
|
-
|
95
|
-
|
95
|
+
if options[:wait_for_rc]
|
96
|
+
logger.info("Waiting for RC…")
|
97
|
+
WaitForRC.wait(ip_address, options[:ssh_user], options[:key_file])
|
98
|
+
end
|
99
|
+
if options[:wait_for_cloud_init]
|
100
|
+
logger.info("Waiting for cloud init…")
|
101
|
+
WaitForCloudInit.wait(ip_address, options[:ssh_user], options[:key_file])
|
102
|
+
end
|
96
103
|
|
104
|
+
logger.info("Running serverspec…")
|
97
105
|
server_spec_options = ServerSpecOptions.new(options.merge(instance: instance))
|
98
106
|
results << ServerSpec.new(server_spec_options).run
|
99
107
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ami_spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Robinson
|
8
8
|
- Martin Jagusch
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-03-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk-ec2
|
@@ -25,20 +25,6 @@ dependencies:
|
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '1'
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: rake
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - ">="
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '0'
|
35
|
-
type: :development
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - ">="
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '0'
|
42
28
|
- !ruby/object:Gem::Dependency
|
43
29
|
name: serverspec
|
44
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -99,14 +85,14 @@ dependencies:
|
|
99
85
|
name: net-ssh
|
100
86
|
requirement: !ruby/object:Gem::Requirement
|
101
87
|
requirements:
|
102
|
-
- - "
|
88
|
+
- - ">="
|
103
89
|
- !ruby/object:Gem::Version
|
104
90
|
version: '5'
|
105
91
|
type: :runtime
|
106
92
|
prerelease: false
|
107
93
|
version_requirements: !ruby/object:Gem::Requirement
|
108
94
|
requirements:
|
109
|
-
- - "
|
95
|
+
- - ">="
|
110
96
|
- !ruby/object:Gem::Version
|
111
97
|
version: '5'
|
112
98
|
description: Acceptance testing your AMIs
|
@@ -134,7 +120,7 @@ files:
|
|
134
120
|
homepage: https://github.com/envato/ami-spec
|
135
121
|
licenses: []
|
136
122
|
metadata: {}
|
137
|
-
post_install_message:
|
123
|
+
post_install_message:
|
138
124
|
rdoc_options: []
|
139
125
|
require_paths:
|
140
126
|
- lib
|
@@ -149,8 +135,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
135
|
- !ruby/object:Gem::Version
|
150
136
|
version: '0'
|
151
137
|
requirements: []
|
152
|
-
rubygems_version: 3.
|
153
|
-
signing_key:
|
138
|
+
rubygems_version: 3.4.5
|
139
|
+
signing_key:
|
154
140
|
specification_version: 4
|
155
141
|
summary: Acceptance testing your AMIs
|
156
142
|
test_files: []
|