beaker-aws 0.7.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/dependabot.yml +8 -0
- data/.github/workflows/release.yml +32 -0
- data/.github/workflows/test.yml +36 -0
- data/CHANGELOG.md +50 -2
- data/Gemfile +10 -4
- data/HISTORY.md +72 -0
- data/README.md +28 -2
- data/Rakefile +10 -27
- data/beaker-aws.gemspec +2 -5
- data/ec2.md +5 -0
- data/lib/beaker-aws/version.rb +1 -1
- data/lib/beaker/hypervisor/aws_sdk.rb +79 -17
- data/spec/beaker/hypervisor/aws_sdk_spec.rb +48 -1
- data/spec/spec_helper.rb +24 -1
- metadata +13 -52
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 18c49f3a2ee5431a627a1a80bb7c798947c0be6fbb02b2267ea4e988fbe3a530
|
4
|
+
data.tar.gz: 0d1d00d6657a5d63e00e8a0a3190eb4fb539591e4ec24203000da5192da1c1f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ee72b499ae5ae396221fda529da4f378dde67d6f3383564d8483ec8b46cae567fac276ed333b7b813feb90c35a970827d9e5dc87a1e60edf890b43d9b83cd9f
|
7
|
+
data.tar.gz: 3afed442c687d611f377085a8d94e7b9d10cd63440de561a9fa6c960bdc031259dee362389c49e61f42212f735c40a9d02f6c0d930a0a1d5f612bb69e7699b2d
|
@@ -0,0 +1,32 @@
|
|
1
|
+
name: Release
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- '*'
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
release:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
if: github.repository_owner == 'voxpupuli'
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@v2
|
14
|
+
- name: Install Ruby 3.0
|
15
|
+
uses: ruby/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
ruby-version: '3.0'
|
18
|
+
env:
|
19
|
+
BUNDLE_WITHOUT: release
|
20
|
+
- name: Build gem
|
21
|
+
run: gem build *.gemspec
|
22
|
+
- name: Publish gem to rubygems.org
|
23
|
+
run: gem push *.gem
|
24
|
+
env:
|
25
|
+
GEM_HOST_API_KEY: '${{ secrets.RUBYGEMS_AUTH_TOKEN }}'
|
26
|
+
- name: Setup GitHub packages access
|
27
|
+
run: |
|
28
|
+
mkdir -p ~/.gem
|
29
|
+
echo ":github: Bearer ${{ secrets.GITHUB_TOKEN }}" >> ~/.gem/credentials
|
30
|
+
chmod 0600 ~/.gem/credentials
|
31
|
+
- name: Publish gem to GitHub packages
|
32
|
+
run: gem push --key github --host https://rubygems.pkg.github.com/voxpupuli *.gem
|
@@ -0,0 +1,36 @@
|
|
1
|
+
name: Test
|
2
|
+
|
3
|
+
on:
|
4
|
+
- pull_request
|
5
|
+
- push
|
6
|
+
|
7
|
+
env:
|
8
|
+
BUNDLE_WITHOUT: release
|
9
|
+
|
10
|
+
jobs:
|
11
|
+
rspec:
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
strategy:
|
14
|
+
fail-fast: true
|
15
|
+
matrix:
|
16
|
+
include:
|
17
|
+
- ruby: "2.4"
|
18
|
+
- ruby: "2.5"
|
19
|
+
- ruby: "2.6"
|
20
|
+
- ruby: "2.7"
|
21
|
+
- ruby: "3.0"
|
22
|
+
coverage: "yes"
|
23
|
+
env:
|
24
|
+
COVERAGE: ${{ matrix.coverage }}
|
25
|
+
name: RSpec - Ruby ${{ matrix.ruby }}
|
26
|
+
steps:
|
27
|
+
- uses: actions/checkout@v2
|
28
|
+
- name: Install Ruby ${{ matrix.ruby }}
|
29
|
+
uses: ruby/setup-ruby@v1
|
30
|
+
with:
|
31
|
+
ruby-version: ${{ matrix.ruby }}
|
32
|
+
bundler-cache: true
|
33
|
+
- name: spec tests
|
34
|
+
run: bundle exec rake test:spec
|
35
|
+
- name: Verify gem builds
|
36
|
+
run: gem build *.gemspec
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,49 @@
|
|
1
|
-
#
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## [1.0.0](https://github.com/voxpupuli/beaker-aws/tree/1.0.0) (2021-07-22)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/voxpupuli/beaker-aws/compare/0.9.0...1.0.0)
|
6
|
+
|
7
|
+
**Fixed bugs:**
|
8
|
+
|
9
|
+
- Fix 'InvalidInstanceIDNotFound' exception not being handled [\#27](https://github.com/voxpupuli/beaker-aws/pull/27) ([andersonvaf](https://github.com/andersonvaf))
|
10
|
+
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- Update GitHub actions + README.md [\#30](https://github.com/voxpupuli/beaker-aws/pull/30) ([bastelfreak](https://github.com/bastelfreak))
|
14
|
+
- Update fakefs requirement from ~\> 0.6, \<= 0.13.3 to ~\> 1.3, \<= 1.3.3 [\#29](https://github.com/voxpupuli/beaker-aws/pull/29) ([dependabot[bot]](https://github.com/apps/dependabot))
|
15
|
+
- Update rake requirement from ~\> 10.1 to ~\> 13.0 [\#28](https://github.com/voxpupuli/beaker-aws/pull/28) ([dependabot[bot]](https://github.com/apps/dependabot))
|
16
|
+
- Add GH Actions and Dependabot configs [\#25](https://github.com/voxpupuli/beaker-aws/pull/25) ([genebean](https://github.com/genebean))
|
17
|
+
|
18
|
+
## [0.9.0](https://github.com/voxpupuli/beaker-aws/tree/0.9.0) (2019-02-20)
|
19
|
+
|
20
|
+
[Full Changelog](https://github.com/voxpupuli/beaker-aws/compare/0.8.1...0.9.0)
|
21
|
+
|
22
|
+
**Merged pull requests:**
|
23
|
+
|
24
|
+
- \(PDK-1275\) fixes for the AWS hypervisor to account for netdev instances [\#24](https://github.com/voxpupuli/beaker-aws/pull/24) ([Thomas-Franklin](https://github.com/Thomas-Franklin))
|
25
|
+
|
26
|
+
## [0.8.1](https://github.com/puppetlabs/beaker-aws/tree/0.8.0) (2018-12-21)
|
27
|
+
[Full Changelog](https://github.com/puppetlabs/beaker-aws/compare/0.8.0...0.8.1)
|
28
|
+
|
29
|
+
**Merged pull requests:**
|
30
|
+
|
31
|
+
- \(maint\) Fix BKR-1546 for the case where subnet is nil
|
32
|
+
|
33
|
+
## [0.8.0](https://github.com/puppetlabs/beaker-aws/tree/0.8.0) (2018-12-12)
|
34
|
+
[Full Changelog](https://github.com/puppetlabs/beaker-aws/compare/0.7.0...0.8.0)
|
35
|
+
|
36
|
+
**Merged pull requests:**
|
37
|
+
|
38
|
+
- \(BKR-1546\) Added associate\_public\_ip\_address as host variable that is inserted into the AWS config if set
|
39
|
+
|
40
|
+
## [0.7.0](https://github.com/puppetlabs/beaker-aws/tree/0.7.0) (2018-08-27)
|
41
|
+
[Full Changelog](https://github.com/puppetlabs/beaker-aws/compare/0.6.0...0.7.0)
|
42
|
+
|
43
|
+
**Merged pull requests:**
|
44
|
+
|
45
|
+
- \(BKR-1522\) Add options to drop some of the provisioning
|
46
|
+
- \(BKR-1509\) Hypervisor usage instructions for Beaker 4.0
|
2
47
|
|
3
48
|
## [0.6.0](https://github.com/puppetlabs/beaker-aws/tree/0.6.0) (2018-07-16)
|
4
49
|
[Full Changelog](https://github.com/puppetlabs/beaker-aws/compare/0.5.0...0.6.0)
|
@@ -49,4 +94,7 @@
|
|
49
94
|
|
50
95
|
|
51
96
|
|
52
|
-
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
97
|
+
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
98
|
+
|
99
|
+
|
100
|
+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/Gemfile
CHANGED
@@ -1,9 +1,7 @@
|
|
1
|
-
source ENV['GEM_SOURCE'] ||
|
1
|
+
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
|
6
|
-
|
7
5
|
def location_for(place, fake_version = nil)
|
8
6
|
if place =~ /^git:([^#]*)#(.*)/
|
9
7
|
[fake_version, { :git => $1, :branch => $2, :require => false }].compact
|
@@ -18,9 +16,17 @@ end
|
|
18
16
|
# We don't put beaker in as a test dependency because we
|
19
17
|
# don't want to create a transitive dependency
|
20
18
|
group :acceptance_testing do
|
21
|
-
gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '
|
19
|
+
gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '>= 4.30')
|
22
20
|
end
|
23
21
|
|
22
|
+
group :release do
|
23
|
+
gem 'github_changelog_generator', require: false
|
24
|
+
end
|
25
|
+
|
26
|
+
group :coverage, optional: ENV['COVERAGE']!='yes' do
|
27
|
+
gem 'simplecov-console', :require => false
|
28
|
+
gem 'codecov', :require => false
|
29
|
+
end
|
24
30
|
|
25
31
|
if File.exists? "#{__FILE__}.local"
|
26
32
|
eval(File.read("#{__FILE__}.local"), binding)
|
data/HISTORY.md
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
## [0.8.1](https://github.com/puppetlabs/beaker-aws/tree/0.8.0) (2018-12-21)
|
2
|
+
[Full Changelog](https://github.com/puppetlabs/beaker-aws/compare/0.8.0...0.8.1)
|
3
|
+
|
4
|
+
**Merged pull requests:**
|
5
|
+
|
6
|
+
- \(maint\) Fix BKR-1546 for the case where subnet is nil
|
7
|
+
|
8
|
+
## [0.8.0](https://github.com/puppetlabs/beaker-aws/tree/0.8.0) (2018-12-12)
|
9
|
+
[Full Changelog](https://github.com/puppetlabs/beaker-aws/compare/0.7.0...0.8.0)
|
10
|
+
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- \(BKR-1546\) Added associate\_public\_ip\_address as host variable that is inserted into the AWS config if set
|
14
|
+
|
15
|
+
## [0.7.0](https://github.com/puppetlabs/beaker-aws/tree/0.7.0) (2018-08-27)
|
16
|
+
[Full Changelog](https://github.com/puppetlabs/beaker-aws/compare/0.6.0...0.7.0)
|
17
|
+
|
18
|
+
**Merged pull requests:**
|
19
|
+
|
20
|
+
- \(BKR-1522\) Add options to drop some of the provisioning
|
21
|
+
- \(BKR-1509\) Hypervisor usage instructions for Beaker 4.0
|
22
|
+
|
23
|
+
## [0.6.0](https://github.com/puppetlabs/beaker-aws/tree/0.6.0) (2018-07-16)
|
24
|
+
[Full Changelog](https://github.com/puppetlabs/beaker-aws/compare/0.5.0...0.6.0)
|
25
|
+
|
26
|
+
**Merged pull requests:**
|
27
|
+
|
28
|
+
- \(BKR-1481\) Rewrite beaker-aws to use shared .fog parsing [\#15](https://github.com/puppetlabs/beaker-aws/pull/15) ([Dakta](https://github.com/Dakta))
|
29
|
+
- Custom CIDRs for security group, none default VPC fixes [\#14](https://github.com/puppetlabs/beaker-aws/pull/14) ([ardeshireshghi](https://github.com/ardeshireshghi))
|
30
|
+
- \(MAINT\) Document Acceptance Test Setup [\#13](https://github.com/puppetlabs/beaker-aws/pull/13) ([Dakta](https://github.com/Dakta))
|
31
|
+
|
32
|
+
## [0.5.0](https://github.com/puppetlabs/beaker-aws/tree/0.5.0) (2018-06-13)
|
33
|
+
[Full Changelog](https://github.com/puppetlabs/beaker-aws/compare/0.4.0...0.5.0)
|
34
|
+
|
35
|
+
**Merged pull requests:**
|
36
|
+
|
37
|
+
- \(MAINT\) add changelog for 0.5.0 release [\#11](https://github.com/puppetlabs/beaker-aws/pull/11) ([kevpl](https://github.com/kevpl))
|
38
|
+
- \(BKR-1464\) Rewrite to use AWS SDK v3 [\#10](https://github.com/puppetlabs/beaker-aws/pull/10) ([rodjek](https://github.com/rodjek))
|
39
|
+
- \(MAINT\) Bump for new release [\#9](https://github.com/puppetlabs/beaker-aws/pull/9) ([cdenneen](https://github.com/cdenneen))
|
40
|
+
- \(BKR-1199\) Updated documentation for use\_fog\_credentials [\#8](https://github.com/puppetlabs/beaker-aws/pull/8) ([cdenneen](https://github.com/cdenneen))
|
41
|
+
|
42
|
+
## [0.4.0](https://github.com/puppetlabs/beaker-aws/tree/0.4.0) (2017-12-28)
|
43
|
+
[Full Changelog](https://github.com/puppetlabs/beaker-aws/compare/0.3.0...0.4.0)
|
44
|
+
|
45
|
+
**Merged pull requests:**
|
46
|
+
|
47
|
+
- \(bkr-1245\) beaker needs to set session id in aws configuration to enable mfa d bastion account use [\#7](https://github.com/puppetlabs/beaker-aws/pull/7) ([er0ck](https://github.com/er0ck))
|
48
|
+
- \(BKR-1244\) Set vmhostname to host.name since host\[:name\] is awlays nil [\#6](https://github.com/puppetlabs/beaker-aws/pull/6) ([samwoods1](https://github.com/samwoods1))
|
49
|
+
- \(BKR-1199\) adding condition to disable reading fog credentials [\#5](https://github.com/puppetlabs/beaker-aws/pull/5) ([cdenneen](https://github.com/cdenneen))
|
50
|
+
|
51
|
+
## [0.3.0](https://github.com/puppetlabs/beaker-aws/tree/0.3.0) (2017-08-02)
|
52
|
+
[Full Changelog](https://github.com/puppetlabs/beaker-aws/compare/0.2.0...0.3.0)
|
53
|
+
|
54
|
+
**Merged pull requests:**
|
55
|
+
|
56
|
+
- \(maint\) Open the orchestrator port on the master node [\#3](https://github.com/puppetlabs/beaker-aws/pull/3) ([jpartlow](https://github.com/jpartlow))
|
57
|
+
|
58
|
+
## [0.2.0](https://github.com/puppetlabs/beaker-aws/tree/0.2.0) (2017-08-01)
|
59
|
+
[Full Changelog](https://github.com/puppetlabs/beaker-aws/compare/0.1.0...0.2.0)
|
60
|
+
|
61
|
+
**Merged pull requests:**
|
62
|
+
|
63
|
+
- \(PE-21788\) Open port 8170 on ec2 masters [\#2](https://github.com/puppetlabs/beaker-aws/pull/2) ([jpartlow](https://github.com/jpartlow))
|
64
|
+
|
65
|
+
## [0.1.0](https://github.com/puppetlabs/beaker-aws/tree/0.1.0) (2017-07-21)
|
66
|
+
**Merged pull requests:**
|
67
|
+
|
68
|
+
- \(MAINT\) Use AWS's Ubuntu 16.04 AMI [\#1](https://github.com/puppetlabs/beaker-aws/pull/1) ([rishijavia](https://github.com/rishijavia))
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
data/README.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# beaker-aws
|
2
2
|
|
3
|
+
[![License](https://img.shields.io/github/license/voxpupuli/beaker-aws.svg)](https://github.com/voxpupuli/beaker-aws/blob/master/LICENSE)
|
4
|
+
[![Test](https://github.com/voxpupuli/beaker-aws/actions/workflows/test.yml/badge.svg)](https://github.com/voxpupuli/beaker-aws/actions/workflows/test.yml)
|
5
|
+
[![codecov](https://codecov.io/gh/voxpupuli/beaker-aws/branch/master/graph/badge.svg?token=Mypkl78hvK)](https://codecov.io/gh/voxpupuli/beaker-aws)
|
6
|
+
[![Release](https://github.com/voxpupuli/beaker-aws/actions/workflows/release.yml/badge.svg)](https://github.com/voxpupuli/beaker-aws/actions/workflows/release.yml)
|
7
|
+
[![RubyGem Version](https://img.shields.io/gem/v/beaker-aws.svg)](https://rubygems.org/gems/beaker-aws)
|
8
|
+
[![RubyGem Downloads](https://img.shields.io/gem/dt/beaker-aws.svg)](https://rubygems.org/gems/beaker-aws)
|
9
|
+
[![Donated by Puppet Inc](https://img.shields.io/badge/donated%20by-Puppet%20Inc-fb7047.svg)](#transfer-notice)
|
10
|
+
|
3
11
|
Beaker library to use aws hypervisor
|
4
12
|
|
5
13
|
# How to use this wizardry
|
@@ -39,6 +47,24 @@ We run beaker's base acceptance tests with this library to see if the hypervisor
|
|
39
47
|
bundle exec rake test:acceptance
|
40
48
|
```
|
41
49
|
|
42
|
-
|
50
|
+
## Transfer Notice
|
51
|
+
|
52
|
+
This plugin was originally authored by [Puppet Inc](http://puppet.com).
|
53
|
+
The maintainer preferred that Puppet Community take ownership of the module for future improvement and maintenance.
|
54
|
+
Existing pull requests and issues were transferred over, please fork and continue to contribute here.
|
55
|
+
|
56
|
+
Previously: https://github.com/puppetlabs/beaker
|
57
|
+
|
58
|
+
## License
|
59
|
+
|
60
|
+
This gem is licensed under the Apache-2 license.
|
61
|
+
|
62
|
+
## Release information
|
43
63
|
|
44
|
-
|
64
|
+
To make a new release, please do:
|
65
|
+
* update the version in `lib/beaker-aws/version.rb`
|
66
|
+
* Install gems with `bundle install --with release --path .vendor`
|
67
|
+
* generate the changelog with `bundle exec rake changelog`
|
68
|
+
* Check if the new version matches the closed issues/PRs in the changelog
|
69
|
+
* Create a PR with it
|
70
|
+
* After it got merged, push a tag. GitHub actions will do the actual release to rubygems and GitHub Packages
|
data/Rakefile
CHANGED
@@ -1,34 +1,17 @@
|
|
1
1
|
require 'rspec/core/rake_task'
|
2
|
-
require 'github_changelog_generator/task'
|
3
|
-
|
4
|
-
namespace :changelog do
|
5
|
-
# Gets the github token needed for github_changelog_generator
|
6
|
-
# - from env var CHANGELOG_GITHUB_TOKEN
|
7
|
-
# - if unset, will be limited in number of queries allowed to github
|
8
|
-
# - setup a token at https://github.com/settings/tokens
|
9
|
-
def github_token
|
10
|
-
ENV["CHANGELOG_GITHUB_TOKEN"]
|
11
|
-
end
|
12
2
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
config.project = "beaker-aws"
|
17
|
-
# Sets next version in the changelog
|
18
|
-
# - if unset, newest changes will be listed as 'unreleased'
|
19
|
-
# - setting this value directly sets section title on newest changes
|
20
|
-
if !ENV['NEW_VERSION'].nil?
|
21
|
-
config.future_release = ENV["NEW_VERSION"]
|
22
|
-
end
|
23
|
-
end
|
3
|
+
begin
|
4
|
+
require 'rubygems'
|
5
|
+
require 'github_changelog_generator/task'
|
24
6
|
|
25
|
-
GitHubChangelogGenerator::RakeTask.new :
|
26
|
-
config.
|
27
|
-
config.user =
|
28
|
-
config.project =
|
29
|
-
|
30
|
-
config.
|
7
|
+
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
8
|
+
config.exclude_labels = %w{duplicate question invalid wontfix wont-fix skip-changelog}
|
9
|
+
config.user = 'voxpupuli'
|
10
|
+
config.project = 'beaker-aws'
|
11
|
+
gem_version = Gem::Specification.load("#{config.project}.gemspec").version
|
12
|
+
config.future_release = gem_version
|
31
13
|
end
|
14
|
+
rescue LoadError
|
32
15
|
end
|
33
16
|
|
34
17
|
namespace :test do
|
data/beaker-aws.gemspec
CHANGED
@@ -20,16 +20,13 @@ Gem::Specification.new do |s|
|
|
20
20
|
# Testing dependencies
|
21
21
|
s.add_development_dependency 'rspec', '~> 3.0'
|
22
22
|
s.add_development_dependency 'rspec-its'
|
23
|
-
s.add_development_dependency 'fakefs', '~>
|
24
|
-
s.add_development_dependency 'rake', '~>
|
25
|
-
s.add_development_dependency 'simplecov'
|
26
|
-
s.add_development_dependency 'pry', '~> 0.10'
|
23
|
+
s.add_development_dependency 'fakefs', '~> 1.3', '<= 1.3.3'
|
24
|
+
s.add_development_dependency 'rake', '~> 13.0'
|
27
25
|
|
28
26
|
# Documentation dependencies
|
29
27
|
s.add_development_dependency 'yard'
|
30
28
|
s.add_development_dependency 'markdown'
|
31
29
|
s.add_development_dependency 'thin'
|
32
|
-
s.add_development_dependency 'github_changelog_generator'
|
33
30
|
|
34
31
|
# Run time dependencies
|
35
32
|
s.add_runtime_dependency 'stringify-hash', '~> 0.0.0'
|
data/ec2.md
CHANGED
@@ -114,3 +114,8 @@ By default root login is not allowed with Amazon Linux. Setting it to ec2-user w
|
|
114
114
|
|
115
115
|
#### `disable_root_ssh` ####
|
116
116
|
By default Beaker enabled root login on the instance. There are situation where we use AMIs which are pre-configured. Setting `disable_root_ssh` to `true` will stop enablign the root login.
|
117
|
+
|
118
|
+
#### `associate_public_ip_address` ####
|
119
|
+
Beaker uses default setting from subnet policies for the boolean
|
120
|
+
variable "associate public ip address". Use this setting to
|
121
|
+
override that when needed.
|
data/lib/beaker-aws/version.rb
CHANGED
@@ -65,11 +65,19 @@ module Beaker
|
|
65
65
|
# Perform the main launch work
|
66
66
|
launch_all_nodes()
|
67
67
|
|
68
|
-
wait_for_status_netdev()
|
69
|
-
|
70
68
|
# Add metadata tags to each instance
|
69
|
+
# tagging early as some nodes take longer
|
70
|
+
# to initialize and terminate before it has
|
71
|
+
# a chance to provision
|
71
72
|
add_tags()
|
72
73
|
|
74
|
+
# adding the correct security groups to the
|
75
|
+
# network interface, as during the `launch_all_nodes()`
|
76
|
+
# step they never get assigned, although they get created
|
77
|
+
modify_network_interface()
|
78
|
+
|
79
|
+
wait_for_status_netdev()
|
80
|
+
|
73
81
|
# Grab the ip addresses and dns from EC2 for each instance to use for ssh
|
74
82
|
populate_dns()
|
75
83
|
|
@@ -154,7 +162,12 @@ module Beaker
|
|
154
162
|
# @param [String] id The id of the instance to return
|
155
163
|
# @return [Aws::EC2::Types::Instance] An Aws::EC2 instance object
|
156
164
|
def instance_by_id(id)
|
157
|
-
|
165
|
+
begin
|
166
|
+
client.describe_instances(:instance_ids => [id]).reservations.first.instances.first
|
167
|
+
rescue Aws::EC2::Errors::InvalidInstanceIDNotFound
|
168
|
+
@logger.notify("aws-sdk: Error while trying to describe instance (id: #{id}). Likely the instance is not created yet.")
|
169
|
+
nil
|
170
|
+
end
|
158
171
|
end
|
159
172
|
|
160
173
|
# Return all instances currently on ec2.
|
@@ -267,10 +280,15 @@ module Beaker
|
|
267
280
|
vpc_id = host['vpc_id'] || @options['vpc_id'] || nil
|
268
281
|
host['sg_cidr_ips'] = host['sg_cidr_ips'] || '0.0.0.0/0';
|
269
282
|
sg_cidr_ips = host['sg_cidr_ips'].split(',')
|
283
|
+
assoc_pub_ip_addr = host['associate_public_ip_address']
|
270
284
|
|
271
285
|
if vpc_id && !subnet_id
|
272
286
|
raise RuntimeError, "A subnet_id must be provided with a vpc_id"
|
273
287
|
end
|
288
|
+
|
289
|
+
if assoc_pub_ip_addr && !subnet_id
|
290
|
+
raise RuntimeError, "A subnet_id must be provided when configuring assoc_pub_ip_addr"
|
291
|
+
end
|
274
292
|
|
275
293
|
# Use snapshot provided for this host
|
276
294
|
image_type = host['snapshot']
|
@@ -342,12 +360,24 @@ module Beaker
|
|
342
360
|
:enabled => true,
|
343
361
|
},
|
344
362
|
:key_name => ensure_key_pair(region).key_pairs.first.key_name,
|
345
|
-
:security_group_ids => [security_group.group_id, ping_security_group.group_id],
|
346
363
|
:instance_type => amisize,
|
347
364
|
:disable_api_termination => false,
|
348
365
|
:instance_initiated_shutdown_behavior => "terminate",
|
349
|
-
:subnet_id => subnet_id,
|
350
366
|
}
|
367
|
+
if assoc_pub_ip_addr
|
368
|
+
# this never gets created, so they end up with
|
369
|
+
# default security group which only allows for
|
370
|
+
# ssh access from outside world which
|
371
|
+
# doesn't work well with remote devices etc.
|
372
|
+
config[:network_interfaces] = [{
|
373
|
+
:subnet_id => subnet_id,
|
374
|
+
:groups => [security_group.group_id, ping_security_group.group_id],
|
375
|
+
:device_index => 0,
|
376
|
+
:associate_public_ip_address => assoc_pub_ip_addr,
|
377
|
+
}]
|
378
|
+
else
|
379
|
+
config[:subnet_id] = subnet_id
|
380
|
+
end
|
351
381
|
config[:block_device_mappings] = block_device_mappings if image.root_device_type == :ebs
|
352
382
|
reservation = client(region).run_instances(config)
|
353
383
|
reservation.instances.first
|
@@ -472,7 +502,7 @@ module Beaker
|
|
472
502
|
# Wait for each node to reach status :running
|
473
503
|
@logger.notify("aws-sdk: Waiting for all hosts to be #{state_name}")
|
474
504
|
instances.each do |x|
|
475
|
-
name = x[:host].name
|
505
|
+
name = x[:host] ? x[:host].name : x[:name]
|
476
506
|
instance = x[:instance]
|
477
507
|
@logger.notify("aws-sdk: Wait for node #{name} to be #{state_name}")
|
478
508
|
# Here we keep waiting for the machine state to reach 'running' with an
|
@@ -482,7 +512,7 @@ module Beaker
|
|
482
512
|
refreshed_instance = instance_by_id(instance.instance_id)
|
483
513
|
|
484
514
|
if refreshed_instance.nil?
|
485
|
-
@logger.debug("Instance #{name} not yet available
|
515
|
+
@logger.debug("Instance #{name} not yet available")
|
486
516
|
else
|
487
517
|
if block_given?
|
488
518
|
test_result = yield refreshed_instance
|
@@ -517,9 +547,9 @@ module Beaker
|
|
517
547
|
wait_for_status(:running, @hosts)
|
518
548
|
|
519
549
|
wait_for_status(nil, @hosts) do |instance|
|
520
|
-
instance_status_collection =
|
521
|
-
first_instance = instance_status_collection.
|
522
|
-
first_instance[:
|
550
|
+
instance_status_collection = client.describe_instance_status({:instance_ids => [instance.instance_id]})
|
551
|
+
first_instance = instance_status_collection.first[:instance_statuses].first
|
552
|
+
first_instance[:instance_status][:status] == "ok" if first_instance
|
523
553
|
end
|
524
554
|
|
525
555
|
break
|
@@ -574,6 +604,33 @@ module Beaker
|
|
574
604
|
nil
|
575
605
|
end
|
576
606
|
|
607
|
+
# Add correct security groups to hosts network_interface
|
608
|
+
# as during the create_instance stage it is too early in process
|
609
|
+
# to configure
|
610
|
+
#
|
611
|
+
# @return [void]
|
612
|
+
# @api private
|
613
|
+
def modify_network_interface
|
614
|
+
@hosts.each do |host|
|
615
|
+
instance = host['instance']
|
616
|
+
host['sg_cidr_ips'] = host['sg_cidr_ips'] || '0.0.0.0/0';
|
617
|
+
sg_cidr_ips = host['sg_cidr_ips'].split(',')
|
618
|
+
|
619
|
+
# Define tags for the instance
|
620
|
+
@logger.notify("aws-sdk: Update network_interface for #{host.name}")
|
621
|
+
|
622
|
+
security_group = ensure_group(instance[:network_interfaces].first, Beaker::EC2Helper.amiports(host), sg_cidr_ips)
|
623
|
+
ping_security_group = ensure_ping_group(instance[:network_interfaces].first, sg_cidr_ips)
|
624
|
+
|
625
|
+
client.modify_network_interface_attribute(
|
626
|
+
:network_interface_id => "#{instance[:network_interfaces].first[:network_interface_id]}",
|
627
|
+
:groups => [security_group.group_id, ping_security_group.group_id],
|
628
|
+
)
|
629
|
+
end
|
630
|
+
|
631
|
+
nil
|
632
|
+
end
|
633
|
+
|
577
634
|
# Populate the hosts IP address from the EC2 dns_name
|
578
635
|
#
|
579
636
|
# @return [void]
|
@@ -679,13 +736,17 @@ module Beaker
|
|
679
736
|
end
|
680
737
|
backoff_sleep(tries)
|
681
738
|
end
|
682
|
-
host['user'] = '
|
683
|
-
host.close
|
739
|
+
host['user'] = 'admin'
|
684
740
|
sha256 = Digest::SHA256.new
|
685
|
-
password = sha256.hexdigest((1..50).map{(rand(86)+40).chr}.join.gsub(/\\/,'\&\&'))
|
686
|
-
|
687
|
-
|
741
|
+
password = sha256.hexdigest((1..50).map{(rand(86)+40).chr}.join.gsub(/\\/,'\&\&')) + 'password!'
|
742
|
+
# disabling password policy to account for the enforcement level set
|
743
|
+
# and the generated password is sometimes too `01070366:3: Bad password (admin): BAD PASSWORD: \
|
744
|
+
# it is too simplistic/systematic`
|
745
|
+
host.exec(Command.new('modify auth password-policy policy-enforcement disabled'))
|
746
|
+
host.exec(Command.new("modify auth user admin password #{password}"))
|
688
747
|
@logger.notify("f5: Configured admin password to be #{password}")
|
748
|
+
host.close
|
749
|
+
host['ssh'] = {:password => password}
|
689
750
|
end
|
690
751
|
|
691
752
|
# Enables root access for a host on an netscaler platform
|
@@ -717,7 +778,7 @@ module Beaker
|
|
717
778
|
elsif host['platform'] =~ /windows/
|
718
779
|
@logger.notify('aws-sdk: Change hostname on windows is not supported.')
|
719
780
|
else
|
720
|
-
next if host['platform'] =~ /netscaler/
|
781
|
+
next if host['platform'] =~ /f5-|netscaler/
|
721
782
|
host.exec(Command.new("hostname #{host.name}"))
|
722
783
|
if host['vmname'] =~ /^amazon/
|
723
784
|
# Amazon Linux requires this to preserve host name changes across reboots.
|
@@ -738,7 +799,7 @@ module Beaker
|
|
738
799
|
elsif host['platform'] =~ /windows/
|
739
800
|
@logger.notify('aws-sdk: Change hostname on windows is not supported.')
|
740
801
|
else
|
741
|
-
next if host['platform'] =~ /netscaler/
|
802
|
+
next if host['platform'] =~ /ft-|netscaler/
|
742
803
|
host.exec(Command.new("hostname #{host.hostname}"))
|
743
804
|
if host['vmname'] =~ /^amazon/
|
744
805
|
# See note above
|
@@ -1109,3 +1170,4 @@ module Beaker
|
|
1109
1170
|
end
|
1110
1171
|
end
|
1111
1172
|
end
|
1173
|
+
|
@@ -119,6 +119,7 @@ module Beaker
|
|
119
119
|
before :each do
|
120
120
|
expect(aws).to receive(:launch_all_nodes)
|
121
121
|
expect(aws).to receive(:add_tags)
|
122
|
+
expect(aws).to receive(:modify_network_interface)
|
122
123
|
expect(aws).to receive(:populate_dns)
|
123
124
|
expect(aws).to receive(:enable_root_on_hosts)
|
124
125
|
expect(aws).to receive(:set_hostnames)
|
@@ -702,7 +703,7 @@ module Beaker
|
|
702
703
|
allow( aws ).to receive( :backoff_sleep )
|
703
704
|
sha_mock = Object.new
|
704
705
|
allow( Digest::SHA256 ).to receive( :new ).and_return(sha_mock)
|
705
|
-
expect( sha_mock ).to receive( :hexdigest ).once()
|
706
|
+
expect( sha_mock ).to receive( :hexdigest ).and_return('thistest').once()
|
706
707
|
enable_root_f5
|
707
708
|
end
|
708
709
|
|
@@ -1213,5 +1214,51 @@ module Beaker
|
|
1213
1214
|
aws
|
1214
1215
|
end
|
1215
1216
|
end
|
1217
|
+
|
1218
|
+
describe 'create_instance' do
|
1219
|
+
let(:mock_client) { instance_double(Aws::EC2::Client) }
|
1220
|
+
|
1221
|
+
before(:each) do
|
1222
|
+
allow(aws).to receive(:client).and_return(mock_client)
|
1223
|
+
vpc = instance_double(Aws::EC2::Types::Vpc, :vpc_id => 1337)
|
1224
|
+
describe_vpcs_result = instance_double(Aws::EC2::Types::DescribeVpcsResult, :vpcs => [vpc])
|
1225
|
+
allow(mock_client).to receive(:describe_vpcs).and_return(describe_vpcs_result)
|
1226
|
+
image = instance_double(Aws::EC2::Types::Image, :root_device_type => :no_device)
|
1227
|
+
described_images = instance_double(Aws::EC2::Types::DescribeImagesResult, :images => [image])
|
1228
|
+
allow(mock_client).to receive(:describe_images).and_return(described_images)
|
1229
|
+
security_group = instance_double(Aws::EC2::Types::GroupIdentifier, :group_id => 69)
|
1230
|
+
security_groups_result =
|
1231
|
+
instance_double(Aws::EC2::Types::DescribeSecurityGroupsResult, :security_groups => [security_group])
|
1232
|
+
allow(mock_client).to receive(:describe_security_groups).and_return(security_groups_result)
|
1233
|
+
key_pair = instance_double(Aws::EC2::Types::KeyPairInfo, :key_name => 'a-key')
|
1234
|
+
key_pair_result = instance_double(Aws::EC2::Types::DescribeKeyPairsResult, :key_pairs => [key_pair])
|
1235
|
+
allow(aws).to receive(:ensure_key_pair).and_return(key_pair_result)
|
1236
|
+
end
|
1237
|
+
|
1238
|
+
it 'raises an error when associate_public_ip_address is included without subnet_id' do
|
1239
|
+
host = @hosts[0]
|
1240
|
+
host['associate_public_ip_address'] = true
|
1241
|
+
expect{ aws.create_instance(host, amispec, nil) }.to raise_error("A subnet_id must be provided when configuring assoc_pub_ip_addr")
|
1242
|
+
end
|
1243
|
+
|
1244
|
+
it 'sets associate_public_ip_address when included' do
|
1245
|
+
host = @hosts[0]
|
1246
|
+
host['associate_public_ip_address'] = true
|
1247
|
+
variable_path = hash_including(
|
1248
|
+
:network_interfaces => [hash_including(:associate_public_ip_address => true)])
|
1249
|
+
reservation = instance_double(Aws::EC2::Types::Reservation, :instances => [instance_double(Aws::EC2::Types::Instance)])
|
1250
|
+
expect(mock_client).to receive(:run_instances).with(variable_path).and_return(reservation)
|
1251
|
+
aws.create_instance(host, amispec, "subnetfoo")
|
1252
|
+
end
|
1253
|
+
|
1254
|
+
it 'omits network_interfaces and associate_public_ip_address when not included, instead using subnet_id' do
|
1255
|
+
host = @hosts[0]
|
1256
|
+
variable_path = hash_including(
|
1257
|
+
:subnet_id => nil)
|
1258
|
+
reservation = instance_double(Aws::EC2::Types::Reservation, :instances => [instance_double(Aws::EC2::Types::Instance)])
|
1259
|
+
expect(mock_client).to receive(:run_instances).with(variable_path).and_return(reservation)
|
1260
|
+
aws.create_instance(host, amispec, nil)
|
1261
|
+
end
|
1262
|
+
end
|
1216
1263
|
end
|
1217
1264
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,27 @@
|
|
1
|
-
|
1
|
+
begin
|
2
|
+
require 'simplecov'
|
3
|
+
require 'simplecov-console'
|
4
|
+
require 'codecov'
|
5
|
+
rescue LoadError
|
6
|
+
else
|
7
|
+
SimpleCov.start do
|
8
|
+
track_files 'lib/**/*.rb'
|
9
|
+
|
10
|
+
add_filter '/spec'
|
11
|
+
|
12
|
+
enable_coverage :branch
|
13
|
+
|
14
|
+
# do not track vendored files
|
15
|
+
add_filter '/vendor'
|
16
|
+
add_filter '/.vendor'
|
17
|
+
end
|
18
|
+
|
19
|
+
SimpleCov.formatters = [
|
20
|
+
SimpleCov::Formatter::Console,
|
21
|
+
SimpleCov::Formatter::Codecov,
|
22
|
+
]
|
23
|
+
end
|
24
|
+
|
2
25
|
require 'rspec/its'
|
3
26
|
require 'beaker'
|
4
27
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beaker-aws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rishi Javia, Kevin Imber, Tony Vu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -44,62 +44,34 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '1.3'
|
48
48
|
- - "<="
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version:
|
50
|
+
version: 1.3.3
|
51
51
|
type: :development
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
55
|
- - "~>"
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
version: '
|
57
|
+
version: '1.3'
|
58
58
|
- - "<="
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
60
|
+
version: 1.3.3
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: rake
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
67
|
+
version: '13.0'
|
68
68
|
type: :development
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: '
|
75
|
-
- !ruby/object:Gem::Dependency
|
76
|
-
name: simplecov
|
77
|
-
requirement: !ruby/object:Gem::Requirement
|
78
|
-
requirements:
|
79
|
-
- - ">="
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
version: '0'
|
82
|
-
type: :development
|
83
|
-
prerelease: false
|
84
|
-
version_requirements: !ruby/object:Gem::Requirement
|
85
|
-
requirements:
|
86
|
-
- - ">="
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: '0'
|
89
|
-
- !ruby/object:Gem::Dependency
|
90
|
-
name: pry
|
91
|
-
requirement: !ruby/object:Gem::Requirement
|
92
|
-
requirements:
|
93
|
-
- - "~>"
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: '0.10'
|
96
|
-
type: :development
|
97
|
-
prerelease: false
|
98
|
-
version_requirements: !ruby/object:Gem::Requirement
|
99
|
-
requirements:
|
100
|
-
- - "~>"
|
101
|
-
- !ruby/object:Gem::Version
|
102
|
-
version: '0.10'
|
74
|
+
version: '13.0'
|
103
75
|
- !ruby/object:Gem::Dependency
|
104
76
|
name: yard
|
105
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,20 +114,6 @@ dependencies:
|
|
142
114
|
- - ">="
|
143
115
|
- !ruby/object:Gem::Version
|
144
116
|
version: '0'
|
145
|
-
- !ruby/object:Gem::Dependency
|
146
|
-
name: github_changelog_generator
|
147
|
-
requirement: !ruby/object:Gem::Requirement
|
148
|
-
requirements:
|
149
|
-
- - ">="
|
150
|
-
- !ruby/object:Gem::Version
|
151
|
-
version: '0'
|
152
|
-
type: :development
|
153
|
-
prerelease: false
|
154
|
-
version_requirements: !ruby/object:Gem::Requirement
|
155
|
-
requirements:
|
156
|
-
- - ">="
|
157
|
-
- !ruby/object:Gem::Version
|
158
|
-
version: '0'
|
159
117
|
- !ruby/object:Gem::Dependency
|
160
118
|
name: stringify-hash
|
161
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -206,10 +164,14 @@ executables:
|
|
206
164
|
extensions: []
|
207
165
|
extra_rdoc_files: []
|
208
166
|
files:
|
167
|
+
- ".github/dependabot.yml"
|
168
|
+
- ".github/workflows/release.yml"
|
169
|
+
- ".github/workflows/test.yml"
|
209
170
|
- ".gitignore"
|
210
171
|
- ".simplecov"
|
211
172
|
- CHANGELOG.md
|
212
173
|
- Gemfile
|
174
|
+
- HISTORY.md
|
213
175
|
- LICENSE
|
214
176
|
- README.md
|
215
177
|
- Rakefile
|
@@ -247,8 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
247
209
|
- !ruby/object:Gem::Version
|
248
210
|
version: '0'
|
249
211
|
requirements: []
|
250
|
-
|
251
|
-
rubygems_version: 2.5.1
|
212
|
+
rubygems_version: 3.2.22
|
252
213
|
signing_key:
|
253
214
|
specification_version: 4
|
254
215
|
summary: Beaker DSL Extension Helpers!
|