beaker-abs 0.1.3 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YzRmYjY5ODQ2NzcyZDRlMjcxN2YyNDM4ZjA4OGQ2Y2ExZjA0OGNlOA==
5
- data.tar.gz: !binary |-
6
- YmE2YjQxZjkwMDZjZWMwZWJhY2VlZTYwN2FmZDZjNTZkMTlhNzBhNg==
2
+ SHA256:
3
+ metadata.gz: 0d6faecffc36e445ec8fecf9fd7a92a4ffbcb6fb41ef755bff6a42438a71df44
4
+ data.tar.gz: 6d46f12b1100a9911850f955e3c3c55100e48b4ab03c01d36cb6466ca862b1c4
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- MWU3YWQxZWQwZjgwOGRiOTlhMjcyMTk5ZWYzYTUzODA2NzA1OTgyODU5ZmJh
10
- ZjRjZmY5ZDk4MzdhOThjNjg5ZDc1Mjc2ZTgwMTI0Y2Q2OWI0ZDAxNmIxNGYx
11
- Zjg5MTM0OWI5ODg0NzA1MjJjZGE0ZTE0NmY4Y2Y1NzhlYjc3NzU=
12
- data.tar.gz: !binary |-
13
- NTEyMjJmNDI1ZTI2MmY1NDJiY2Q5YzRkNTM3NTJlNTkwNGVmZDNlMjY2NWQ1
14
- Y2M3NGQzMjgxNmQ3ZTJmZmViZGM2YTVkNjE1NmEzOTdmMGUxYjc4MDdiYjdl
15
- YWFiMTVmNTc1NDM3ODM4OWUyY2Q4MDBkMmRiNzQ5ODZiYmJhNzA=
6
+ metadata.gz: bd6bf6f23b7faed7d1da6d92d1fd718239bb8b5d186b6f7e2c3eeeeb121dc1e63db0a540e180099fca2c85f880479e368933871f75c068dbdb43e8011b1bdfa3
7
+ data.tar.gz: f168b9d3adcaf60c0daee56d356e772e0aeccd790379730dba7a99c6e2ec511ebf614bf953a6b5d3a0e6c22c063f4bb337ebd2cf11225829f5a391b67941b5d4
@@ -0,0 +1,8 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ time: "13:00"
8
+ open-pull-requests-limit: 10
@@ -1,5 +1,6 @@
1
- sudo: false
2
1
  language: ruby
3
2
  rvm:
4
- - 2.1.8
5
- before_install: gem install bundler -v 1.12.3
3
+ - 2.6
4
+ before_install:
5
+ - gem install bundler
6
+
@@ -0,0 +1 @@
1
+ * @puppetlabs/beaker
data/HISTORY.md CHANGED
@@ -1,11 +1,67 @@
1
1
  # qe_beaker-abs_bump_and_tag_master - History
2
2
  ## Tags
3
- * [LATEST - 16 Sep, 2016 (3d6ed7b7)](#LATEST)
3
+ * [LATEST - 14 Aug, 2017 (26840bd3)](#LATEST)
4
+ * [0.2.0 - 24 Oct, 2016 (44ff3935)](#0.2.0)
5
+ * [0.1.3 - 16 Sep, 2016 (6f1ced08)](#0.1.3)
4
6
  * [0.1.2 - 16 Sep, 2016 (b914ae60)](#0.1.2)
5
7
  * [0.1.1 - 16 Sep, 2016 (10ee39cf)](#0.1.1)
6
8
 
7
9
  ## Details
8
- ### <a name = "LATEST">LATEST - 16 Sep, 2016 (3d6ed7b7)
10
+ ### <a name = "LATEST">LATEST - 14 Aug, 2017 (26840bd3)
11
+
12
+ * (GEM) update beaker-abs version to 0.3.0 (26840bd3)
13
+
14
+ * Merge pull request #9 from rishijavia/BKR-1155-third_attempt (859cb1ec)
15
+
16
+
17
+ ```
18
+ Merge pull request #9 from rishijavia/BKR-1155-third_attempt
19
+
20
+ (BKR-1155) Override beaker's default ssh connection preference
21
+ ```
22
+ * (BKR-1155) Override beaker's default ssh connection preference (8bab8a1c)
23
+
24
+ ### <a name = "0.2.0">0.2.0 - 24 Oct, 2016 (44ff3935)
25
+
26
+ * (HISTORY) update beaker-abs history for gem release 0.2.0 (44ff3935)
27
+
28
+ * (GEM) update beaker-abs version to 0.2.0 (4c14d730)
29
+
30
+ * Merge pull request #5 from puppetlabs/beaker3-conflict (54001ff7)
31
+
32
+
33
+ ```
34
+ Merge pull request #5 from puppetlabs/beaker3-conflict
35
+
36
+ (QENG-4472) Relax version constraints
37
+ ```
38
+ * (QENG-4472) Relax version constraints (574d1d95)
39
+
40
+
41
+ ```
42
+ (QENG-4472) Relax version constraints
43
+
44
+ Previously, we were pessimistically pinned to beaker 2.x, which meant
45
+ projects could not use both beaker 3 and beaker-abs simultaneously.
46
+
47
+ Beaker-abs only requires a version of beaker supporting the custom
48
+ hypervisor API. Due to a beaker bug, custom hypervisors did not work
49
+ until beaker 2.9.0 in commit d45e723cd. We also require less than beaker
50
+ 4 to prevent future incompatibilities.
51
+ ```
52
+ * (MAINT) Update Development notes on releasing (80972ba9)
53
+
54
+ * Merge pull request #4 from puppetlabs/update-dev-section-in-readme (9f4acbe1)
55
+
56
+
57
+ ```
58
+ Merge pull request #4 from puppetlabs/update-dev-section-in-readme
59
+
60
+ (MAINT) Update Development notes on releasing
61
+ ```
62
+ ### <a name = "0.1.3">0.1.3 - 16 Sep, 2016 (6f1ced08)
63
+
64
+ * (HISTORY) update beaker-abs history for gem release 0.1.3 (6f1ced08)
9
65
 
10
66
  * (GEM) update beaker-abs version to 0.1.3 (3d6ed7b7)
11
67
 
data/README.md CHANGED
@@ -1,22 +1,21 @@
1
- # BeakerAbs
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
- Add this line to your application's Gemfile:
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
- ```ruby
10
- gem 'beaker-abs'
11
- ```
12
-
13
- And then execute:
14
-
15
- $ bundle
16
-
17
- Or install it yourself as:
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.
18
10
 
19
- $ gem install beaker-abs
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,12 +41,28 @@ 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
 
48
56
  After checking out the repo, run `bundle install --path .bundle` to install dependencies. Then, run `bundle exec rake test` to run the tests.
49
57
 
50
- To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
58
+ To release a new version, run the [release pipeline](https://jenkins-qe.delivery.puppetlabs.net/job/qe_beaker-abs_init-multijob_master/)
59
+ (infrastructure access is required) and provide the following parameters:
60
+
61
+ - PUBLIC: Whether to release the gem to rubygems.org
62
+ - version: Desired version to release
63
+
64
+ The pipeline will update the version number in `version.rb`, create a git tag for the version, push git commits and tags to
65
+ GitHub, and optionally push the `.gem` file to [rubygems.org](https://rubygems.org).
51
66
 
52
67
  ## Contributing
53
68
 
@@ -18,9 +18,10 @@ 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.add_development_dependency "bundler", "~> 1.12"
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
 
25
- spec.add_runtime_dependency "beaker", "~> 2.49"
26
27
  end
@@ -1,5 +1,5 @@
1
1
  module BeakerAbs
2
2
  module Version
3
- STRING = '0.1.3'
3
+ STRING = '0.6.0'
4
4
  end
5
5
  end
@@ -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,23 +13,53 @@ module Beaker
9
13
  @hosts = hosts
10
14
 
11
15
  resource_hosts = ENV['ABS_RESOURCE_HOSTS'] || @options[:abs_resource_hosts]
12
- raise ArgumentError.new("ABS_RESOURCE_HOSTS must be specified when using the Beaker::Abs hypervisor") if resource_hosts.nil?
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
 
25
+ def connection_preference(host)
26
+ vmhostname = host[:vmhostname]
27
+ if vmhostname && host[:hypervisor] == 'abs'
28
+ @resource_hosts.each do |resource_host|
29
+ if resource_host['hostname'] == vmhostname
30
+ engine = resource_host['engine']
31
+ case engine
32
+ when /^(vmpooler|nspooler)$/
33
+ # putting ip last as its not set by ABS
34
+ return [:vmhostname, :hostname, :ip]
35
+ else
36
+ super
37
+ end
38
+ end
39
+ end
40
+ end
41
+ super
42
+ end
43
+
16
44
  def provision
17
45
  type2hosts = {}
18
46
 
19
47
  # Each resource_host is of the form:
20
48
  # {
21
- # "hostname" => "1234567890",
49
+ # "hostname" => "mkbx0m6dnnntgz1.delivery.puppetlabs.net",
22
50
  # "type" => "centos-7-i386",
23
51
  # "engine" => "vmpooler",
24
52
  # }
53
+ # {
54
+ # "hostname" => "sol10-1.delivery.puppetlabs.net",
55
+ # "type" => "solaris-10-sparc",
56
+ # "engine" => "nspooler",
57
+ # }
25
58
  @resource_hosts.each do |resource_host|
26
59
  type = resource_host['type']
27
60
  type2hosts[type] ||= []
28
61
  type2hosts[type] << resource_host['hostname']
62
+ type2hosts[type] << resource_host['ip']
29
63
  end
30
64
 
31
65
  # for each host, get a vm for that template type
@@ -36,14 +70,91 @@ module Beaker
36
70
 
37
71
  if provisioned_hosts = type2hosts[template]
38
72
  host['vmhostname'] = provisioned_hosts.shift
73
+ host['ip'] = provisioned_hosts.shift
39
74
  else
40
75
  raise ArgumentError.new("Failed to provision host '#{host.hostname}', no template of type '#{host['template']}' was provided.")
41
76
  end
42
77
  end
78
+ if Beaker::Hypervisor.respond_to?(:set_ssh_connection_preference)
79
+ Beaker::Hypervisor.set_ssh_connection_preference(@hosts, self)
80
+ end
43
81
  end
44
82
 
45
83
  def cleanup
46
84
  # nothing to do
47
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
48
159
  end
49
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.1.3
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Cooper
@@ -9,64 +9,78 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-09-16 00:00:00.000000000 Z
12
+ date: 2020-10-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: bundler
15
+ name: beaker
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '1.12'
21
- type: :development
20
+ version: '4.0'
21
+ type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '1.12'
27
+ version: '4.0'
28
28
  - !ruby/object:Gem::Dependency
29
- name: rake
29
+ name: vmfloaty
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ~>
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '10.0'
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
42
+ - !ruby/object:Gem::Dependency
43
+ name: bundler
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '2.1'
35
49
  type: :development
36
50
  prerelease: false
37
51
  version_requirements: !ruby/object:Gem::Requirement
38
52
  requirements:
39
- - - ~>
53
+ - - "~>"
40
54
  - !ruby/object:Gem::Version
41
- version: '10.0'
55
+ version: '2.1'
42
56
  - !ruby/object:Gem::Dependency
43
- name: minitest
57
+ name: rake
44
58
  requirement: !ruby/object:Gem::Requirement
45
59
  requirements:
46
- - - ~>
60
+ - - "~>"
47
61
  - !ruby/object:Gem::Version
48
- version: '5.0'
62
+ version: '10.0'
49
63
  type: :development
50
64
  prerelease: false
51
65
  version_requirements: !ruby/object:Gem::Requirement
52
66
  requirements:
53
- - - ~>
67
+ - - "~>"
54
68
  - !ruby/object:Gem::Version
55
- version: '5.0'
69
+ version: '10.0'
56
70
  - !ruby/object:Gem::Dependency
57
- name: beaker
71
+ name: minitest
58
72
  requirement: !ruby/object:Gem::Requirement
59
73
  requirements:
60
- - - ~>
74
+ - - "~>"
61
75
  - !ruby/object:Gem::Version
62
- version: '2.49'
63
- type: :runtime
76
+ version: '5.0'
77
+ type: :development
64
78
  prerelease: false
65
79
  version_requirements: !ruby/object:Gem::Requirement
66
80
  requirements:
67
- - - ~>
81
+ - - "~>"
68
82
  - !ruby/object:Gem::Version
69
- version: '2.49'
83
+ version: '5.0'
70
84
  description: Adds a custom hypervisor that uses hosts provisioned by the Always Be
71
85
  Scheduling service.
72
86
  email:
@@ -76,12 +90,13 @@ executables: []
76
90
  extensions: []
77
91
  extra_rdoc_files: []
78
92
  files:
79
- - .gitignore
80
- - .travis.yml
93
+ - ".github/dependabot.yml"
94
+ - ".gitignore"
95
+ - ".travis.yml"
96
+ - CODEOWNERS
81
97
  - Gemfile
82
98
  - HISTORY.md
83
99
  - LICENSE.txt
84
- - MAINTAINERS
85
100
  - README.md
86
101
  - Rakefile
87
102
  - beaker-abs.gemspec
@@ -98,17 +113,16 @@ require_paths:
98
113
  - lib
99
114
  required_ruby_version: !ruby/object:Gem::Requirement
100
115
  requirements:
101
- - - ! '>='
116
+ - - ">="
102
117
  - !ruby/object:Gem::Version
103
118
  version: '0'
104
119
  required_rubygems_version: !ruby/object:Gem::Requirement
105
120
  requirements:
106
- - - ! '>='
121
+ - - ">="
107
122
  - !ruby/object:Gem::Version
108
123
  version: '0'
109
124
  requirements: []
110
- rubyforge_project:
111
- rubygems_version: 2.4.6
125
+ rubygems_version: 3.0.8
112
126
  signing_key:
113
127
  specification_version: 4
114
128
  summary: Let's test Puppet, using hosts provisioned by Always Be Scheduling service.
@@ -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
- }