ami_spec 1.6.0 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e38763e4488b1a155d18a24baed8e9303c17a57cbd3de3ec1c37d31da9a4908d
4
- data.tar.gz: e0053a027881e1a452ba2e17c5a003381329968ea7975e48568b7f5834977a13
3
+ metadata.gz: 718f947b58e6bedd2093507f23b7bcc1c8deae4503dde3603c6768700729948a
4
+ data.tar.gz: b8c05a3702f5951932d372f6c3788a2ee71f9d0ead934a4bdfb52cae382bbe70
5
5
  SHA512:
6
- metadata.gz: 22823316544f28630b87df445f1e766994d6639adf2022331715fc454a35f8900f8124437aa42347a314f8b7c3049326efdea77d807db2acffcf73770907a988
7
- data.tar.gz: 28080169c288b9da6d87f266aaa839e002e0a8940a96fd9bd5169a23ae0c03be9fda19211b7f903b36143ad3413efcfa79b0886134c6b7521758c58902c4a1d4
6
+ metadata.gz: a2ceb57cf5b2ea84f085a835e47e1533065338479c23bf3da88ff962d5c046c6109f2c0b93461ac4c1d5093a14bc7d522e4c154d1f34225ef3813ebd70f6ecda
7
+ data.tar.gz: ca6403909f96efb50c412ed722e6449b51ea147677f10d2e7729e31d02adc8ae82561eeaf2bbe054ab774bdf9086fe7b690254512f590c49d977920f99e2f371
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![License MIT](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://github.com/envato/ami-spec/blob/master/LICENSE.txt)
4
4
  [![Gem Version](https://badge.fury.io/rb/ami_spec.svg)](https://badge.fury.io/rb/ami_spec)
5
- [![Build Status](https://travis-ci.org/envato/ami-spec.svg?branch=master)](https://travis-ci.org/envato/ami-spec)
5
+ [![Build Status](https://github.com/envato/ami-spec/workflows/tests/badge.svg?branch=master)](https://github.com/envato/ami-spec/actions?query=branch%3Amaster+workflow%3Atests)
6
6
 
7
7
  Acceptance testing your AMIs.
8
8
 
@@ -33,37 +33,39 @@ Run `bundle install`
33
33
  ```cli
34
34
  $ bundle exec ami_spec --help
35
35
  Options:
36
- -r, --role=<s> The role to test, this should map to a directory in the spec
37
- folder
38
- -a, --ami=<s> The ami ID to run tests against
39
- -o, --role-ami-file=<s> A file containing comma separated roles and amis. i.e.
40
- web_server,ami-id.
41
- -s, --specs=<s> The directory to find ServerSpecs
42
- -u, --subnet-id=<s> The subnet to start the instance in. If not provided a subnet
43
- will be chosen from the default VPC
44
- -k, --key-name=<s> The SSH key name to assign to instances. If not provided a
45
- temporary key pair will be generated in AWS
46
- -e, --key-file=<s> The SSH private key file associated to the key_name
47
- -h, --ssh-user=<s> The user to ssh to the instance as
48
- -w, --aws-region=<s> The AWS region, defaults to AWS_DEFAULT_REGION environment
49
- variable
50
- -i, --aws-instance-type=<s> The ec2 instance type, defaults to t2.micro (default:
51
- t2.micro)
52
- -c, --aws-security-groups=<s> Security groups to associate to the launched instances. May be
53
- specified multiple times. If not provided a temporary security
54
- group will be generated in AWS
55
- -p, --aws-public-ip Launch instances with a public IP
56
- -t, --ssh-retries=<i> The number of times we should try sshing to the ec2 instance
57
- before giving up. Defaults to 30 (default: 30)
58
- -g, --tags=<s> Additional tags to add to launched instances in the form of
59
- comma separated key=value pairs. i.e. Name=AmiSpec (default: )
60
- -d, --debug Don't terminate instances on exit
61
- -b, --buildkite Output section separators for buildkite
62
- -f, --wait-for-rc Wait for oldschool SystemV scripts to run before conducting
63
- tests. Currently only supports Ubuntu with upstart
64
- -l, --user-data-file=<s> File path for aws ec2 user data
65
- -m, --iam-instance-profile-arn=<s> IAM instance profile to use
66
- --help Show this message
36
+ -r, --role=<s> The role to test, this should map to a directory in the spec
37
+ folder
38
+ -a, --ami=<s> The ami ID to run tests against
39
+ -o, --role-ami-file=<s> A file containing comma separated roles and amis. i.e.
40
+ web_server,ami-id.
41
+ -s, --specs=<s> The directory to find ServerSpecs
42
+ -u, --subnet-id=<s> The subnet to start the instance in. If not provided a subnet
43
+ will be chosen from the default VPC
44
+ -k, --key-name=<s> The SSH key name to assign to instances. If not provided a
45
+ temporary key pair will be generated in AWS
46
+ -e, --key-file=<s> The SSH private key file associated to the key_name
47
+ -h, --ssh-user=<s> The user to ssh to the instance as
48
+ -w, --aws-region=<s> The AWS region, defaults to AWS_DEFAULT_REGION environment
49
+ variable
50
+ -i, --aws-instance-type=<s> The ec2 instance type, defaults to t2.micro (default:
51
+ t2.micro)
52
+ -c, --aws-security-groups=<s> Security groups IDs to associate to the launched instances. May be
53
+ specified multiple times. If not provided a temporary security
54
+ group will be generated in AWS
55
+ -n, --allow-any-temporary-security-group The temporary security group will allow SSH connections
56
+ from any IP address (0.0.0.0/0), otherwise allow the subnet's block
57
+ -p, --aws-public-ip Launch instances with a public IP
58
+ -t, --ssh-retries=<i> The number of times we should try sshing to the ec2 instance
59
+ before giving up. Defaults to 30 (default: 30)
60
+ -g, --tags=<s> Additional tags to add to launched instances in the form of
61
+ comma separated key=value pairs. i.e. Name=AmiSpec (default: )
62
+ -d, --debug Don't terminate instances on exit
63
+ -b, --buildkite Output section separators for buildkite
64
+ -f, --wait-for-rc Wait for oldschool SystemV scripts to run before conducting
65
+ tests. Currently only supports Ubuntu with upstart
66
+ -l, --user-data-file=<s> File path for aws ec2 user data
67
+ -m, --iam-instance-profile-arn=<s> IAM instance profile to use
68
+ --help Show this message
67
69
 
68
70
  ```
69
71
 
@@ -73,6 +75,41 @@ When the instances becomes reachable it will run all Specs inside the role spec
73
75
 
74
76
  Alternative to the `--ami` and `--role` variables, a file of comma separated roles and AMIs (`ROLE,AMI\n`) can be supplied to `--role-ami-file`.
75
77
 
78
+ ## ServerSpec test layout
79
+
80
+ AmiSpec expects the usual ServerSpec configuration layout as generated by "serverspec-init":
81
+
82
+ spec/
83
+ ├── webserver
84
+ │   └── webserver_spec.rb
85
+ └── spec_helper.rb
86
+
87
+ The \*\_spec.rb files under the role (e.g. webserver) contain the ServerSpec
88
+ tests that you want to run. The spec_helper.rb file can be very simple:
89
+
90
+ require 'serverspec'
91
+
92
+ set :backend, :ssh
93
+
94
+ Note that the backend *needs* to be :ssh or ami_spec might run the tests on
95
+ your local machine, not in EC2.
96
+
97
+ ## Example usage
98
+
99
+ To test a custom AMI using a pre-created security group that allows SSH from anywhere:
100
+
101
+ ```cli
102
+ ami_spec --role webserver\
103
+ --specs spec\
104
+ --aws-region us-east-1\
105
+ --ami ami-0123456789abcdef0\
106
+ --key-name default\
107
+ --key-file ~/.ssh/default.pem\
108
+ --ssh-user ubuntu\
109
+ --aws-public-ip\
110
+ --aws-security-groups sg-0123456789abcdef0
111
+ ```
112
+
76
113
  ## Known caveats
77
114
 
78
115
  ### RSpec conditions in examples
@@ -1,3 +1,3 @@
1
1
  module AmiSpec
2
- VERSION = '1.6.0'
2
+ VERSION = '1.7.0'
3
3
  end
@@ -9,7 +9,7 @@ module AmiSpec
9
9
  while retries < max_retries
10
10
  begin
11
11
  Net::SSH.start(ip_address, user, keys: [key], :verify_host_key => :never) { |ssh| ssh.exec 'echo boo!' }
12
- rescue Errno::ETIMEDOUT, Errno::ECONNREFUSED, Timeout::Error => error
12
+ rescue Errno::ETIMEDOUT, Errno::ECONNREFUSED, Timeout::Error, Net::SSH::Exception => error
13
13
  last_error = error
14
14
  sleep 1
15
15
  else
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.6.0
4
+ version: 1.7.0
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: 2020-03-23 00:00:00.000000000 Z
12
+ date: 2021-07-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk-ec2
@@ -134,7 +134,7 @@ files:
134
134
  homepage: https://github.com/envato/ami-spec
135
135
  licenses: []
136
136
  metadata: {}
137
- post_install_message:
137
+ post_install_message:
138
138
  rdoc_options: []
139
139
  require_paths:
140
140
  - lib
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  version: '0'
151
151
  requirements: []
152
152
  rubygems_version: 3.0.4
153
- signing_key:
153
+ signing_key:
154
154
  specification_version: 4
155
155
  summary: Acceptance testing your AMIs
156
156
  test_files: []