mirror of
https://github.com/puppetlabs/beaker-vmpooler.git
synced 2026-01-26 02:58:42 -05:00
Compare commits
22 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f055e1202b | ||
|
|
c027b1bcef | ||
|
|
c309bf02ce | ||
|
|
4f5ee09807 | ||
|
|
278515e460 | ||
|
|
6acbc08aba | ||
|
|
d8ea6a2e4c | ||
| 5be58b1e82 | |||
|
|
5d04a41003 | ||
|
|
596e0d83f9 | ||
| e012919f08 | |||
|
|
639255b4de | ||
| 1da71ab4dc | |||
|
|
49f57963bc | ||
| bd4ae1ee8e | |||
|
|
252e92ab4f | ||
| f6bf085eab | |||
| ef72c2399a | |||
|
|
0c4dc910d3 | ||
|
|
79d0880c5b | ||
|
|
d54e825506 | ||
|
|
4063b01ba0 |
10 changed files with 127 additions and 16 deletions
7
.github/dependabot.yml
vendored
Normal file
7
.github/dependabot.yml
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: bundler
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: weekly
|
||||
open-pull-requests-limit: 10
|
||||
39
.github/workflows/release.yml
vendored
Normal file
39
.github/workflows/release.yml
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
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 }}'
|
||||
39
.github/workflows/security.yml
vendored
Normal file
39
.github/workflows/security.yml
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
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 }}
|
||||
26
.github/workflows/testing.yml
vendored
Normal file
26
.github/workflows/testing.yml
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
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
|
||||
2
CODEOWNERS
Normal file
2
CODEOWNERS
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
* @puppetlabs/release-engineering
|
||||
|
||||
11
Gemfile
11
Gemfile
|
|
@ -1,8 +1,6 @@
|
|||
source ENV['GEM_SOURCE'] || "https://rubygems.org"
|
||||
|
||||
gemspec
|
||||
|
||||
|
||||
gemspec :development_group => :acceptance_testing
|
||||
|
||||
def location_for(place, fake_version = nil)
|
||||
if place =~ /^(git:[^#]*)#(.*)/
|
||||
|
|
@ -14,14 +12,13 @@ def location_for(place, fake_version = nil)
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
# We don't put beaker in as a test dependency because we
|
||||
# don't want to create a transitive dependency
|
||||
group :acceptance_testing do
|
||||
gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 3.0')
|
||||
gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '>= 5.0', '< 7')
|
||||
gem "beaker-abs"
|
||||
end
|
||||
|
||||
|
||||
if File.exists? "#{__FILE__}.local"
|
||||
if File.exist? "#{__FILE__}.local"
|
||||
eval(File.read("#{__FILE__}.local"), binding)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -20,13 +20,8 @@ Gem::Specification.new do |s|
|
|||
# Testing dependencies
|
||||
s.add_development_dependency 'rspec', '~> 3.0'
|
||||
s.add_development_dependency 'rspec-its'
|
||||
# pin fakefs for Ruby < 2.3
|
||||
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 'fakefs', '~> 2.4'
|
||||
s.add_development_dependency 'rake', '~> 13.0'
|
||||
s.add_development_dependency 'simplecov'
|
||||
s.add_development_dependency 'pry', '~> 0.10'
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
module BeakerVmpooler
|
||||
VERSION = '1.3.2'
|
||||
VERSION = '1.4.0'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -114,6 +114,7 @@ module Beaker
|
|||
uri = URI.parse(@options['pooling_api'] + '/vm/')
|
||||
|
||||
http = Net::HTTP.new(uri.host, uri.port)
|
||||
http.use_ssl = uri.instance_of?(URI::HTTPS)
|
||||
request = Net::HTTP::Post.new(uri.request_uri)
|
||||
|
||||
if @credentials[:vmpooler_token]
|
||||
|
|
@ -185,6 +186,7 @@ module Beaker
|
|||
uri = URI.parse(@options[:pooling_api] + '/vm/' + h['vmhostname'].split('.')[0])
|
||||
|
||||
http = Net::HTTP.new(uri.host, uri.port)
|
||||
http.use_ssl = uri.instance_of?(URI::HTTPS)
|
||||
request = Net::HTTP::Put.new(uri.request_uri)
|
||||
|
||||
# merge pre-defined tags with host tags
|
||||
|
|
@ -250,6 +252,7 @@ module Beaker
|
|||
uri = URI.parse(get_template_url(@options['pooling_api'], name))
|
||||
|
||||
http = Net::HTTP.new( uri.host, uri.port )
|
||||
http.use_ssl = uri.instance_of?(URI::HTTPS)
|
||||
request = Net::HTTP::Delete.new(uri.request_uri)
|
||||
|
||||
if @credentials[:vmpooler_token]
|
||||
|
|
@ -274,9 +277,10 @@ module Beaker
|
|||
end
|
||||
|
||||
begin
|
||||
uri = URI.parse(@options[:pooling_api] + '/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.use_ssl = uri.instance_of?(URI::HTTPS)
|
||||
request = Net::HTTP::Post.new(uri.request_uri)
|
||||
request['X-AUTH-TOKEN'] = @credentials[:vmpooler_token]
|
||||
|
||||
|
|
@ -309,6 +313,7 @@ module Beaker
|
|||
uri = URI.parse(@options[:pooling_api] + '/vm/' + hostname)
|
||||
|
||||
http = Net::HTTP.new(uri.host, uri.port)
|
||||
http.use_ssl = uri.instance_of?(URI::HTTPS)
|
||||
request = Net::HTTP::Get.new(uri.request_uri)
|
||||
|
||||
response = http.request(request)
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ module Beaker
|
|||
|
||||
before :each do
|
||||
stub_const( "Net", MockNet )
|
||||
allow_any_instance_of(MockNet::HTTP).to receive(:use_ssl=)
|
||||
allow( JSON ).to receive( :parse ) do |arg|
|
||||
arg
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue