Compare commits

..

No commits in common. "main" and "1.3.0" have entirely different histories.
main ... 1.3.0

11 changed files with 18 additions and 148 deletions

View file

@ -1,7 +0,0 @@
version: 2
updates:
- package-ecosystem: bundler
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10

View file

@ -1,39 +0,0 @@
name: Release
on: workflow_dispatch
jobs:
release:
runs-on: ubuntu-latest
if: github.repository == 'puppetlabs/beaker-vmpooler'
steps:
- uses: actions/checkout@v3
- name: Get Version
id: gv
run: |
version=$(grep VERSION lib/beaker-vmpooler/version.rb |rev |cut -d "'" -f2 |rev)
echo "version=$version" >> $GITHUB_OUTPUT
echo "Found version $version from lib/beaker-vmpooler/version.rb"
- name: Tag Release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.gv.outputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
prerelease: false
generateReleaseNotes: true
- name: Install Ruby 2.7
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
- name: Build gem
run: gem build *.gemspec
- name: Publish gem
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
gem push *.gem
env:
GEM_HOST_API_KEY: '${{ secrets.RUBYGEMS_AUTH_TOKEN }}'

View file

@ -1,39 +0,0 @@
name: Security
on:
workflow_dispatch:
push:
branches:
- main
jobs:
scan:
name: Mend Scanning
runs-on: ubuntu-latest
steps:
- name: checkout repo content
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
# setup a package lock if one doesn't exist, otherwise do nothing
- name: check lock
run: '[ -f "Gemfile.lock" ] && echo "package lock file exists, skipping" || bundle lock'
# install java
- uses: actions/setup-java@v3
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
# download mend
- name: download_mend
run: curl -o wss-unified-agent.jar https://unified-agent.s3.amazonaws.com/wss-unified-agent.jar
- name: run mend
run: java -jar wss-unified-agent.jar
env:
WS_APIKEY: ${{ secrets.MEND_API_KEY }}
WS_WSS_URL: https://saas-eu.whitesourcesoftware.com/agent
WS_USERKEY: ${{ secrets.MEND_TOKEN }}
WS_PRODUCTNAME: RE
WS_PROJECTNAME: ${{ github.event.repository.name }}

View file

@ -1,26 +0,0 @@
name: Testing
on:
pull_request:
branches:
- main
jobs:
spec_tests:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version:
- '2.7'
- '3.0'
- '3.1'
- '3.2'
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Run spec tests
run: bundle exec rake test

View file

@ -1,2 +0,0 @@
* @puppetlabs/release-engineering

11
Gemfile
View file

@ -1,6 +1,8 @@
source ENV['GEM_SOURCE'] || "https://rubygems.org" source ENV['GEM_SOURCE'] || "https://rubygems.org"
gemspec :development_group => :acceptance_testing gemspec
def location_for(place, fake_version = nil) def location_for(place, fake_version = nil)
if place =~ /^(git:[^#]*)#(.*)/ if place =~ /^(git:[^#]*)#(.*)/
@ -12,13 +14,14 @@ def location_for(place, fake_version = nil)
end end
end end
# We don't put beaker in as a test dependency because we # We don't put beaker in as a test dependency because we
# don't want to create a transitive dependency # don't want to create a transitive dependency
group :acceptance_testing do group :acceptance_testing do
gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '>= 5.0', '< 7') gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 3.0')
gem "beaker-abs"
end end
if File.exist? "#{__FILE__}.local"
if File.exists? "#{__FILE__}.local"
eval(File.read("#{__FILE__}.local"), binding) eval(File.read("#{__FILE__}.local"), binding)
end end

View file

@ -3,27 +3,8 @@
Beaker library to use vmpooler hypervisor Beaker library to use vmpooler hypervisor
# How to use this wizardry # How to use this wizardry
This is a gem that allows you to use hosts with [vmpooler](vmpooler.md) hypervisor with [beaker](https://github.com/puppetlabs/beaker). This is a gem that allows you to use hosts with [vmpooler](vmpooler.md) hypervisor with [beaker](https://github.com/puppetlabs/beaker). This gem is already included as [beaker dependency](https://github.com/puppetlabs/beaker/blob/master/beaker.gemspec#L59) for you, so you don't need to do anything special to use this gem's functionality with beaker.
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.
## With Beaker 3.x
This library is included as a dependency of Beaker 3.x versions, so there's nothing to do.
## With Beaker 4.x
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.
~~~ruby
# Gemfile
gem 'beaker', '~>4.0'
gem 'beaker-vmpooler'
# project.gemspec
s.add_runtime_dependency 'beaker', '~>4.0'
s.add_runtime_dependency 'beaker-vmpooler'
~~~
# Spec tests # Spec tests

View file

@ -20,8 +20,13 @@ Gem::Specification.new do |s|
# Testing dependencies # Testing dependencies
s.add_development_dependency 'rspec', '~> 3.0' s.add_development_dependency 'rspec', '~> 3.0'
s.add_development_dependency 'rspec-its' s.add_development_dependency 'rspec-its'
s.add_development_dependency 'fakefs', '~> 2.4' # pin fakefs for Ruby < 2.3
s.add_development_dependency 'rake', '~> 13.0' if RUBY_VERSION < "2.3"
s.add_development_dependency 'fakefs', '~> 0.6', '< 0.14'
else
s.add_development_dependency 'fakefs', '~> 0.6'
end
s.add_development_dependency 'rake', '~> 10.1'
s.add_development_dependency 'simplecov' s.add_development_dependency 'simplecov'
s.add_development_dependency 'pry', '~> 0.10' s.add_development_dependency 'pry', '~> 0.10'

View file

@ -1,3 +1,3 @@
module BeakerVmpooler module BeakerVmpooler
VERSION = '1.4.0' VERSION = '1.3.0'
end end

View file

@ -114,7 +114,6 @@ module Beaker
uri = URI.parse(@options['pooling_api'] + '/vm/') uri = URI.parse(@options['pooling_api'] + '/vm/')
http = Net::HTTP.new(uri.host, uri.port) http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.instance_of?(URI::HTTPS)
request = Net::HTTP::Post.new(uri.request_uri) request = Net::HTTP::Post.new(uri.request_uri)
if @credentials[:vmpooler_token] if @credentials[:vmpooler_token]
@ -170,7 +169,7 @@ module Beaker
@logger.debug("Retrying provision for vmpooler host after waiting #{wait} second(s)") @logger.debug("Retrying provision for vmpooler host after waiting #{wait} second(s)")
sleep wait sleep wait
waited += wait waited += wait
last_wait, wait = wait, [last_wait + wait, 15].min + rand(5) last_wait, wait = wait, last_wait + wait
retry retry
end end
report_and_raise(@logger, e, 'Vmpooler.provision') report_and_raise(@logger, e, 'Vmpooler.provision')
@ -186,7 +185,6 @@ module Beaker
uri = URI.parse(@options[:pooling_api] + '/vm/' + h['vmhostname'].split('.')[0]) uri = URI.parse(@options[:pooling_api] + '/vm/' + h['vmhostname'].split('.')[0])
http = Net::HTTP.new(uri.host, uri.port) http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.instance_of?(URI::HTTPS)
request = Net::HTTP::Put.new(uri.request_uri) request = Net::HTTP::Put.new(uri.request_uri)
# merge pre-defined tags with host tags # merge pre-defined tags with host tags
@ -252,7 +250,6 @@ module Beaker
uri = URI.parse(get_template_url(@options['pooling_api'], name)) uri = URI.parse(get_template_url(@options['pooling_api'], name))
http = Net::HTTP.new( uri.host, uri.port ) http = Net::HTTP.new( uri.host, uri.port )
http.use_ssl = uri.instance_of?(URI::HTTPS)
request = Net::HTTP::Delete.new(uri.request_uri) request = Net::HTTP::Delete.new(uri.request_uri)
if @credentials[:vmpooler_token] if @credentials[:vmpooler_token]
@ -280,7 +277,6 @@ module Beaker
uri = URI.parse(@options[:pooling_api] + '/api/v1/vm/' + hostname + '/disk/' + disk_size.to_s) uri = URI.parse(@options[:pooling_api] + '/api/v1/vm/' + hostname + '/disk/' + disk_size.to_s)
http = Net::HTTP.new(uri.host, uri.port) http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.instance_of?(URI::HTTPS)
request = Net::HTTP::Post.new(uri.request_uri) request = Net::HTTP::Post.new(uri.request_uri)
request['X-AUTH-TOKEN'] = @credentials[:vmpooler_token] request['X-AUTH-TOKEN'] = @credentials[:vmpooler_token]
@ -313,7 +309,6 @@ module Beaker
uri = URI.parse(@options[:pooling_api] + '/vm/' + hostname) uri = URI.parse(@options[:pooling_api] + '/vm/' + hostname)
http = Net::HTTP.new(uri.host, uri.port) http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.instance_of?(URI::HTTPS)
request = Net::HTTP::Get.new(uri.request_uri) request = Net::HTTP::Get.new(uri.request_uri)
response = http.request(request) response = http.request(request)

View file

@ -5,7 +5,6 @@ module Beaker
before :each do before :each do
stub_const( "Net", MockNet ) stub_const( "Net", MockNet )
allow_any_instance_of(MockNet::HTTP).to receive(:use_ssl=)
allow( JSON ).to receive( :parse ) do |arg| allow( JSON ).to receive( :parse ) do |arg|
arg arg
end end