beaker-abs 0.5.0 → 0.6.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/.travis.yml +4 -3
- data/CODEOWNERS +1 -0
- data/README.md +20 -12
- data/beaker-abs.gemspec +3 -1
- data/lib/beaker-abs/version.rb +1 -1
- data/lib/beaker/hypervisor/abs.rb +83 -1
- metadata +35 -7
- data/MAINTAINERS +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0d6faecffc36e445ec8fecf9fd7a92a4ffbcb6fb41ef755bff6a42438a71df44
|
4
|
+
data.tar.gz: 6d46f12b1100a9911850f955e3c3c55100e48b4ab03c01d36cb6466ca862b1c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd6bf6f23b7faed7d1da6d92d1fd718239bb8b5d186b6f7e2c3eeeeb121dc1e63db0a540e180099fca2c85f880479e368933871f75c068dbdb43e8011b1bdfa3
|
7
|
+
data.tar.gz: f168b9d3adcaf60c0daee56d356e772e0aeccd790379730dba7a99c6e2ec511ebf614bf953a6b5d3a0e6c22c063f4bb337ebd2cf11225829f5a391b67941b5d4
|
data/.travis.yml
CHANGED
data/CODEOWNERS
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* @puppetlabs/beaker
|
data/README.md
CHANGED
@@ -1,22 +1,21 @@
|
|
1
|
-
#
|
1
|
+
# beaker-abs
|
2
2
|
|
3
3
|
Implements a Beaker hypervisor that makes hosts provisioned by the AlwaysBeScheduling service available to a Beaker run.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
|
7
|
+
Beaker will automatically load the appropriate hypervisors for any given hosts file, so as long as your project dependencies are satisfied there's nothing else to do. No need to `require` this library in your tests.
|
8
8
|
|
9
|
-
|
10
|
-
gem 'beaker-abs'
|
11
|
-
```
|
12
|
-
|
13
|
-
And then execute:
|
14
|
-
|
15
|
-
$ bundle
|
9
|
+
As of Beaker 4.0, all hypervisor and DSL extension libraries have been removed and are no longer dependencies. In order to use a specific hypervisor or DSL extension library in your project, you will need to include them alongside Beaker in your Gemfile or project.gemspec. E.g.
|
16
10
|
|
17
|
-
|
18
|
-
|
19
|
-
|
11
|
+
~~~ruby
|
12
|
+
# Gemfile
|
13
|
+
gem 'beaker', '~>4.0'
|
14
|
+
gem 'beaker-abs'
|
15
|
+
# project.gemspec
|
16
|
+
s.add_runtime_dependency 'beaker', '~>4.0'
|
17
|
+
s.add_runtime_dependency 'beaker-abs'
|
18
|
+
~~~
|
20
19
|
|
21
20
|
## Usage
|
22
21
|
|
@@ -42,6 +41,15 @@ env ABS_RESOURCE_HOSTS=<data> beaker --hosts hosts.yaml
|
|
42
41
|
```
|
43
42
|
|
44
43
|
Beaker will populate the `vmhostname` property for each host using information provided by the AlwaysBeScheduling service.
|
44
|
+
This is typically used in a CI scenario, where the jenkins run-me-maybe plugin is populating the ABS_RESOURCE_HOSTS variable.
|
45
|
+
|
46
|
+
### Using vmfloaty
|
47
|
+
|
48
|
+
If you do not specify a ABS_RESOURCE_HOSTS and request to provision via the beaker options, beaker-abs will fallback to using
|
49
|
+
your vmfloaty configuration. By default it will look for the service named 'abs'. The name can also be configured via
|
50
|
+
the environment variable ABS_SERVICE_NAME or the top level option in the hosts file abs_service_name. Similarly, the priority defaults to "1" which means
|
51
|
+
it will take precedence over CI tests. Be careful not to run a CI test with this option. The priority can be configured via
|
52
|
+
the environment variable ABS_SERVICE_PRIORITY or the top level option in the hosts file abs_service_priority.
|
45
53
|
|
46
54
|
## Development
|
47
55
|
|
data/beaker-abs.gemspec
CHANGED
@@ -18,7 +18,9 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.
|
21
|
+
spec.add_dependency "beaker", "~> 4.0"
|
22
|
+
spec.add_dependency "vmfloaty", "~> 1.0.0"
|
23
|
+
spec.add_development_dependency "bundler", "~> 2.1"
|
22
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
23
25
|
spec.add_development_dependency "minitest", "~> 5.0"
|
24
26
|
|
data/lib/beaker-abs/version.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
require 'beaker'
|
2
2
|
require 'json'
|
3
|
+
require 'pry-byebug'
|
4
|
+
require 'vmfloaty'
|
5
|
+
require 'vmfloaty/conf'
|
6
|
+
require 'vmfloaty/utils'
|
3
7
|
|
4
8
|
module Beaker
|
5
9
|
class Abs < Beaker::Hypervisor
|
@@ -9,7 +13,12 @@ module Beaker
|
|
9
13
|
@hosts = hosts
|
10
14
|
|
11
15
|
resource_hosts = ENV['ABS_RESOURCE_HOSTS'] || @options[:abs_resource_hosts]
|
12
|
-
|
16
|
+
|
17
|
+
@abs_service_name = ENV['ABS_SERVICE_NAME'] || @options[:abs_service_name] || "abs"
|
18
|
+
@abs_service_priority = ENV['ABS_SERVICE_PRIORITY'] || @options[:abs_service_priority] || "1"
|
19
|
+
|
20
|
+
raise ArgumentError.new("ABS_RESOURCE_HOSTS must be specified when using the Beaker::Abs hypervisor when provisioning") if resource_hosts.nil? && !options[:provision]
|
21
|
+
resource_hosts = provision_vms(hosts).to_json if resource_hosts.nil?
|
13
22
|
@resource_hosts = JSON.parse(resource_hosts)
|
14
23
|
end
|
15
24
|
|
@@ -74,5 +83,78 @@ module Beaker
|
|
74
83
|
def cleanup
|
75
84
|
# nothing to do
|
76
85
|
end
|
86
|
+
|
87
|
+
def provision_vms(hosts)
|
88
|
+
|
89
|
+
verbose = false
|
90
|
+
config = Conf.read_config # get the vmfloaty config file in home dir
|
91
|
+
|
92
|
+
# TODO: the options object provided by the floaty cli is required in get_service_config()
|
93
|
+
# we should make it optional or accept nil
|
94
|
+
cli = Object.new
|
95
|
+
def cli.service() @abs_service_name end
|
96
|
+
def cli.priority() @abs_service_priority end # forces going ahead of queue
|
97
|
+
def cli.url() nil end
|
98
|
+
def cli.token() nil end
|
99
|
+
def cli.user() nil end
|
100
|
+
|
101
|
+
#the service object is the interfacte to all methods
|
102
|
+
abs_service = Service.new(cli, config)
|
103
|
+
supported_vm_list = abs_service.list(verbose)
|
104
|
+
supported_vm_list = supported_vm_list.reject { |e| e.empty? }
|
105
|
+
supported_vm_list = supported_vm_list.reject { |e| e.start_with?("*") }
|
106
|
+
|
107
|
+
vm_request = generate_floaty_request_strings(hosts, supported_vm_list)
|
108
|
+
|
109
|
+
|
110
|
+
vm_beaker_abs = []
|
111
|
+
# Will return a JSON Object like this:
|
112
|
+
# {"redhat-7-x86_64"=>["rich-apparition.delivery.puppetlabs.net", "despondent-side.delivery.puppetlabs.net"], "centos-7-x86_64"=>["firmer-vamp.delivery.puppetlabs.net"]}
|
113
|
+
os_types = Utils.generate_os_hash(vm_request.split)
|
114
|
+
vm_floaty_output = abs_service.retrieve(verbose, os_types)
|
115
|
+
|
116
|
+
|
117
|
+
raise ArgumentError.new("Timed out getting the ABS resources") if vm_floaty_output.nil?
|
118
|
+
vm_floaty_output_cleaned = Utils.standardize_hostnames(vm_floaty_output)
|
119
|
+
vm_floaty_output_cleaned.each do |os_platform, value|
|
120
|
+
# filter any extra key that does not have an Array value
|
121
|
+
if !value.is_a?(Array)
|
122
|
+
next
|
123
|
+
end
|
124
|
+
value.each do | hostname |
|
125
|
+
# I don't think the engine is being used by the beaker-abs process
|
126
|
+
vm_beaker_abs.push({"hostname": hostname, "type": os_platform, "engine":"beaker-abs"})
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
# to do need to figure out what the NSPooler requests are, and combine the output for that with vm_beaker_abs and return that object
|
131
|
+
# for now just returning vmpooler abs object
|
132
|
+
vm_beaker_abs
|
133
|
+
end
|
134
|
+
|
135
|
+
# Based upon the host file, this method counts the number of each template needed
|
136
|
+
# and generates the host=Xnum eg redhat-7-x86_64=2 expected by floaty
|
137
|
+
def generate_floaty_request_strings(hosts, supported_vm_list)
|
138
|
+
vm_list = {}
|
139
|
+
|
140
|
+
hosts.each do |host|
|
141
|
+
if supported_vm_list.include?(host[:template])
|
142
|
+
if vm_list.include?(host[:template])
|
143
|
+
vm_list[host[:template]] = vm_list[host[:template]] + 1
|
144
|
+
else
|
145
|
+
vm_list[host[:template]] = 1
|
146
|
+
end
|
147
|
+
else
|
148
|
+
raise ArgumentError.new("#{host.name} has a template #{host[:template]} that is not found in vmpooler or nspooler")
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
vm_request = ""
|
153
|
+
vm_list.each do |key, value|
|
154
|
+
vm_request.concat("#{key}=#{value} ")
|
155
|
+
end
|
156
|
+
|
157
|
+
vm_request
|
158
|
+
end
|
77
159
|
end
|
78
160
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beaker-abs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Cooper
|
@@ -9,22 +9,50 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-10-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: beaker
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '4.0'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '4.0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: vmfloaty
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 1.0.0
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 1.0.0
|
14
42
|
- !ruby/object:Gem::Dependency
|
15
43
|
name: bundler
|
16
44
|
requirement: !ruby/object:Gem::Requirement
|
17
45
|
requirements:
|
18
46
|
- - "~>"
|
19
47
|
- !ruby/object:Gem::Version
|
20
|
-
version: '1
|
48
|
+
version: '2.1'
|
21
49
|
type: :development
|
22
50
|
prerelease: false
|
23
51
|
version_requirements: !ruby/object:Gem::Requirement
|
24
52
|
requirements:
|
25
53
|
- - "~>"
|
26
54
|
- !ruby/object:Gem::Version
|
27
|
-
version: '1
|
55
|
+
version: '2.1'
|
28
56
|
- !ruby/object:Gem::Dependency
|
29
57
|
name: rake
|
30
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -62,12 +90,13 @@ executables: []
|
|
62
90
|
extensions: []
|
63
91
|
extra_rdoc_files: []
|
64
92
|
files:
|
93
|
+
- ".github/dependabot.yml"
|
65
94
|
- ".gitignore"
|
66
95
|
- ".travis.yml"
|
96
|
+
- CODEOWNERS
|
67
97
|
- Gemfile
|
68
98
|
- HISTORY.md
|
69
99
|
- LICENSE.txt
|
70
|
-
- MAINTAINERS
|
71
100
|
- README.md
|
72
101
|
- Rakefile
|
73
102
|
- beaker-abs.gemspec
|
@@ -93,8 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
122
|
- !ruby/object:Gem::Version
|
94
123
|
version: '0'
|
95
124
|
requirements: []
|
96
|
-
|
97
|
-
rubygems_version: 2.5.1
|
125
|
+
rubygems_version: 3.0.8
|
98
126
|
signing_key:
|
99
127
|
specification_version: 4
|
100
128
|
summary: Let's test Puppet, using hosts provisioned by Always Be Scheduling service.
|
data/MAINTAINERS
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"version": 1,
|
3
|
-
"file_format": "This MAINTAINERS file format is described at http://pup.pt/maintainers",
|
4
|
-
"issues": "https://tickets.puppetlabs.com/browse/QENG/",
|
5
|
-
"people": [
|
6
|
-
{
|
7
|
-
"github": "joshcooper",
|
8
|
-
"email": "josh@puppet.com",
|
9
|
-
"name": "Josh Cooper"
|
10
|
-
},
|
11
|
-
{
|
12
|
-
"github": "rick",
|
13
|
-
"email": "rick@puppet.com",
|
14
|
-
"name": "Rick Bradley"
|
15
|
-
}
|
16
|
-
]
|
17
|
-
}
|