Compare commits

...

75 commits
0.3.0 ... main

Author SHA1 Message Date
Jake Spain
fce29feb60
Merge pull request #40 from puppetlabs/fix-release-prep-param
(maint) Fix missing param in auto_release_prep
2024-01-19 16:48:27 -05:00
Jake Spain
651e4ba892
Remove interactive option from release prep script 2024-01-19 15:34:12 -05:00
Jake Spain
ec6383fac8
Fix missing param in auto_release_prep 2024-01-15 09:24:55 -05:00
Jake Spain
a5c4805106
Merge pull request #39 from puppetlabs/dependabot/github_actions/actions/github-script-7
Bump actions/github-script from 6 to 7
2023-12-07 08:53:03 -05:00
Jake Spain
fff2b5c766
Merge pull request #38 from puppetlabs/dependabot/github_actions/actions/setup-java-4
Bump actions/setup-java from 3 to 4
2023-12-07 08:52:45 -05:00
dependabot[bot]
8eec9a765f
Bump actions/github-script from 6 to 7
Bumps [actions/github-script](https://github.com/actions/github-script) from 6 to 7.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-07 13:51:54 +00:00
Jake Spain
2d56355b74
Merge pull request #37 from puppetlabs/dependabot/github_actions/actions/checkout-4
Bump actions/checkout from 3 to 4
2023-12-07 08:51:16 -05:00
dependabot[bot]
bbce7bd019
Bump actions/setup-java from 3 to 4
Bumps [actions/setup-java](https://github.com/actions/setup-java) from 3 to 4.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](https://github.com/actions/setup-java/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/setup-java
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-07 13:48:38 +00:00
dependabot[bot]
428f7a041d
Bump actions/checkout from 3 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-12-07 13:48:34 +00:00
Jake Spain
5cad1c9711
Merge pull request #36 from puppetlabs/repo-sync
Add dependabot, release prep, and label reusable workflows from release-engineering-repo-standards
2023-12-07 08:48:13 -05:00
Jake Spain
01a0446e03
syncing files from release-engineering-repo-standards 2023-12-06 17:17:09 -05:00
isaac-hammes
9639a2df7f
Merge pull request #35 from puppetlabs/1.3.0-release
(maint) Release prep for version 1.3.0
2023-08-18 09:01:44 -07:00
isaac-hammes
e58c1a8bb3 (maint) Release prep for version 1.3.0 2023-08-18 08:45:44 -07:00
isaac-hammes
81c59cfc9a
Merge pull request #33 from puppetlabs/POD-10
(POD-10) Log reason for failed VM checks.
2023-08-18 05:24:47 -07:00
isaac-hammes
493e358ba1 (POD-10) Log reason for failed VM checks. 2023-08-17 13:08:08 -07:00
Jake Spain
11405592c3
Merge pull request #32 from puppetlabs/1.2.0-release-prep
1.2.0 release prep
2023-08-10 12:56:05 -04:00
Jake Spain
fbd6c7e505
1.2.0 release prep 2023-08-10 12:21:34 -04:00
Jake Spain
f26108277e
Merge pull request #31 from puppetlabs/bump-jruby
Bump jruby to 9.4.3.0 and update lockfile
2023-08-10 11:38:20 -04:00
Jake Spain
cec4ea64d6
Bump jruby to 9.4.3.0 and update lockfile 2023-08-10 10:10:15 -04:00
Jake Spain
2753d5da2a
Merge pull request #30 from puppetlabs/revert_issue_management
Revert issue management change
2023-07-11 07:14:14 -04:00
Jake Spain
0347c42735
Revert "Comment changelog validation until jira support is added"
This reverts commit e0cc9712ed.
2023-07-10 15:56:50 -04:00
Jake Spain
d3713133c8
Revert "Migrate issue management to Jira"
This reverts commit 80234b4337.
2023-07-10 15:56:42 -04:00
Jake Spain
62da7dd6ba
Merge pull request #29 from puppetlabs/dependabot/bundler/thor-1.2.2
Bump thor from 1.2.1 to 1.2.2
2023-05-15 07:39:23 -04:00
dependabot[bot]
521a0f11f1
Bump thor from 1.2.1 to 1.2.2
Bumps [thor](https://github.com/rails/thor) from 1.2.1 to 1.2.2.
- [Release notes](https://github.com/rails/thor/releases)
- [Commits](https://github.com/rails/thor/compare/v1.2.1...v1.2.2)

---
updated-dependencies:
- dependency-name: thor
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-15 02:57:58 +00:00
Jake Spain
726a598abc
Merge pull request #28 from puppetlabs/1.1.0-release-prep
1.1.0 release prep
2023-05-01 09:03:39 -04:00
Jake Spain
e0cc9712ed
Comment changelog validation until jira support is added 2023-05-01 08:29:35 -04:00
Jake Spain
ea9896104a
1.1.0 release prep 2023-05-01 08:29:28 -04:00
Jake Spain
ac3ae71ac8
Merge pull request #24 from puppetlabs/dependabot/bundler/rack-test-2.1.0
Bump rack-test from 2.0.2 to 2.1.0
2023-04-20 11:37:38 -04:00
dependabot[bot]
ce61a7a6c2
Bump rack-test from 2.0.2 to 2.1.0
Bumps [rack-test](https://github.com/rack/rack-test) from 2.0.2 to 2.1.0.
- [Release notes](https://github.com/rack/rack-test/releases)
- [Changelog](https://github.com/rack/rack-test/blob/main/History.md)
- [Commits](https://github.com/rack/rack-test/compare/v2.0.2...v2.1.0)

---
updated-dependencies:
- dependency-name: rack-test
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-20 15:28:13 +00:00
Jake Spain
dc31dee2a4
Merge pull request #18 from puppetlabs/dependabot/bundler/googleauth-gte-0.16.2-and-lt-1.4.0
Update googleauth requirement from >= 0.16.2, < 1.3.0 to >= 0.16.2, < 1.4.0
2023-04-20 11:26:55 -04:00
dependabot[bot]
2d4ff56429
Update googleauth requirement from >= 0.16.2, < 1.3.0 to >= 0.16.2, < 1.4.0
Updates the requirements on [googleauth](https://github.com/googleapis/google-auth-library-ruby) to permit the latest version.
- [Release notes](https://github.com/googleapis/google-auth-library-ruby/releases)
- [Changelog](https://github.com/googleapis/google-auth-library-ruby/blob/main/CHANGELOG.md)
- [Commits](https://github.com/googleapis/google-auth-library-ruby/compare/googleauth/v0.17.0...googleauth/v1.3.0)

---
updated-dependencies:
- dependency-name: googleauth
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-20 11:22:57 -04:00
Jake Spain
2971ee6082
Merge pull request #27 from puppetlabs/migrate-issues
Migrate issue management to Jira
2023-04-20 09:56:18 -04:00
Jake Spain
80234b4337
Migrate issue management to Jira 2023-04-20 08:50:57 -04:00
Jake Spain
8795d3a818
Merge pull request #26 from puppetlabs/bump-jruby
Bump jruby to 9.4.2.0
2023-04-20 08:22:12 -04:00
Jake Spain
515ba9f0a5
Bump jruby to 9.4.2.0 2023-04-19 16:57:32 -04:00
Jake Spain
3c5f71aea2
Merge pull request #25 from puppetlabs/1.0.0-release
1.0.0 release prep
2023-04-19 09:22:12 -04:00
Jake Spain
bf2e20dcfe
1.0.0 release prep 2023-04-19 08:25:43 -04:00
Jake Spain
bee66557ea
Merge pull request #21 from puppetlabs/vmpooler-dns-gcp
(RE-15124) Decouple DNS Record Management into DNS Plugins
2023-04-18 11:47:26 -04:00
Jake Spain
355d3a60ce
Add debug logger line 2023-04-17 10:26:48 -04:00
Jake Spain
06d940a964
Bump vmpooler requirement and add install gemfile script 2023-03-29 09:53:47 -04:00
Jake Spain
1aaa6711b5
Update spec tests for new dns settings 2023-03-29 09:53:45 -04:00
Jake Spain
38064771aa
Fix rubocops 2023-03-29 09:53:44 -04:00
Jake Spain
fcf79c9421
Remove google-cloud-dns gem dependency 2023-03-29 09:53:43 -04:00
Jake Spain
36e9044087
Refactor obtaining and saving ip address 2023-03-29 09:53:42 -04:00
Jake Spain
1375093b43
Use domain provided by pool's dns_config
debug open socket
2023-03-29 09:53:41 -04:00
Jake Spain
911c15dc4e
Add migration to readme 2023-03-29 09:53:39 -04:00
Jake Spain
d8c47134ef
Start extracting dns setup and teardown 2023-03-29 09:53:28 -04:00
Jake Spain
8015a18ea4
Merge pull request #23 from puppetlabs/release_prep
0.5.0 release prep
2023-03-06 15:05:06 -05:00
Jake Spain
407b3f09dd
0.5.0 release prep 2023-03-06 14:49:19 -05:00
Jake Spain
aaf2112166
Update and consolidate release prep step 2023-03-06 14:49:00 -05:00
Jake Spain
0883fe8f0d
Merge pull request #22 from puppetlabs/update_timeout_method
(maint) Update to jruby-9.4.1.0 and move socket timeout to new method.
2023-03-06 13:59:05 -05:00
Jake Spain
b8e630ed17
Bump to java 11 2023-03-03 22:01:50 -05:00
isaac-hammes
cbec1d9d3a (maint) Update to jruby-9.4.1.0 and move socket timeout to new method. 2023-03-02 12:02:42 -08:00
Jake Spain
e8c3e2f8ba
Merge pull request #20 from puppetlabs/update-actions
Add docs and update actions
2023-01-30 16:51:53 -05:00
Jake Spain
30c524922c
Add platform universal-java-11 to lockfile 2023-01-30 14:58:54 -05:00
Jake Spain
dd1829abf8
vmpooler should be a dependency 2023-01-30 14:00:58 -05:00
Jake Spain
1d8b9c5ab9
Add changelog and release instructions 2023-01-30 14:00:58 -05:00
Jake Spain
91cf44d54a
Update release workflow 2023-01-30 10:07:13 -05:00
Jake Spain
733856809c
Add jruby-9.4 to testing 2023-01-30 09:08:42 -05:00
Jake Spain
6d0842d48b
Merge pull request #19 from puppetlabs/add-mend
(RE-15111) Migrate Snyk to Mend Scanning
2023-01-20 14:49:18 -05:00
Jake Spain
4afe1db81b
Migrate Snyk to Mend Scanning 2023-01-20 12:43:23 -05:00
Jake Spain
97eb08011c
Change dependabot to weekly 2023-01-19 21:17:35 -05:00
Jake Spain
992d35003c
Merge pull request #17 from puppetlabs/update_codeowners
(RE-14811) Remove DIO as codeowners
2022-08-26 10:35:29 -04:00
Jake Spain
f93610a3ff
Remove DIO as codeowners 2022-08-26 09:44:43 -04:00
Jake Spain
d1c9d946f6
Merge pull request #16 from puppetlabs/migrate_snyk
Add Snyk action
2022-08-18 10:12:06 -04:00
Jake Spain
8451e2834d
Add Snyk action 2022-08-16 17:31:02 -04:00
Jake Spain
c2f6868237
Merge pull request #15 from puppetlabs/update-codeowners
Add release-engineering to codeowners
2022-08-08 15:03:36 -04:00
Jake Spain
84a026e8ad
Add release-engineering to codeowners 2022-08-08 14:35:32 -04:00
Erik Hansen
3c95190eae
Merge pull request #13 from puppetlabs/maint-refactor-dns
(maint) Refactor cloud dns
2022-07-27 10:31:46 -07:00
Samuel Beaulieu
26327210a4
Added a check for failed create attempts, they are now retried up to 30 times 2022-07-27 12:24:45 -05:00
Samuel Beaulieu
b94d54f129
bump testing with jruby-9.3.6.0 2022-07-27 09:35:18 -05:00
Samuel
9d5d0d7c2d
Merge pull request #12 from puppetlabs/dependabot/bundler/googleauth-gte-0.16.2-and-lt-1.3.0
Update googleauth requirement from >= 0.16.2, < 1.2.0 to >= 0.16.2, < 1.3.0
2022-07-27 09:33:21 -05:00
Samuel Beaulieu
2a39a8cf06
fix rubocop offences and spec tests 2022-07-27 09:31:24 -05:00
Samuel Beaulieu
79516d8014
(maint) Refactor cloud dns
Moved the creation and deletion methods to a vmpooler class, to be used by the ec2
provisioner.
Added a check for failed deletion attempts, they are now retried up to 30 times
2022-07-26 16:20:48 -05:00
dependabot[bot]
7d399da016
Update googleauth requirement from >= 0.16.2, < 1.2.0 to >= 0.16.2, < 1.3.0
Updates the requirements on [googleauth](https://github.com/googleapis/google-auth-library-ruby) to permit the latest version.
- [Release notes](https://github.com/googleapis/google-auth-library-ruby/releases)
- [Changelog](https://github.com/googleapis/google-auth-library-ruby/blob/main/CHANGELOG.md)
- [Commits](https://github.com/googleapis/google-auth-library-ruby/compare/googleauth/v0.17.0...googleauth/v1.2.0)

---
updated-dependencies:
- dependency-name: googleauth
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-24 13:25:45 +00:00
21 changed files with 638 additions and 108 deletions

View file

@ -3,6 +3,11 @@ updates:
- package-ecosystem: bundler
directory: "/"
schedule:
interval: daily
time: "13:00"
interval: weekly
open-pull-requests-limit: 10
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10

12
.github/workflows/auto_release_prep.yml vendored Normal file
View file

@ -0,0 +1,12 @@
name: Automated release prep
on:
workflow_dispatch:
jobs:
auto_release_prep:
uses: puppetlabs/release-engineering-repo-standards/.github/workflows/auto_release_prep.yml@v1
secrets: inherit
with:
project-type: ruby
version-file-path: lib/vmpooler-provider-gce/version.rb

View file

@ -0,0 +1,8 @@
name: Dependabot auto-merge
on: pull_request
jobs:
dependabot_merge:
uses: puppetlabs/release-engineering-repo-standards/.github/workflows/dependabot_merge.yml@v1
secrets: inherit

8
.github/workflows/ensure_label.yml vendored Normal file
View file

@ -0,0 +1,8 @@
name: Ensure label
on: pull_request
jobs:
ensure_label:
uses: puppetlabs/release-engineering-repo-standards/.github/workflows/ensure_label.yml@v1
secrets: inherit

View file

@ -1,4 +1,4 @@
name: Release
name: Release Gem
on: workflow_dispatch
@ -7,25 +7,77 @@ jobs:
runs-on: ubuntu-latest
if: github.repository == 'puppetlabs/vmpooler-provider-gce'
steps:
- uses: actions/checkout@v2
- name: Get Version
id: gv
- uses: actions/checkout@v4
- name: Get Current Version
uses: actions/github-script@v7
id: cv
with:
script: |
const { data: response } = await github.rest.repos.getLatestRelease({
owner: context.repo.owner,
repo: context.repo.repo,
})
console.log(`The latest release is ${response.tag_name}`)
return response.tag_name
result-encoding: string
- name: Get Next Version
id: nv
run: |
echo "::set-output name=ver::$(grep VERSION lib/vmpooler-provider-gce/version.rb |rev |cut -d "'" -f2 |rev)"
version=$(grep VERSION lib/vmpooler-provider-gce/version.rb |rev |cut -d "'" -f2 |rev)
echo "version=$version" >> $GITHUB_OUTPUT
echo "Found version $version from lib/vmpooler-provider-gce/version.rb"
- name: Generate Changelog
uses: docker://githubchangeloggenerator/github-changelog-generator:1.16.2
with:
args: >-
--future-release ${{ steps.nv.outputs.version }}
env:
CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Validate Changelog
run : |
set -e
if [[ -n $(git status --porcelain) ]]; then
echo "Here is the current git status:"
git status
echo
echo "The following changes were detected:"
git --no-pager diff
echo "Uncommitted PRs found in the changelog. Please submit a release prep PR of changes after running `./update-changelog`"
exit 1
fi
- name: Generate Release Notes
uses: docker://githubchangeloggenerator/github-changelog-generator:1.16.2
with:
args: >-
--since-tag ${{ steps.cv.outputs.result }}
--future-release ${{ steps.nv.outputs.version }}
--output release-notes.md
env:
CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Tag Release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.gv.outputs.ver }}
tag: ${{ steps.nv.outputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
bodyfile: release-notes.md
draft: false
prerelease: false
generateReleaseNotes: true
- name: Install Ruby 2.5.8
# This step should closely match what is used in `docker/Dockerfile` in vmpooler-deployment
- name: Install Ruby jruby-9.4.3.0
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.5.8'
ruby-version: 'jruby-9.4.3.0'
- name: Build gem
run: gem build *.gemspec
- name: Publish gem
run: |
mkdir -p $HOME/.gem

39
.github/workflows/security.yml vendored Normal file
View 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@v4
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@v4
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

@ -18,9 +18,9 @@ jobs:
strategy:
matrix:
ruby-version:
- '2.5.8'
- 'jruby-9.4.3.0'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
@ -34,10 +34,9 @@ jobs:
strategy:
matrix:
ruby-version:
- '2.5.8'
- 'jruby-9.2.12.0'
- 'jruby-9.4.3.0'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:

View file

@ -0,0 +1,3 @@
project=vmpooler-provider-gce
user=puppetlabs
exclude_labels=maintenance

110
CHANGELOG.md Normal file
View file

@ -0,0 +1,110 @@
# Changelog
## [1.3.0](https://github.com/puppetlabs/vmpooler-provider-gce/tree/1.3.0) (2023-08-18)
[Full Changelog](https://github.com/puppetlabs/vmpooler-provider-gce/compare/1.2.0...1.3.0)
**Implemented enhancements:**
- \(POD-10\) Log reason for failed VM checks. [\#33](https://github.com/puppetlabs/vmpooler-provider-gce/pull/33) ([isaac-hammes](https://github.com/isaac-hammes))
## [1.2.0](https://github.com/puppetlabs/vmpooler-provider-gce/tree/1.2.0) (2023-08-10)
[Full Changelog](https://github.com/puppetlabs/vmpooler-provider-gce/compare/1.1.0...1.2.0)
**Implemented enhancements:**
- Bump jruby to 9.4.3.0 and update lockfile [\#31](https://github.com/puppetlabs/vmpooler-provider-gce/pull/31) ([yachub](https://github.com/yachub))
**Merged pull requests:**
- Bump thor from 1.2.1 to 1.2.2 [\#29](https://github.com/puppetlabs/vmpooler-provider-gce/pull/29) ([dependabot[bot]](https://github.com/apps/dependabot))
## [1.1.0](https://github.com/puppetlabs/vmpooler-provider-gce/tree/1.1.0) (2023-05-01)
[Full Changelog](https://github.com/puppetlabs/vmpooler-provider-gce/compare/1.0.0...1.1.0)
**Merged pull requests:**
- Migrate issue management to Jira [\#27](https://github.com/puppetlabs/vmpooler-provider-gce/pull/27) ([yachub](https://github.com/yachub))
- Bump jruby to 9.4.2.0 [\#26](https://github.com/puppetlabs/vmpooler-provider-gce/pull/26) ([yachub](https://github.com/yachub))
- Bump rack-test from 2.0.2 to 2.1.0 [\#24](https://github.com/puppetlabs/vmpooler-provider-gce/pull/24) ([dependabot[bot]](https://github.com/apps/dependabot))
- Update googleauth requirement from \>= 0.16.2, \< 1.3.0 to \>= 0.16.2, \< 1.4.0 [\#18](https://github.com/puppetlabs/vmpooler-provider-gce/pull/18) ([dependabot[bot]](https://github.com/apps/dependabot))
## [1.0.0](https://github.com/puppetlabs/vmpooler-provider-gce/tree/1.0.0) (2023-04-19)
[Full Changelog](https://github.com/puppetlabs/vmpooler-provider-gce/compare/0.5.0...1.0.0)
**Breaking changes:**
- \(RE-15124\) Decouple DNS Record Management into DNS Plugins [\#21](https://github.com/puppetlabs/vmpooler-provider-gce/pull/21) ([yachub](https://github.com/yachub))
## [0.5.0](https://github.com/puppetlabs/vmpooler-provider-gce/tree/0.5.0) (2023-03-06)
[Full Changelog](https://github.com/puppetlabs/vmpooler-provider-gce/compare/0.4.0...0.5.0)
**Implemented enhancements:**
- \(RE-15161\) Update to jruby-9.4.1.0 and move socket timeout to new method. [\#22](https://github.com/puppetlabs/vmpooler-provider-gce/pull/22) ([isaac-hammes](https://github.com/isaac-hammes))
**Merged pull requests:**
- Add docs and update actions [\#20](https://github.com/puppetlabs/vmpooler-provider-gce/pull/20) ([yachub](https://github.com/yachub))
- \(RE-15111\) Migrate Snyk to Mend Scanning [\#19](https://github.com/puppetlabs/vmpooler-provider-gce/pull/19) ([yachub](https://github.com/yachub))
- \(RE-14811\) Remove DIO as codeowners [\#17](https://github.com/puppetlabs/vmpooler-provider-gce/pull/17) ([yachub](https://github.com/yachub))
- Add Snyk action [\#16](https://github.com/puppetlabs/vmpooler-provider-gce/pull/16) ([yachub](https://github.com/yachub))
- Add release-engineering to codeowners [\#15](https://github.com/puppetlabs/vmpooler-provider-gce/pull/15) ([yachub](https://github.com/yachub))
## [0.4.0](https://github.com/puppetlabs/vmpooler-provider-gce/tree/0.4.0) (2022-07-27)
[Full Changelog](https://github.com/puppetlabs/vmpooler-provider-gce/compare/0.3.0...0.4.0)
**Merged pull requests:**
- \(maint\) Refactor cloud dns [\#13](https://github.com/puppetlabs/vmpooler-provider-gce/pull/13) ([sbeaulie](https://github.com/sbeaulie))
- Update googleauth requirement from \>= 0.16.2, \< 1.2.0 to \>= 0.16.2, \< 1.3.0 [\#12](https://github.com/puppetlabs/vmpooler-provider-gce/pull/12) ([dependabot[bot]](https://github.com/apps/dependabot))
## [0.3.0](https://github.com/puppetlabs/vmpooler-provider-gce/tree/0.3.0) (2022-06-21)
[Full Changelog](https://github.com/puppetlabs/vmpooler-provider-gce/compare/0.2.0...0.3.0)
**Merged pull requests:**
- release prep 0.3.0 [\#11](https://github.com/puppetlabs/vmpooler-provider-gce/pull/11) ([sbeaulie](https://github.com/sbeaulie))
- \(DIO-3162\) vmpooler gce provider to support disk type \(to use ssd\) [\#10](https://github.com/puppetlabs/vmpooler-provider-gce/pull/10) ([sbeaulie](https://github.com/sbeaulie))
## [0.2.0](https://github.com/puppetlabs/vmpooler-provider-gce/tree/0.2.0) (2022-04-19)
[Full Changelog](https://github.com/puppetlabs/vmpooler-provider-gce/compare/0.1.2...0.2.0)
**Implemented enhancements:**
- Set hostname for instance during create\_vm [\#8](https://github.com/puppetlabs/vmpooler-provider-gce/pull/8) ([yachub](https://github.com/yachub))
**Merged pull requests:**
- 0.2.0 release prep [\#9](https://github.com/puppetlabs/vmpooler-provider-gce/pull/9) ([yachub](https://github.com/yachub))
- Update vmpooler requirement from ~\> 1.3, \>= 1.3.0 to \>= 1.3.0, ~\> 2.3 [\#7](https://github.com/puppetlabs/vmpooler-provider-gce/pull/7) ([dependabot[bot]](https://github.com/apps/dependabot))
- Update googleauth requirement from ~\> 0.16.2 to \>= 0.16.2, \< 1.2.0 [\#6](https://github.com/puppetlabs/vmpooler-provider-gce/pull/6) ([dependabot[bot]](https://github.com/apps/dependabot))
## [0.1.2](https://github.com/puppetlabs/vmpooler-provider-gce/tree/0.1.2) (2022-01-10)
[Full Changelog](https://github.com/puppetlabs/vmpooler-provider-gce/compare/0.1.1...0.1.2)
## [0.1.1](https://github.com/puppetlabs/vmpooler-provider-gce/tree/0.1.1) (2022-01-10)
[Full Changelog](https://github.com/puppetlabs/vmpooler-provider-gce/compare/0.1.0...0.1.1)
## [0.1.0](https://github.com/puppetlabs/vmpooler-provider-gce/tree/0.1.0) (2022-01-10)
[Full Changelog](https://github.com/puppetlabs/vmpooler-provider-gce/compare/588e29b6e100327336bf0910ae16b6a85ffe279a...0.1.0)
**Merged pull requests:**
- Adding the cloud DNS API library and related methods [\#4](https://github.com/puppetlabs/vmpooler-provider-gce/pull/4) ([sbeaulie](https://github.com/sbeaulie))
- fix simplecov with jruby, add a .rubocop.yml config file [\#3](https://github.com/puppetlabs/vmpooler-provider-gce/pull/3) ([sbeaulie](https://github.com/sbeaulie))
- Add a release workflow for pushing to Rubygems [\#1](https://github.com/puppetlabs/vmpooler-provider-gce/pull/1) ([genebean](https://github.com/genebean))
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*

View file

@ -1,10 +1,10 @@
# This will cause DIO to be assigned review of any opened PRs against
# This will cause RE to be assigned review of any opened PRs against
# the branches containing this file.
# See https://help.github.com/en/articles/about-code-owners for info on how to
# take ownership of parts of the code base that should be reviewed by another
# team.
# DIO will be the default owners for everything in the repo.
* @puppetlabs/dio
# RE will be the default owners for everything in the repo.
* @puppetlabs/release-engineering

239
Gemfile.lock Normal file
View file

@ -0,0 +1,239 @@
PATH
remote: .
specs:
vmpooler-provider-gce (1.3.0)
google-apis-compute_v1 (~> 0.14)
googleauth (>= 0.16.2, < 1.4.0)
vmpooler (~> 3.0)
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
bindata (2.4.15)
builder (3.2.4)
climate_control (1.2.0)
coderay (1.1.3)
concurrent-ruby (1.2.2)
connection_pool (2.4.1)
declarative (0.0.20)
deep_merge (1.2.2)
diff-lcs (1.5.0)
docile (1.4.0)
faraday (2.7.10)
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-net_http (3.0.2)
ffi (1.15.5-java)
google-apis-compute_v1 (0.75.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-core (0.11.1)
addressable (~> 2.5, >= 2.5.1)
googleauth (>= 0.16.2, < 2.a)
httpclient (>= 2.8.1, < 3.a)
mini_mime (~> 1.0)
representable (~> 3.0)
retriable (>= 2.0, < 4.a)
rexml
webrick
google-cloud-env (1.6.0)
faraday (>= 0.17.3, < 3.0)
googleauth (1.3.0)
faraday (>= 0.17.3, < 3.a)
jwt (>= 1.4, < 3.0)
memoist (~> 0.16)
multi_json (~> 1.11)
os (>= 0.9, < 2.0)
signet (>= 0.16, < 2.a)
httpclient (2.8.3)
jwt (2.7.1)
memoist (0.16.2)
method_source (1.0.0)
mini_mime (1.1.5)
mock_redis (0.37.0)
multi_json (1.15.0)
mustermann (3.0.0)
ruby2_keywords (~> 0.0.1)
net-ldap (0.18.0)
nio4r (2.5.9)
nio4r (2.5.9-java)
opentelemetry-api (1.2.1)
opentelemetry-common (0.20.0)
opentelemetry-api (~> 1.0)
opentelemetry-exporter-jaeger (0.23.0)
opentelemetry-api (~> 1.1)
opentelemetry-common (~> 0.20)
opentelemetry-sdk (~> 1.2)
opentelemetry-semantic_conventions
thrift
opentelemetry-instrumentation-base (0.22.2)
opentelemetry-api (~> 1.0)
opentelemetry-registry (~> 0.1)
opentelemetry-instrumentation-concurrent_ruby (0.21.1)
opentelemetry-api (~> 1.0)
opentelemetry-instrumentation-base (~> 0.22.1)
opentelemetry-instrumentation-http_client (0.22.2)
opentelemetry-api (~> 1.0)
opentelemetry-common (~> 0.20.0)
opentelemetry-instrumentation-base (~> 0.22.1)
opentelemetry-instrumentation-rack (0.23.4)
opentelemetry-api (~> 1.0)
opentelemetry-common (~> 0.20.0)
opentelemetry-instrumentation-base (~> 0.22.1)
opentelemetry-instrumentation-redis (0.25.3)
opentelemetry-api (~> 1.0)
opentelemetry-common (~> 0.20.0)
opentelemetry-instrumentation-base (~> 0.22.1)
opentelemetry-instrumentation-sinatra (0.23.2)
opentelemetry-api (~> 1.0)
opentelemetry-common (~> 0.20.0)
opentelemetry-instrumentation-base (~> 0.22.1)
opentelemetry-instrumentation-rack (~> 0.21)
opentelemetry-registry (0.3.0)
opentelemetry-api (~> 1.1)
opentelemetry-resource_detectors (0.24.1)
google-cloud-env
opentelemetry-sdk (~> 1.0)
opentelemetry-sdk (1.3.0)
opentelemetry-api (~> 1.1)
opentelemetry-common (~> 0.20)
opentelemetry-registry (~> 0.2)
opentelemetry-semantic_conventions
opentelemetry-semantic_conventions (1.10.0)
opentelemetry-api (~> 1.0)
os (1.1.4)
parallel (1.23.0)
parser (3.2.2.3)
ast (~> 2.4.1)
racc
pickup (0.0.11)
prometheus-client (4.2.1)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
pry (0.14.2-java)
coderay (~> 1.1)
method_source (~> 1.0)
spoon (~> 0.0)
public_suffix (5.0.3)
puma (6.3.0)
nio4r (~> 2.0)
puma (6.3.0-java)
nio4r (~> 2.0)
racc (1.7.1)
racc (1.7.1-java)
rack (2.2.8)
rack-protection (3.1.0)
rack (~> 2.2, >= 2.2.4)
rack-test (2.1.0)
rack (>= 1.3)
rainbow (3.1.1)
rake (13.0.6)
redis (4.8.1)
regexp_parser (2.8.1)
representable (3.2.0)
declarative (< 0.1.0)
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
retriable (3.1.2)
rexml (3.2.6)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.1)
rubocop (1.1.0)
parallel (~> 1.10)
parser (>= 2.7.1.5)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8)
rexml
rubocop-ast (>= 1.0.1)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (1.29.0)
parser (>= 3.2.1.0)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
signet (0.17.0)
addressable (~> 2.8)
faraday (>= 0.17.5, < 3.a)
jwt (>= 1.5, < 3.0)
multi_json (~> 1.10)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
sinatra (3.1.0)
mustermann (~> 3.0)
rack (~> 2.2, >= 2.2.4)
rack-protection (= 3.1.0)
tilt (~> 2.0)
spicy-proton (2.1.15)
bindata (~> 2.3)
spoon (0.0.6)
ffi
statsd-ruby (1.5.0)
thor (1.2.2)
thrift (0.18.1)
tilt (2.2.0)
trailblazer-option (0.1.2)
uber (0.1.0)
unicode-display_width (1.8.0)
vmpooler (3.2.0)
concurrent-ruby (~> 1.1)
connection_pool (~> 2.2)
deep_merge (~> 1.2)
net-ldap (~> 0.16)
opentelemetry-exporter-jaeger (= 0.23.0)
opentelemetry-instrumentation-concurrent_ruby (= 0.21.1)
opentelemetry-instrumentation-http_client (= 0.22.2)
opentelemetry-instrumentation-redis (= 0.25.3)
opentelemetry-instrumentation-sinatra (= 0.23.2)
opentelemetry-resource_detectors (= 0.24.1)
opentelemetry-sdk (~> 1.3, >= 1.3.0)
pickup (~> 0.0.11)
prometheus-client (>= 2, < 5)
puma (>= 5.0.4, < 7)
rack (>= 2.2, < 4.0)
rake (~> 13.0)
redis (~> 4.1)
sinatra (>= 2, < 4)
spicy-proton (~> 2.1)
statsd-ruby (~> 1.4)
webrick (1.8.1)
yarjuf (2.0.0)
builder
rspec (~> 3)
PLATFORMS
universal-java-1.8
universal-java-11
x86_64-linux
DEPENDENCIES
climate_control (>= 0.2.0)
mock_redis (>= 0.17.0)
pry
rack-test (>= 0.6)
rspec (>= 3.2)
rubocop (~> 1.1.0)
simplecov (>= 0.11.2)
thor (~> 1.0, >= 1.0.1)
vmpooler-provider-gce!
yarjuf (>= 2.0)
BUNDLED WITH
2.4.7

View file

@ -1,5 +1,15 @@
# vmpooler-provider-gce
- [vmpooler-provider-gce](#vmpooler-provider-gce)
- [Usage](#usage)
- [Migrating to v1](#migrating-to-v1)
- [DNS](#dns)
- [Labels](#labels)
- [Pre-requisite](#pre-requisite)
- [Update the Gemfile Lock](#update-the-gemfile-lock)
- [Releasing](#releasing)
- [License](#license)
This is a provider for [VMPooler](https://github.com/puppetlabs/vmpooler) allows using GCE to create instances, disks,
snapshots, or destroy instances for specific pools.
@ -14,6 +24,42 @@ GCE authorization is handled via a service account (or personal account) private
1. GOOGLE_APPLICATION_CREDENTIALS environment variable eg GOOGLE_APPLICATION_CREDENTIALS=/my/home/directory/my_account_key.json
### Migrating to v1
Starting with the v1.x release, management of DNS records has been extracted from this compute provider and implemented as DNS plugins, similar to compute providers. This means each pool configuration should be pointing to a configuration object in `:dns_config` to determine it's method of record management.
For those using DNS management via this provider, the DNS related options should be moved under `:dns_configs:<INSERT_YOUR_OWN_SYMBOL>` with the value for `dns_class`.
For example, the following keys in a v0.x GCE provider config:
```yaml
:providers:
:gce:
domain: vmpooler.example.com
dns_zone_resource_name: vmpooler-example-com
```
Would be moved to:
```yaml
:dns_configs:
:example:
dns_class: gcp-clouddns
project: jake-vmpooler-dev
domain: vmpooler.example.com
zone_name: vmpooler-example-com
```
Then any pools that should have records created via the dns config above should now reference the named dns config in the `dns_plugin` key:
```yaml
:pools:
- name: 'debian-11-x86_64'
dns_plugin: 'example'
```
For complete examples on how to use the GCP DNS plugin see [vmpooler-dns-gcp](https://github.com/puppetlabs/vmpooler-dns-gcp).
### DNS
DNS is integrated via Google's CloudDNS service. To enable, a CloudDNS zone name must be provided in the config (see the example yaml file dns_zone_resource_name)
@ -37,6 +83,20 @@ do not have the pool label, and can be configured to allow a specific list of un
- The service account needs to be given permissions to the project (broad permissions would be compute v1 admin and dns admin). A yaml file is provided that lists the least-privilege permissions needed
- if using DNS, a DNS zone needs to be created in CloudDNS, and configured in the provider's config section with the name of that zone (dns_zone_resource_name). When not specified, the DNS setup and teardown is skipped.
## Update the Gemfile Lock
To update the `Gemfile.lock` run `./update-gemfile-lock`.
Verify, and update if needed, that the docker tag in the script and GitHub action workflows matches what is used in the [vmpooler-deployment Dockerfile](https://github.com/puppetlabs/vmpooler-deployment/blob/main/docker/Dockerfile).
## Releasing
Follow these steps to publish a new GitHub release, and build and push the gem to <https://rubygems.org>.
1. Bump the "VERSION" in `lib/vmpooler-provider-gce/version.rb` appropriately based on changes in `CHANGELOG.md` since the last release.
2. Run `./release-prep` to update `Gemfile.lock` and `CHANGELOG.md`.
3. Commit and push changes to a new branch, then open a pull request against `main` and be sure to add the "maintenance" label.
4. After the pull request is approved and merged, then navigate to Actions --> Release Gem --> run workflow --> Branch: main --> Run workflow.
## License

7
install-gemfile-lock Executable file
View file

@ -0,0 +1,7 @@
#!/usr/bin/env bash
# The container tag should closely match what is used in `docker/Dockerfile` in vmpooler-deployment
docker run -it --rm \
-v $(pwd):/app \
jruby:9.4.3.0-jdk11 \
/bin/bash -c 'apt-get update -qq && apt-get install -y --no-install-recommends make git netbase && cd /app && gem install bundler && bundle install --jobs 3; echo "LOCK_FILE_UPDATE_EXIT_CODE=$?"'

View file

@ -1,5 +1,5 @@
# frozen_string_literal: true
module VmpoolerProviderGce
VERSION = '0.3.0'
VERSION = '1.3.0'
end

View file

@ -1,10 +1,10 @@
# frozen_string_literal: true
require 'googleauth'
require 'google/apis/compute_v1'
require 'google/cloud/dns'
require 'bigdecimal'
require 'bigdecimal/util'
require 'google/apis/compute_v1'
require 'googleauth'
require 'vmpooler/dns/base'
require 'vmpooler/providers/base'
module Vmpooler
@ -58,11 +58,6 @@ module Vmpooler
end
end
def dns
@dns ||= Google::Cloud::Dns.new(project_id: project)
@dns
end
# main configuration options
def project
provider_config['project']
@ -87,12 +82,9 @@ module Vmpooler
return provider_config['machine_type'] if provider_config['machine_type']
end
def domain
provider_config['domain']
end
def dns_zone_resource_name
provider_config['dns_zone_resource_name']
def domain(pool_name)
dns_plugin_name = pool_config(pool_name)['dns_plugin']
dns_config(dns_plugin_name)
end
# Base methods that are implemented:
@ -196,7 +188,7 @@ module Vmpooler
boot: true,
initialize_params: init_params
)
append_domain = domain || global_config[:config]['domain']
append_domain = domain(pool_name)
fqdn = "#{new_vmname}.#{append_domain}" if append_domain
# Assume all pool config is valid i.e. not missing
@ -213,9 +205,12 @@ module Vmpooler
debug_logger('trigger insert_instance')
result = connection.insert_instance(project, zone(pool_name), client)
wait_for_operation(project, pool_name, result)
created_instance = get_vm(pool_name, new_vmname)
dns_setup(created_instance)
created_instance
get_vm(pool_name, new_vmname)
end
def get_vm_ip_address(vm_name, pool_name)
vm_object = get_vm(pool_name, vm_name)
vm_object['ip']
end
# create_disk creates an additional disk for an existing VM. It will name the new
@ -429,10 +424,8 @@ module Vmpooler
unless deleted
debug_logger("trigger delete_instance #{vm_name}")
vm_hash = get_vm(pool_name, vm_name)
result = connection.delete_instance(project, zone(pool_name), vm_name)
wait_for_operation(project, pool_name, result, 10)
dns_teardown(vm_hash)
end
# list and delete any leftover disk, for instance if they were detached from the instance
@ -467,13 +460,17 @@ module Vmpooler
true
end
def vm_ready?(_pool_name, vm_name)
def vm_ready?(pool_name, vm_name, redis)
debug_logger('vm_ready?')
begin
# TODO: we could use a healthcheck resource attached to instance
open_socket(vm_name, domain || global_config[:config]['domain'])
rescue StandardError => _e
domain = domain(pool_name)
open_socket(vm_name, domain)
rescue StandardError => e
redis.hset("vmpooler__vm__#{vm_name}", 'open_socket_error', e.to_s)
return false
end
redis.hdel("vmpooler__vm__#{vm_name}", 'open_socket_error')
true
end
@ -502,9 +499,6 @@ module Vmpooler
debug_logger("trigger async delete_instance #{vm.name}")
result = connection.delete_instance(project, zone, vm.name)
vm_pool = vm.labels&.key?('pool') ? vm.labels['pool'] : nil
existing_vm = generate_vm_hash(vm, vm_pool)
dns_teardown(existing_vm)
result_list << result
end
# now check they are done
@ -565,31 +559,6 @@ module Vmpooler
# END BASE METHODS
def dns_setup(created_instance)
dns_zone = dns.zone(dns_zone_resource_name) if dns_zone_resource_name
return unless dns_zone && created_instance && created_instance['name'] && created_instance['ip']
name = created_instance['name']
begin
change = dns_zone.add(name, 'A', 60, [created_instance['ip']])
debug_logger("#{change.id} - #{change.started_at} - #{change.status} DNS address added") if change
rescue Google::Cloud::AlreadyExistsError => _e
# DNS setup is done only for new instances, so in the rare case where a DNS record already exists (it is stale) and we replace it.
# the error is Google::Cloud::AlreadyExistsError: alreadyExists: The resource 'entity.change.additions[0]' named 'instance-8.test.vmpooler.net. (A)' already exists
change = dns_zone.replace(name, 'A', 60, [created_instance['ip']])
debug_logger("#{change.id} - #{change.started_at} - #{change.status} DNS address previously existed and was replaced") if change
end
end
def dns_teardown(created_instance)
dns_zone = dns.zone(dns_zone_resource_name) if dns_zone_resource_name
return unless dns_zone && created_instance
name = created_instance['name']
change = dns_zone.remove(name, 'A')
debug_logger("#{change.id} - #{change.started_at} - #{change.status} DNS address removed") if change
end
def should_be_ignored(item, allowlist)
return false if allowlist.nil?
@ -703,15 +672,13 @@ module Vmpooler
# This should supercede the open_socket method in the Pool Manager
def open_socket(host, domain = nil, timeout = 5, port = 22, &_block)
Timeout.timeout(timeout) do
target_host = host
target_host = "#{host}.#{domain}" if domain
sock = TCPSocket.new target_host, port
begin
yield sock if block_given?
ensure
sock.close
end
target_host = host
target_host = "#{host}.#{domain}" if domain
sock = TCPSocket.new(target_host, port, connect_timeout: timeout)
begin
yield sock if block_given?
ensure
sock.close
end
end

15
release-prep Executable file
View file

@ -0,0 +1,15 @@
#!/usr/bin/env bash
# The container tag should closely match what is used in `docker/Dockerfile` in vmpooler-deployment
#
# Update Gemfile.lock
docker run -t --rm \
-v $(pwd):/app \
jruby:9.4.3.0-jdk11 \
/bin/bash -c 'apt-get update -qq && apt-get install -y --no-install-recommends git make netbase && cd /app && gem install bundler && bundle install --jobs 3; echo "LOCK_FILE_UPDATE_EXIT_CODE=$?"'
# Update Changelog
docker run -t --rm -e CHANGELOG_GITHUB_TOKEN -v $(pwd):/usr/local/src/your-app \
githubchangeloggenerator/github-changelog-generator:1.16.2 \
github_changelog_generator --future-release $(grep VERSION lib/vmpooler-provider-gce/version.rb |rev |cut -d "'" -f2 |rev)

View file

@ -1,9 +0,0 @@
MockDNS = Struct.new(
# https://rubydoc.info/gems/google-cloud-dns/0.35.1/Google/Cloud/Dns
:change, :credentials, :project, :record, :zone,
keyword_init: true
) do
def zone(zone)
self.zone = zone
end
end

View file

@ -10,7 +10,6 @@ require 'vmpooler'
require 'redis'
require 'vmpooler/metrics'
require 'computeservice_helper'
require 'dnsservice_helper'
def project_root_dir
File.dirname(File.dirname(__FILE__))

View file

@ -18,6 +18,11 @@ describe 'Vmpooler::PoolManager::Provider::Gce' do
:config:
max_tries: 3
retry_factor: 10
:dns_configs:
:gcp-clouddns:
project: vmpooler-test
domain: vmpooler.example.com
dns_zone_resource_name: vmpooler-example-com
:providers:
:gce:
connection_pool_timeout: 1
@ -32,6 +37,7 @@ describe 'Vmpooler::PoolManager::Provider::Gce' do
timeout: 10
ready_ttl: 1440
provider: 'gce'
dns_config: 'gcp-clouddns'
machine_type: 'zones/#{zone}/machineTypes/e2-micro'
EOT
)
@ -51,8 +57,6 @@ EOT
subject { Vmpooler::PoolManager::Provider::Gce.new(config, logger, metrics, redis_connection_pool, 'gce', provider_options) }
before(:each) { allow(subject).to receive(:dns).and_return(MockDNS.new()) }
describe '#name' do
it 'should be gce' do
expect(subject.name).to eq('gce')
@ -61,22 +65,24 @@ EOT
describe '#manual tests live' do
context 'in itsysops' do
before(:each) { allow(subject).to receive(:dns).and_call_original }
let(:vmname) { "instance-27" }
let(:vmname) { "instance-31" }
let(:project) { 'vmpooler-test' }
let(:config) { YAML.load(<<~EOT
---
:config:
max_tries: 3
retry_factor: 10
:dns_configs:
:gcp-clouddns:
project: vmpooler-test
domain: vmpooler.example.com
dns_zone_resource_name: vmpooler-example-com
:providers:
:gce:
connection_pool_timeout: 1
project: '#{project}'
zone: '#{zone}'
network_name: 'projects/itsysopsnetworking/global/networks/shared1'
dns_zone_resource_name: 'test-vmpooler-puppet-net'
domain: 'test.vmpooler.puppet.net'
:pools:
- name: '#{poolname}'
alias: [ 'mockpool' ]
@ -85,6 +91,7 @@ EOT
timeout: 10
ready_ttl: 1440
provider: 'gce'
dns_config: 'gcp-clouddns'
subnetwork_name: 'projects/itsysopsnetworking/regions/us-west1/subnetworks/vmpooler-test'
machine_type: 'zones/#{zone}/machineTypes/e2-micro'
disk_type: 'pd-ssd'
@ -92,10 +99,6 @@ EOT
) }
skip 'gets a vm' do
result = subject.create_vm(poolname, vmname)
#result = subject.destroy_vm(poolname, vmname)
subject.get_vm(poolname, vmname)
#subject.dns_teardown({'name' => vmname})
# subject.dns_setup({'name' => vmname, 'ip' => '1.2.3.5'})
end
end
end
@ -347,14 +350,20 @@ EOT
end
describe '#vm_ready?' do
let(:domain) { nil }
let(:domain) { 'vmpooler.example.com' }
before(:each) do
allow(subject).to receive(:domain).and_return('vmpooler.example.com')
end
context 'When a VM is ready' do
before(:each) do
expect(subject).to receive(:open_socket).with(vmname, domain)
end
it 'should return true' do
expect(subject.vm_ready?(poolname, vmname)).to be true
redis_connection_pool.with_metrics do |redis|
expect(subject.vm_ready?(poolname, vmname, redis)).to be true
end
end
end
@ -364,7 +373,9 @@ EOT
end
it 'should return false' do
expect(subject.vm_ready?(poolname, vmname)).to be false
redis_connection_pool.with_metrics do |redis|
expect(subject.vm_ready?(poolname, vmname, redis)).to be false
end
end
end
end

7
update-gemfile-lock Executable file
View file

@ -0,0 +1,7 @@
#!/usr/bin/env bash
# The container tag should closely match what is used in `docker/Dockerfile` in vmpooler-deployment
docker run -it --rm \
-v $(pwd):/app \
jruby:9.4.3.0-jdk11 \
/bin/bash -c 'apt-get update -qq && apt-get install -y --no-install-recommends git make netbase && cd /app && gem install bundler && bundle install --jobs 3 && bundle update; echo "LOCK_FILE_UPDATE_EXIT_CODE=$?"'

View file

@ -16,10 +16,8 @@ Gem::Specification.new do |s|
s.files = Dir[ "lib/**/*" ]
s.require_paths = ["lib"]
s.add_dependency "google-apis-compute_v1", "~> 0.14"
s.add_dependency "googleauth", ">= 0.16.2", "< 1.2.0"
s.add_dependency "google-cloud-dns", "~> 0.35.1"
s.add_development_dependency 'vmpooler', '>= 1.3.0', '~> 2.3'
s.add_dependency "googleauth", ">= 0.16.2", "< 1.4.0"
s.add_dependency 'vmpooler', '~> 3.0'
# Testing dependencies
s.add_development_dependency 'climate_control', '>= 0.2.0'