beaker-openstack 1.0.0 → 2.1.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/.github/dependabot.yml +15 -6
- data/.github/release.yml +41 -0
- data/.github/workflows/release.yml +95 -20
- data/.github/workflows/test.yml +33 -11
- data/CHANGELOG.md +32 -0
- data/Gemfile +3 -19
- data/README.md +6 -0
- data/Rakefile +4 -3
- data/beaker-openstack.gemspec +8 -6
- data/lib/beaker/hypervisor/openstack.rb +107 -70
- data/lib/beaker-openstack/version.rb +1 -1
- metadata +41 -14
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 55a3c90aebd4a0b7dbc596deec04e3282296b5828f3f7276a60816bd4683681f
|
|
4
|
+
data.tar.gz: 73ab6d4c7a3b267237882aa003a5af527f5819855d24e4dc9d594130dfcb68e2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cf439d1e7731e19723cda5c1e0fb3d7f0f384bcb9a4fed9ec2feb5173b9b181ff8d0414f9c0aa95fe965d2f0c2ee2038183ac0589a5b3b485e45f810385dfca4
|
|
7
|
+
data.tar.gz: 2ecf5c50a16e62d6c334aa033d9c5d36ccc0836205e1326fc3eb22af5352bb0079ec14329598b22d9bb94f4e51f80e71c194be9f418bacead8609c4a1a6137ce
|
data/.github/dependabot.yml
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
version: 2
|
|
2
2
|
updates:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
# raise PRs for gem updates
|
|
4
|
+
- package-ecosystem: bundler
|
|
5
|
+
directory: "/"
|
|
6
|
+
schedule:
|
|
7
|
+
interval: daily
|
|
8
|
+
time: "13:00"
|
|
9
|
+
open-pull-requests-limit: 10
|
|
10
|
+
|
|
11
|
+
# Maintain dependencies for GitHub Actions
|
|
12
|
+
- package-ecosystem: github-actions
|
|
13
|
+
directory: "/"
|
|
14
|
+
schedule:
|
|
15
|
+
interval: daily
|
|
16
|
+
time: "13:00"
|
|
17
|
+
open-pull-requests-limit: 10
|
data/.github/release.yml
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes
|
|
3
|
+
|
|
4
|
+
changelog:
|
|
5
|
+
exclude:
|
|
6
|
+
labels:
|
|
7
|
+
- duplicate
|
|
8
|
+
- invalid
|
|
9
|
+
- modulesync
|
|
10
|
+
- question
|
|
11
|
+
- skip-changelog
|
|
12
|
+
- wont-fix
|
|
13
|
+
- wontfix
|
|
14
|
+
- github_actions
|
|
15
|
+
|
|
16
|
+
categories:
|
|
17
|
+
- title: Breaking Changes 🛠
|
|
18
|
+
labels:
|
|
19
|
+
- backwards-incompatible
|
|
20
|
+
|
|
21
|
+
- title: New Features 🎉
|
|
22
|
+
labels:
|
|
23
|
+
- enhancement
|
|
24
|
+
|
|
25
|
+
- title: Bug Fixes 🐛
|
|
26
|
+
labels:
|
|
27
|
+
- bug
|
|
28
|
+
- bugfix
|
|
29
|
+
|
|
30
|
+
- title: Documentation Updates 📚
|
|
31
|
+
labels:
|
|
32
|
+
- documentation
|
|
33
|
+
- docs
|
|
34
|
+
|
|
35
|
+
- title: Dependency Updates ⬆️
|
|
36
|
+
labels:
|
|
37
|
+
- dependencies
|
|
38
|
+
|
|
39
|
+
- title: Other Changes
|
|
40
|
+
labels:
|
|
41
|
+
- "*"
|
|
@@ -1,31 +1,106 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
name: Gem Release
|
|
2
3
|
|
|
3
4
|
on:
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
push:
|
|
6
|
+
tags:
|
|
7
|
+
- '*'
|
|
8
|
+
|
|
9
|
+
permissions: {}
|
|
6
10
|
|
|
7
11
|
jobs:
|
|
8
|
-
release:
|
|
9
|
-
|
|
10
|
-
if: github.
|
|
12
|
+
build-release:
|
|
13
|
+
# Prevent releases from forked repositories
|
|
14
|
+
if: github.repository_owner == 'voxpupuli'
|
|
15
|
+
name: Build the gem
|
|
16
|
+
runs-on: ubuntu-24.04
|
|
11
17
|
steps:
|
|
12
|
-
- uses: actions/checkout@
|
|
13
|
-
- name: Install Ruby
|
|
18
|
+
- uses: actions/checkout@v6
|
|
19
|
+
- name: Install Ruby
|
|
14
20
|
uses: ruby/setup-ruby@v1
|
|
15
21
|
with:
|
|
16
|
-
ruby-version: '
|
|
17
|
-
env:
|
|
18
|
-
BUNDLE_WITHOUT: release
|
|
22
|
+
ruby-version: 'ruby'
|
|
19
23
|
- name: Build gem
|
|
20
|
-
|
|
24
|
+
shell: bash
|
|
25
|
+
run: gem build --verbose *.gemspec
|
|
26
|
+
- name: Upload gem to GitHub cache
|
|
27
|
+
uses: actions/upload-artifact@v6
|
|
28
|
+
with:
|
|
29
|
+
name: gem-artifact
|
|
30
|
+
path: '*.gem'
|
|
31
|
+
retention-days: 1
|
|
32
|
+
compression-level: 0
|
|
33
|
+
|
|
34
|
+
create-github-release:
|
|
35
|
+
needs: build-release
|
|
36
|
+
name: Create GitHub release
|
|
37
|
+
runs-on: ubuntu-24.04
|
|
38
|
+
permissions:
|
|
39
|
+
contents: write # clone repo and create release
|
|
40
|
+
steps:
|
|
41
|
+
- name: Download gem from GitHub cache
|
|
42
|
+
uses: actions/download-artifact@v7
|
|
43
|
+
with:
|
|
44
|
+
name: gem-artifact
|
|
45
|
+
- name: Create Release
|
|
46
|
+
shell: bash
|
|
47
|
+
env:
|
|
48
|
+
GH_TOKEN: ${{ github.token }}
|
|
49
|
+
run: gh release create --repo ${{ github.repository }} ${{ github.ref_name }} --generate-notes *.gem
|
|
50
|
+
|
|
51
|
+
release-to-github:
|
|
52
|
+
needs: build-release
|
|
53
|
+
name: Release to GitHub
|
|
54
|
+
runs-on: ubuntu-24.04
|
|
55
|
+
permissions:
|
|
56
|
+
packages: write # publish to rubygems.pkg.github.com
|
|
57
|
+
steps:
|
|
58
|
+
- name: Download gem from GitHub cache
|
|
59
|
+
uses: actions/download-artifact@v7
|
|
60
|
+
with:
|
|
61
|
+
name: gem-artifact
|
|
62
|
+
- name: Publish gem to GitHub packages
|
|
63
|
+
run: gem push --host https://rubygems.pkg.github.com/${{ github.repository_owner }} *.gem
|
|
64
|
+
env:
|
|
65
|
+
GEM_HOST_API_KEY: ${{ secrets.GITHUB_TOKEN }}
|
|
66
|
+
|
|
67
|
+
release-to-rubygems:
|
|
68
|
+
needs: build-release
|
|
69
|
+
name: Release gem to rubygems.org
|
|
70
|
+
runs-on: ubuntu-24.04
|
|
71
|
+
environment: release # recommended by rubygems.org
|
|
72
|
+
permissions:
|
|
73
|
+
id-token: write # rubygems.org authentication
|
|
74
|
+
steps:
|
|
75
|
+
- name: Download gem from GitHub cache
|
|
76
|
+
uses: actions/download-artifact@v7
|
|
77
|
+
with:
|
|
78
|
+
name: gem-artifact
|
|
79
|
+
- uses: rubygems/configure-rubygems-credentials@v1.0.0
|
|
21
80
|
- name: Publish gem to rubygems.org
|
|
81
|
+
shell: bash
|
|
22
82
|
run: gem push *.gem
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
83
|
+
|
|
84
|
+
release-verification:
|
|
85
|
+
name: Check that all releases are done
|
|
86
|
+
runs-on: ubuntu-24.04
|
|
87
|
+
permissions:
|
|
88
|
+
contents: read # minimal permissions that we have to grant
|
|
89
|
+
needs:
|
|
90
|
+
- create-github-release
|
|
91
|
+
- release-to-github
|
|
92
|
+
- release-to-rubygems
|
|
93
|
+
steps:
|
|
94
|
+
- name: Download gem from GitHub cache
|
|
95
|
+
uses: actions/download-artifact@v7
|
|
96
|
+
with:
|
|
97
|
+
name: gem-artifact
|
|
98
|
+
- name: Install Ruby
|
|
99
|
+
uses: ruby/setup-ruby@v1
|
|
100
|
+
with:
|
|
101
|
+
ruby-version: 'ruby'
|
|
102
|
+
- name: Wait for release to propagate
|
|
103
|
+
shell: bash
|
|
26
104
|
run: |
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
chmod 0600 ~/.gem/credentials
|
|
30
|
-
- name: Publish gem to GitHub packages
|
|
31
|
-
run: gem push --key github --host https://rubygems.pkg.github.com/voxpupuli *.gem
|
|
105
|
+
gem install rubygems-await
|
|
106
|
+
gem await *.gem
|
data/.github/workflows/test.yml
CHANGED
|
@@ -1,29 +1,51 @@
|
|
|
1
1
|
name: Test
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
pull_request: {}
|
|
5
|
+
push:
|
|
6
|
+
branches:
|
|
7
|
+
- master
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
6
11
|
|
|
7
12
|
jobs:
|
|
13
|
+
matrix:
|
|
14
|
+
runs-on: ubuntu-24.04
|
|
15
|
+
outputs:
|
|
16
|
+
ruby: ${{ steps.ruby.outputs.versions }}
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v6
|
|
19
|
+
- name: Install Ruby ${{ matrix.ruby }}
|
|
20
|
+
uses: ruby/setup-ruby@v1
|
|
21
|
+
with:
|
|
22
|
+
ruby-version: '3.4'
|
|
23
|
+
bundler-cache: true
|
|
24
|
+
- id: ruby
|
|
25
|
+
uses: voxpupuli/ruby-version@v2
|
|
8
26
|
test:
|
|
9
27
|
runs-on: ubuntu-latest
|
|
28
|
+
needs: matrix
|
|
10
29
|
strategy:
|
|
11
30
|
fail-fast: false
|
|
12
31
|
matrix:
|
|
13
|
-
ruby:
|
|
14
|
-
|
|
15
|
-
- "2.5"
|
|
16
|
-
- "2.6"
|
|
17
|
-
- "2.7"
|
|
18
|
-
- "3.0"
|
|
32
|
+
ruby: ${{ fromJSON(needs.matrix.outputs.ruby) }}
|
|
33
|
+
|
|
19
34
|
steps:
|
|
20
|
-
- uses: actions/checkout@
|
|
35
|
+
- uses: actions/checkout@v6
|
|
21
36
|
- name: Install Ruby ${{ matrix.ruby }}
|
|
22
37
|
uses: ruby/setup-ruby@v1
|
|
23
38
|
with:
|
|
24
39
|
ruby-version: ${{ matrix.ruby }}
|
|
25
40
|
bundler-cache: true
|
|
26
|
-
env:
|
|
27
|
-
BUNDLE_WITHOUT: release
|
|
28
41
|
- name: Run tests
|
|
29
42
|
run: bundle exec rake spec
|
|
43
|
+
|
|
44
|
+
tests:
|
|
45
|
+
needs:
|
|
46
|
+
- matrix
|
|
47
|
+
- test
|
|
48
|
+
runs-on: ubuntu-24.04
|
|
49
|
+
name: Test suite
|
|
50
|
+
steps:
|
|
51
|
+
- run: echo Test suite completed
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,38 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [2.1.0](https://github.com/voxpupuli/beaker-openstack/tree/2.1.0) (2025-12-31)
|
|
6
|
+
|
|
7
|
+
[Full Changelog](https://github.com/voxpupuli/beaker-openstack/compare/2.0.0...2.1.0)
|
|
8
|
+
|
|
9
|
+
**Implemented enhancements:**
|
|
10
|
+
|
|
11
|
+
- Allow beaker-openstack to run with Beaker 6.x and 7.x [\#31](https://github.com/voxpupuli/beaker-openstack/pull/31) ([canihavethisone](https://github.com/canihavethisone))
|
|
12
|
+
|
|
13
|
+
**Merged pull requests:**
|
|
14
|
+
|
|
15
|
+
- CI: Generate ruby matrix dynamically & Add Ruby 4 support [\#32](https://github.com/voxpupuli/beaker-openstack/pull/32) ([bastelfreak](https://github.com/bastelfreak))
|
|
16
|
+
|
|
17
|
+
## [2.0.0](https://github.com/voxpupuli/beaker-openstack/tree/2.0.0) (2024-02-03)
|
|
18
|
+
|
|
19
|
+
[Full Changelog](https://github.com/voxpupuli/beaker-openstack/compare/1.0.0...2.0.0)
|
|
20
|
+
|
|
21
|
+
**Breaking changes:**
|
|
22
|
+
|
|
23
|
+
- Drop EoL Ruby 2.4/2.5/2.6 support [\#22](https://github.com/voxpupuli/beaker-openstack/pull/22) ([bastelfreak](https://github.com/bastelfreak))
|
|
24
|
+
|
|
25
|
+
**Implemented enhancements:**
|
|
26
|
+
|
|
27
|
+
- Add parallel instance creation opt-in option [\#20](https://github.com/voxpupuli/beaker-openstack/pull/20) ([canihavethisone](https://github.com/canihavethisone))
|
|
28
|
+
|
|
29
|
+
**Merged pull requests:**
|
|
30
|
+
|
|
31
|
+
- gemspec: Fix typo in Apache-2.0 license name [\#27](https://github.com/voxpupuli/beaker-openstack/pull/27) ([bastelfreak](https://github.com/bastelfreak))
|
|
32
|
+
- Apply best practices for our changelog generator [\#26](https://github.com/voxpupuli/beaker-openstack/pull/26) ([bastelfreak](https://github.com/bastelfreak))
|
|
33
|
+
- Cleanup Gemfile, add beaker as runtime dependency [\#24](https://github.com/voxpupuli/beaker-openstack/pull/24) ([bastelfreak](https://github.com/bastelfreak))
|
|
34
|
+
- dependabot: check for github actions and bundler [\#21](https://github.com/voxpupuli/beaker-openstack/pull/21) ([bastelfreak](https://github.com/bastelfreak))
|
|
35
|
+
- Update fakefs requirement from ~\> 1.3 to ~\> 2.4 [\#19](https://github.com/voxpupuli/beaker-openstack/pull/19) ([dependabot[bot]](https://github.com/apps/dependabot))
|
|
36
|
+
|
|
5
37
|
## [1.0.0](https://github.com/voxpupuli/beaker-openstack/tree/1.0.0) (2021-07-09)
|
|
6
38
|
|
|
7
39
|
[Full Changelog](https://github.com/voxpupuli/beaker-openstack/compare/0.3.0...1.0.0)
|
data/Gemfile
CHANGED
|
@@ -2,23 +2,7 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org"
|
|
|
2
2
|
|
|
3
3
|
gemspec
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
elsif place =~ /^file:\/\/(.*)/
|
|
9
|
-
['>= 0', { :path => File.expand_path($1), :require => false }]
|
|
10
|
-
else
|
|
11
|
-
[place, { :require => false }]
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
# We don't put beaker in as a test dependency because we
|
|
17
|
-
# don't want to create a transitive dependency
|
|
18
|
-
group :acceptance_testing do
|
|
19
|
-
gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 4.0')
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
group :release do
|
|
23
|
-
gem 'github_changelog_generator', :require => false
|
|
5
|
+
group :release, optional: true do
|
|
6
|
+
gem 'faraday-retry', '~> 2.1', require: false
|
|
7
|
+
gem 'github_changelog_generator','~> 1.16', '>= 1.16.4', require: false
|
|
24
8
|
end
|
data/README.md
CHANGED
|
@@ -137,6 +137,7 @@ CONFIG:
|
|
|
137
137
|
openstack_volume_support: <true/false>
|
|
138
138
|
security_group: ['default']
|
|
139
139
|
preserve_hosts: <always/onfail/onpass/never>
|
|
140
|
+
create_in_parallel: true
|
|
140
141
|
run_in_parallel: ['configure', 'install']
|
|
141
142
|
type: <foss/git/pe>
|
|
142
143
|
```
|
|
@@ -154,6 +155,11 @@ Further, you can opt to use a static master by setting the master's hypervisor t
|
|
|
154
155
|
ip: <master_ip>
|
|
155
156
|
```
|
|
156
157
|
|
|
158
|
+
Additionally, you can set instance creation to occur in parallel instead of sequentially via this CONFIG entry:
|
|
159
|
+
```yaml
|
|
160
|
+
create_in_parallel: true
|
|
161
|
+
```
|
|
162
|
+
|
|
157
163
|
Additional parameter information is available at https://github.com/voxpupuli/beaker/blob/master/docs/concepts/argument_processing_and_precedence.md
|
|
158
164
|
|
|
159
165
|
There is a simple rake task to invoke acceptance test for the library once the two environment variables are set:
|
data/Rakefile
CHANGED
|
@@ -169,13 +169,14 @@ end
|
|
|
169
169
|
begin
|
|
170
170
|
require 'rubygems'
|
|
171
171
|
require 'github_changelog_generator/task'
|
|
172
|
-
|
|
172
|
+
rescue LoadError
|
|
173
|
+
# github_changelog_generator is an optional group
|
|
174
|
+
else
|
|
173
175
|
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
|
174
176
|
config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file."
|
|
175
|
-
config.exclude_labels = %w
|
|
177
|
+
config.exclude_labels = %w[duplicate question invalid wontfix wont-fix skip-changelog github_actions]
|
|
176
178
|
config.user = 'voxpupuli'
|
|
177
179
|
config.project = 'beaker-openstack'
|
|
178
180
|
config.future_release = Gem::Specification.load("#{config.project}.gemspec").version
|
|
179
181
|
end
|
|
180
|
-
rescue LoadError
|
|
181
182
|
end
|
data/beaker-openstack.gemspec
CHANGED
|
@@ -10,17 +10,20 @@ Gem::Specification.new do |s|
|
|
|
10
10
|
s.homepage = 'https://github.com/voxpupuli/beaker-openstack'
|
|
11
11
|
s.summary = %q{Beaker DSL Extension Helpers!}
|
|
12
12
|
s.description = %q{For use for the Beaker acceptance testing tool}
|
|
13
|
-
s.license = '
|
|
13
|
+
s.license = 'Apache-2.0'
|
|
14
14
|
|
|
15
15
|
s.files = `git ls-files`.split("\n")
|
|
16
16
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
17
17
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
18
18
|
s.require_paths = ["lib"]
|
|
19
19
|
|
|
20
|
+
# Ruby compatibility
|
|
21
|
+
s.required_ruby_version = '>= 2.7', '< 5'
|
|
22
|
+
|
|
20
23
|
# Testing dependencies
|
|
21
24
|
s.add_development_dependency 'rspec', '~> 3.0'
|
|
22
25
|
s.add_development_dependency 'rspec-its'
|
|
23
|
-
s.add_development_dependency 'fakefs', '
|
|
26
|
+
s.add_development_dependency 'fakefs', '>= 2.4', '< 4'
|
|
24
27
|
s.add_development_dependency 'rake', '>= 12.3.3'
|
|
25
28
|
s.add_development_dependency 'simplecov'
|
|
26
29
|
s.add_development_dependency 'pry', '~> 0.10'
|
|
@@ -30,9 +33,8 @@ Gem::Specification.new do |s|
|
|
|
30
33
|
s.add_development_dependency 'markdown'
|
|
31
34
|
s.add_development_dependency 'thin'
|
|
32
35
|
|
|
33
|
-
#
|
|
36
|
+
# Runtime dependencies
|
|
34
37
|
s.add_runtime_dependency 'stringify-hash', '~> 0.0.0'
|
|
35
|
-
s.add_runtime_dependency 'fog-openstack', '~> 1.0
|
|
36
|
-
|
|
38
|
+
s.add_runtime_dependency 'fog-openstack', '~> 1.0'
|
|
39
|
+
s.add_runtime_dependency 'beaker', '>= 5.6', '< 8'
|
|
37
40
|
end
|
|
38
|
-
|
|
@@ -250,86 +250,123 @@ module Beaker
|
|
|
250
250
|
ip
|
|
251
251
|
end
|
|
252
252
|
|
|
253
|
-
#Create new instances in OpenStack
|
|
253
|
+
# Create new instances in OpenStack, depending on if create_in_parallel is true or not
|
|
254
254
|
def provision
|
|
255
|
-
@
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
create_or_associate_keypair(host, hostname)
|
|
268
|
-
@logger.debug "Provisioning #{host.name} (#{host[:vmhostname]})"
|
|
269
|
-
options = {
|
|
270
|
-
:flavor_ref => flavor(host[:flavor]).id,
|
|
271
|
-
:image_ref => image(host[:image]).id,
|
|
272
|
-
:nics => [ {'net_id' => network(@options[:openstack_network]).id } ],
|
|
273
|
-
:name => host[:vmhostname],
|
|
274
|
-
:hostname => host[:vmhostname],
|
|
275
|
-
:user_data => host[:user_data] || "#cloud-config\nmanage_etc_hosts: true\n",
|
|
276
|
-
:key_name => host[:keyname],
|
|
277
|
-
}
|
|
278
|
-
options[:security_groups] = security_groups(@options[:security_group]) unless @options[:security_group].nil?
|
|
279
|
-
vm = @compute_client.servers.create(options)
|
|
280
|
-
|
|
281
|
-
#wait for the new instance to start up
|
|
282
|
-
try = 1
|
|
283
|
-
attempts = @options[:timeout].to_i / SLEEPWAIT
|
|
284
|
-
|
|
285
|
-
while try <= attempts
|
|
286
|
-
begin
|
|
287
|
-
vm.wait_for(5) { ready? }
|
|
288
|
-
break
|
|
289
|
-
rescue Fog::Errors::TimeoutError => e
|
|
290
|
-
if try >= attempts
|
|
291
|
-
@logger.debug "Failed to connect to new OpenStack instance #{host.name} (#{host[:vmhostname]})"
|
|
292
|
-
raise e
|
|
293
|
-
end
|
|
294
|
-
@logger.debug "Timeout connecting to instance #{host.name} (#{host[:vmhostname]}), trying again..."
|
|
295
|
-
end
|
|
296
|
-
sleep SLEEPWAIT
|
|
297
|
-
try += 1
|
|
298
|
-
end
|
|
255
|
+
if @options[:create_in_parallel]
|
|
256
|
+
# Enable abort on exception for threads
|
|
257
|
+
Thread.abort_on_exception = true
|
|
258
|
+
@logger.notify "Provisioning OpenStack in parallel"
|
|
259
|
+
provision_parallel
|
|
260
|
+
else
|
|
261
|
+
@logger.notify "Provisioning OpenStack sequentially"
|
|
262
|
+
provision_sequential
|
|
263
|
+
end
|
|
264
|
+
hack_etc_hosts @hosts, @options
|
|
265
|
+
end
|
|
299
266
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
# OpenStack UI
|
|
307
|
-
host[:ip] = vm.addresses.first[1][0]["addr"]
|
|
267
|
+
# Parallel creation wrapper
|
|
268
|
+
def provision_parallel
|
|
269
|
+
# Array to store threads
|
|
270
|
+
threads = @hosts.map do |host|
|
|
271
|
+
Thread.new do
|
|
272
|
+
create_instance_resources(host)
|
|
308
273
|
end
|
|
274
|
+
end
|
|
275
|
+
# Wait for all threads to finish
|
|
276
|
+
threads.each(&:join)
|
|
277
|
+
end
|
|
309
278
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
@vms << vm
|
|
317
|
-
|
|
318
|
-
# Wait for the host to accept ssh logins
|
|
319
|
-
host.wait_for_port(22)
|
|
279
|
+
# Sequential creation wrapper
|
|
280
|
+
def provision_sequential
|
|
281
|
+
@hosts.each do |host|
|
|
282
|
+
create_instance_resources(host)
|
|
283
|
+
end
|
|
284
|
+
end
|
|
320
285
|
|
|
321
|
-
|
|
322
|
-
|
|
286
|
+
# Create the actual instance resources
|
|
287
|
+
def create_instance_resources(host)
|
|
288
|
+
@logger.notify "Provisioning OpenStack"
|
|
289
|
+
if @options[:openstack_floating_ip]
|
|
290
|
+
ip = get_floating_ip
|
|
291
|
+
hostname = ip.ip.gsub('.', '-')
|
|
292
|
+
host[:vmhostname] = hostname + '.rfc1918.puppetlabs.net'
|
|
293
|
+
else
|
|
294
|
+
hostname = ('a'..'z').to_a.shuffle[0, 10].join
|
|
295
|
+
host[:vmhostname] = hostname
|
|
296
|
+
end
|
|
323
297
|
|
|
324
|
-
|
|
325
|
-
|
|
298
|
+
create_or_associate_keypair(host, hostname)
|
|
299
|
+
@logger.debug "Provisioning #{host.name} (#{host[:vmhostname]})"
|
|
300
|
+
options = {
|
|
301
|
+
:flavor_ref => flavor(host[:flavor]).id,
|
|
302
|
+
:image_ref => image(host[:image]).id,
|
|
303
|
+
:nics => [{'net_id' => network(@options[:openstack_network]).id}],
|
|
304
|
+
:name => host[:vmhostname],
|
|
305
|
+
:hostname => host[:vmhostname],
|
|
306
|
+
:user_data => host[:user_data] || "#cloud-config\nmanage_etc_hosts: true\n",
|
|
307
|
+
:key_name => host[:keyname],
|
|
308
|
+
}
|
|
309
|
+
options[:security_groups] = security_groups(@options[:security_group]) unless @options[:security_group].nil?
|
|
310
|
+
vm = @compute_client.servers.create(options)
|
|
311
|
+
|
|
312
|
+
# Wait for the new instance to start up
|
|
313
|
+
try = 1
|
|
314
|
+
attempts = @options[:timeout].to_i / SLEEPWAIT
|
|
315
|
+
|
|
316
|
+
while try <= attempts
|
|
317
|
+
begin
|
|
318
|
+
vm.wait_for(5) { ready? }
|
|
319
|
+
break
|
|
320
|
+
rescue Fog::Errors::TimeoutError => e
|
|
321
|
+
if try >= attempts
|
|
322
|
+
@logger.debug "Failed to connect to new OpenStack instance #{host.name} (#{host[:vmhostname]})"
|
|
323
|
+
raise e
|
|
324
|
+
end
|
|
325
|
+
@logger.debug "Timeout connecting to instance #{host.name} (#{host[:vmhostname]}), trying again..."
|
|
326
|
+
end
|
|
327
|
+
sleep SLEEPWAIT
|
|
328
|
+
try += 1
|
|
326
329
|
end
|
|
327
330
|
|
|
328
|
-
|
|
331
|
+
if @options[:openstack_floating_ip]
|
|
332
|
+
# Associate a public IP to the VM
|
|
333
|
+
ip.server = vm
|
|
334
|
+
host[:ip] = ip.ip
|
|
335
|
+
else
|
|
336
|
+
# Get the first address of the VM that was just created just like in the
|
|
337
|
+
# OpenStack UI
|
|
338
|
+
host[:ip] = vm.addresses.first[1][0]["addr"]
|
|
339
|
+
end
|
|
329
340
|
|
|
341
|
+
@logger.debug "OpenStack host #{host.name} (#{host[:vmhostname]}) assigned ip: #{host[:ip]}"
|
|
342
|
+
|
|
343
|
+
# Set metadata
|
|
344
|
+
vm.metadata.update({:jenkins_build_url => @options[:jenkins_build_url].to_s,
|
|
345
|
+
:department => @options[:department].to_s,
|
|
346
|
+
:project => @options[:project].to_s })
|
|
347
|
+
@vms << vm
|
|
348
|
+
|
|
349
|
+
# Wait for the host to accept SSH logins
|
|
350
|
+
host.wait_for_port(22)
|
|
351
|
+
|
|
352
|
+
# Enable root if the user is not root
|
|
353
|
+
enable_root(host)
|
|
354
|
+
|
|
355
|
+
provision_storage(host, vm) if @options[:openstack_volume_support]
|
|
356
|
+
@logger.notify "OpenStack Volume Support Disabled, can't provision volumes" if not @options[:openstack_volume_support]
|
|
357
|
+
|
|
358
|
+
# Handle exceptions in the thread
|
|
359
|
+
rescue => e
|
|
360
|
+
@logger.error "Thread #{host} failed with error: #{e.message}"
|
|
361
|
+
# Call cleanup function to delete orphaned hosts
|
|
362
|
+
cleanup
|
|
363
|
+
# Pass the error to the main thread to terminate all threads
|
|
364
|
+
Thread.main.raise(e)
|
|
365
|
+
# Terminate the current thread (to prevent hack_etc_hosts trying to run after error raised)
|
|
366
|
+
Thread.kill(Thread.current)
|
|
330
367
|
end
|
|
331
368
|
|
|
332
|
-
#Destroy any OpenStack instances
|
|
369
|
+
# Destroy any OpenStack instances
|
|
333
370
|
def cleanup
|
|
334
371
|
@logger.notify "Cleaning up OpenStack"
|
|
335
372
|
@vms.each do |vm|
|
|
@@ -361,7 +398,7 @@ module Beaker
|
|
|
361
398
|
end
|
|
362
399
|
end
|
|
363
400
|
|
|
364
|
-
#
|
|
401
|
+
# Enable root on a single host (the current one presumably) but only
|
|
365
402
|
# if the username isn't 'root'
|
|
366
403
|
def enable_root(host)
|
|
367
404
|
if host['user'] != 'root'
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: beaker-openstack
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0
|
|
4
|
+
version: 2.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Vox Pupuli
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: rspec
|
|
@@ -42,16 +41,22 @@ dependencies:
|
|
|
42
41
|
name: fakefs
|
|
43
42
|
requirement: !ruby/object:Gem::Requirement
|
|
44
43
|
requirements:
|
|
45
|
-
- - "
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '2.4'
|
|
47
|
+
- - "<"
|
|
46
48
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
49
|
+
version: '4'
|
|
48
50
|
type: :development
|
|
49
51
|
prerelease: false
|
|
50
52
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
53
|
requirements:
|
|
52
|
-
- - "
|
|
54
|
+
- - ">="
|
|
55
|
+
- !ruby/object:Gem::Version
|
|
56
|
+
version: '2.4'
|
|
57
|
+
- - "<"
|
|
53
58
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
59
|
+
version: '4'
|
|
55
60
|
- !ruby/object:Gem::Dependency
|
|
56
61
|
name: rake
|
|
57
62
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -156,14 +161,34 @@ dependencies:
|
|
|
156
161
|
requirements:
|
|
157
162
|
- - "~>"
|
|
158
163
|
- !ruby/object:Gem::Version
|
|
159
|
-
version: 1.0
|
|
164
|
+
version: '1.0'
|
|
160
165
|
type: :runtime
|
|
161
166
|
prerelease: false
|
|
162
167
|
version_requirements: !ruby/object:Gem::Requirement
|
|
163
168
|
requirements:
|
|
164
169
|
- - "~>"
|
|
165
170
|
- !ruby/object:Gem::Version
|
|
166
|
-
version: 1.0
|
|
171
|
+
version: '1.0'
|
|
172
|
+
- !ruby/object:Gem::Dependency
|
|
173
|
+
name: beaker
|
|
174
|
+
requirement: !ruby/object:Gem::Requirement
|
|
175
|
+
requirements:
|
|
176
|
+
- - ">="
|
|
177
|
+
- !ruby/object:Gem::Version
|
|
178
|
+
version: '5.6'
|
|
179
|
+
- - "<"
|
|
180
|
+
- !ruby/object:Gem::Version
|
|
181
|
+
version: '8'
|
|
182
|
+
type: :runtime
|
|
183
|
+
prerelease: false
|
|
184
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
185
|
+
requirements:
|
|
186
|
+
- - ">="
|
|
187
|
+
- !ruby/object:Gem::Version
|
|
188
|
+
version: '5.6'
|
|
189
|
+
- - "<"
|
|
190
|
+
- !ruby/object:Gem::Version
|
|
191
|
+
version: '8'
|
|
167
192
|
description: For use for the Beaker acceptance testing tool
|
|
168
193
|
email: voxpupuli@groups.io
|
|
169
194
|
executables:
|
|
@@ -172,6 +197,7 @@ extensions: []
|
|
|
172
197
|
extra_rdoc_files: []
|
|
173
198
|
files:
|
|
174
199
|
- ".github/dependabot.yml"
|
|
200
|
+
- ".github/release.yml"
|
|
175
201
|
- ".github/workflows/release.yml"
|
|
176
202
|
- ".github/workflows/test.yml"
|
|
177
203
|
- ".gitignore"
|
|
@@ -190,9 +216,8 @@ files:
|
|
|
190
216
|
- spec/spec_helper.rb
|
|
191
217
|
homepage: https://github.com/voxpupuli/beaker-openstack
|
|
192
218
|
licenses:
|
|
193
|
-
-
|
|
219
|
+
- Apache-2.0
|
|
194
220
|
metadata: {}
|
|
195
|
-
post_install_message:
|
|
196
221
|
rdoc_options: []
|
|
197
222
|
require_paths:
|
|
198
223
|
- lib
|
|
@@ -200,15 +225,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
200
225
|
requirements:
|
|
201
226
|
- - ">="
|
|
202
227
|
- !ruby/object:Gem::Version
|
|
203
|
-
version: '
|
|
228
|
+
version: '2.7'
|
|
229
|
+
- - "<"
|
|
230
|
+
- !ruby/object:Gem::Version
|
|
231
|
+
version: '5'
|
|
204
232
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
205
233
|
requirements:
|
|
206
234
|
- - ">="
|
|
207
235
|
- !ruby/object:Gem::Version
|
|
208
236
|
version: '0'
|
|
209
237
|
requirements: []
|
|
210
|
-
rubygems_version:
|
|
211
|
-
signing_key:
|
|
238
|
+
rubygems_version: 4.0.3
|
|
212
239
|
specification_version: 4
|
|
213
240
|
summary: Beaker DSL Extension Helpers!
|
|
214
241
|
test_files: []
|