ami_spec 1.5.0 → 1.6.0
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/ami_spec.rb +40 -24
- data/lib/ami_spec/version.rb +1 -1
- data/lib/ami_spec/wait_for_cloud_init.rb +11 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e38763e4488b1a155d18a24baed8e9303c17a57cbd3de3ec1c37d31da9a4908d
|
4
|
+
data.tar.gz: e0053a027881e1a452ba2e17c5a003381329968ea7975e48568b7f5834977a13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22823316544f28630b87df445f1e766994d6639adf2022331715fc454a35f8900f8124437aa42347a314f8b7c3049326efdea77d807db2acffcf73770907a988
|
7
|
+
data.tar.gz: 28080169c288b9da6d87f266aaa839e002e0a8940a96fd9bd5169a23ae0c03be9fda19211b7f903b36143ad3413efcfa79b0886134c6b7521758c58902c4a1d4
|
data/lib/ami_spec.rb
CHANGED
@@ -7,6 +7,7 @@ require 'ami_spec/server_spec'
|
|
7
7
|
require 'ami_spec/server_spec_options'
|
8
8
|
require 'ami_spec/wait_for_ssh'
|
9
9
|
require 'ami_spec/wait_for_rc'
|
10
|
+
require 'ami_spec/wait_for_cloud_init'
|
10
11
|
require 'optimist'
|
11
12
|
require 'logger'
|
12
13
|
|
@@ -89,6 +90,7 @@ module AmiSpec
|
|
89
90
|
ip_address = options[:aws_public_ip] ? instance.public_ip_address : instance.private_ip_address
|
90
91
|
WaitForSSH.wait(ip_address, options[:ssh_user], options[:key_file], options[:ssh_retries])
|
91
92
|
WaitForRC.wait(ip_address, options[:ssh_user], options[:key_file]) if options[:wait_for_rc]
|
93
|
+
WaitForCloudInit.wait(ip_address, options[:ssh_user], options[:key_file]) if options[:wait_for_cloud_init]
|
92
94
|
|
93
95
|
server_spec_options = ServerSpecOptions.new(options.merge(instance: instance))
|
94
96
|
results << ServerSpec.new(server_spec_options).run
|
@@ -119,30 +121,44 @@ module AmiSpec
|
|
119
121
|
|
120
122
|
def self.invoke
|
121
123
|
options = Optimist::options do
|
122
|
-
opt :role,
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
opt :
|
127
|
-
|
128
|
-
|
129
|
-
type: :string
|
130
|
-
opt :
|
131
|
-
|
132
|
-
opt :
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
opt :
|
138
|
-
opt :
|
139
|
-
|
140
|
-
|
141
|
-
opt :
|
142
|
-
|
143
|
-
opt :
|
144
|
-
|
145
|
-
|
124
|
+
opt :role,
|
125
|
+
'The role to test, this should map to a directory in the spec folder',
|
126
|
+
type: :string, short: :r
|
127
|
+
opt :ami, 'The ami ID to run tests against', type: :string, short: :a
|
128
|
+
opt :role_ami_file,
|
129
|
+
'A file containing comma separated roles and amis. i.e.
|
130
|
+
web_server,ami-id.',
|
131
|
+
type: :string, short: :o
|
132
|
+
opt :specs, 'The directory to find ServerSpecs',
|
133
|
+
type: :string, required: true, short: :s
|
134
|
+
opt :subnet_id,
|
135
|
+
'The subnet to start the instance in. If not provided a subnet will be chosen from the default VPC',
|
136
|
+
type: :string, short: :u
|
137
|
+
opt :key_name, 'The SSH key name to assign to instances. If not provided a temporary key pair will be generated in AWS',
|
138
|
+
type: :string, short: :k
|
139
|
+
opt :key_file, 'The SSH private key file associated to the key_name', type: :string, short: :e
|
140
|
+
opt :ssh_user, 'The user to ssh to the instance as', type: :string, required: true, short: :h
|
141
|
+
opt :aws_region, 'The AWS region, defaults to AWS_DEFAULT_REGION environment variable',
|
142
|
+
type: :string, short: :w
|
143
|
+
opt :aws_instance_type, 'The ec2 instance type, defaults to t2.micro',
|
144
|
+
type: :string, default: 't2.micro', short: :i
|
145
|
+
opt :aws_security_groups,
|
146
|
+
'Security groups to associate to the launched instances. May be specified multiple times. If not provided a temporary security group will be generated in AWS',
|
147
|
+
type: :string, default: nil, multi: true, short: :c
|
148
|
+
opt :allow_any_temporary_security_group, 'The temporary security group will allow SSH connections from any IP address (0.0.0.0/0)',
|
149
|
+
short: :n
|
150
|
+
opt :aws_public_ip, 'Launch instances with a public IP', short: :p
|
151
|
+
opt :ssh_retries, 'The number of times we should try sshing to the ec2 instance before giving up. Defaults to 30',
|
152
|
+
type: :int, default: 30, short: :t
|
153
|
+
opt :tags, 'Additional tags to add to launched instances in the form of comma separated key=value pairs. i.e. Name=AmiSpec',
|
154
|
+
type: :string, default: '', short: :g
|
155
|
+
opt :debug, "Don't terminate instances on exit", short: :d
|
156
|
+
opt :buildkite, 'Output section separators for buildkite', short: :b
|
157
|
+
opt :wait_for_rc, 'Wait for oldschool SystemV scripts to run before conducting tests. Currently only supports Ubuntu with upstart',
|
158
|
+
short: :f
|
159
|
+
opt :wait_for_cloud_init, 'Wait for Cloud Init to complete before running tests'
|
160
|
+
opt :user_data_file, 'File path for aws ec2 user data', type: :string, default: nil, short: :l
|
161
|
+
opt :iam_instance_profile_arn, 'IAM instance profile to use', type: :string, short: :m
|
146
162
|
end
|
147
163
|
|
148
164
|
if options[:role] && options[:ami]
|
data/lib/ami_spec/version.rb
CHANGED
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'net/ssh'
|
2
|
+
|
3
|
+
module AmiSpec
|
4
|
+
class WaitForCloudInit
|
5
|
+
def self.wait(ip_address, user, key, port=22)
|
6
|
+
Net::SSH.start(ip_address, user, keys: [key], :verify_host_key => :never, port: port) do |ssh|
|
7
|
+
ssh.exec! '/usr/bin/cloud-init status --wait'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ami_spec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Robinson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-03-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk-ec2
|
@@ -128,6 +128,7 @@ files:
|
|
128
128
|
- lib/ami_spec/server_spec.rb
|
129
129
|
- lib/ami_spec/server_spec_options.rb
|
130
130
|
- lib/ami_spec/version.rb
|
131
|
+
- lib/ami_spec/wait_for_cloud_init.rb
|
131
132
|
- lib/ami_spec/wait_for_rc.rb
|
132
133
|
- lib/ami_spec/wait_for_ssh.rb
|
133
134
|
homepage: https://github.com/envato/ami-spec
|