From 1cd8af4fa145c803c704a043454e34ae2116b09a Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Mon, 30 Jan 2023 15:29:30 -0500 Subject: [PATCH 01/41] Run bundle gem vmpooler-dns-google-clouddns --- .github/workflows/main.yml | 27 +++++++++++++++ .gitignore | 8 +++++ .rubocop.yml | 13 +++++++ CHANGELOG.md | 5 +++ Gemfile | 10 ++++++ README.md | 36 ++++++++++++++++++- Rakefile | 8 +++++ bin/console | 15 ++++++++ bin/setup | 8 +++++ lib/vmpooler/dns/google/clouddns.rb | 14 ++++++++ lib/vmpooler/dns/google/clouddns/version.rb | 11 ++++++ sig/vmpooler/dns/google/clouddns.rbs | 10 ++++++ vmpooler-dns-google-clouddns.gemspec | 38 +++++++++++++++++++++ 13 files changed, 202 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/main.yml create mode 100644 .gitignore create mode 100644 .rubocop.yml create mode 100644 CHANGELOG.md create mode 100644 Gemfile create mode 100644 Rakefile create mode 100755 bin/console create mode 100755 bin/setup create mode 100644 lib/vmpooler/dns/google/clouddns.rb create mode 100644 lib/vmpooler/dns/google/clouddns/version.rb create mode 100644 sig/vmpooler/dns/google/clouddns.rbs create mode 100644 vmpooler-dns-google-clouddns.gemspec diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..782a4be --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,27 @@ +name: Ruby + +on: + push: + branches: + - initial-implementation + + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + name: Ruby ${{ matrix.ruby }} + strategy: + matrix: + ruby: + - '2.6.8' + + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Run the default task + run: bundle exec rake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9106b2a --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +/.bundle/ +/.yardoc +/_yardoc/ +/coverage/ +/doc/ +/pkg/ +/spec/reports/ +/tmp/ diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..e3462a7 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,13 @@ +AllCops: + TargetRubyVersion: 2.6 + +Style/StringLiterals: + Enabled: true + EnforcedStyle: double_quotes + +Style/StringLiteralsInInterpolation: + Enabled: true + EnforcedStyle: double_quotes + +Layout/LineLength: + Max: 120 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..3b42514 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +# Changelog + + + +\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)* diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..b923589 --- /dev/null +++ b/Gemfile @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +source "https://rubygems.org" + +# Specify your gem's dependencies in vmpooler-dns-google-clouddns.gemspec +gemspec + +gem "rake", "~> 13.0" + +gem "rubocop", "~> 1.21" diff --git a/README.md b/README.md index 42e2aef..b1277b1 100644 --- a/README.md +++ b/README.md @@ -1 +1,35 @@ -# vmpooler-dns-google-clouddns \ No newline at end of file +# Vmpooler::Dns::Google::Clouddns + +TODO: Delete this and the text below, and describe your gem + +Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/vmpooler/dns/google/clouddns`. To experiment with that code, run `bin/console` for an interactive prompt. + +## Installation + +TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org. + +Install the gem and add to the application's Gemfile by executing: + + $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG + +If bundler is not being used to manage dependencies, install the gem by executing: + + $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG + +## Usage + +TODO: Write usage instructions here + +## Development + +After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment. + +To install this gem onto your local machine, run `bundle exec rake install`. 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org). + +## Contributing + +Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/vmpooler-dns-google-clouddns. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/vmpooler-dns-google-clouddns/blob/initial-implementation/CODE_OF_CONDUCT.md). + +## Code of Conduct + +Everyone interacting in the Vmpooler::Dns::Google::Clouddns project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/vmpooler-dns-google-clouddns/blob/initial-implementation/CODE_OF_CONDUCT.md). diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..1924143 --- /dev/null +++ b/Rakefile @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +require "bundler/gem_tasks" +require "rubocop/rake_task" + +RuboCop::RakeTask.new + +task default: :rubocop diff --git a/bin/console b/bin/console new file mode 100755 index 0000000..677aabe --- /dev/null +++ b/bin/console @@ -0,0 +1,15 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +require "bundler/setup" +require "vmpooler/dns/google/clouddns" + +# You can add fixtures and/or initialization code here to make experimenting +# with your gem easier. You can also use a different console, if you like. + +# (If you use this, don't forget to add pry to your Gemfile!) +# require "pry" +# Pry.start + +require "irb" +IRB.start(__FILE__) diff --git a/bin/setup b/bin/setup new file mode 100755 index 0000000..dce67d8 --- /dev/null +++ b/bin/setup @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -euo pipefail +IFS=$'\n\t' +set -vx + +bundle install + +# Do any other automated setup that you need to do here diff --git a/lib/vmpooler/dns/google/clouddns.rb b/lib/vmpooler/dns/google/clouddns.rb new file mode 100644 index 0000000..6b9bf8b --- /dev/null +++ b/lib/vmpooler/dns/google/clouddns.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +require_relative "clouddns/version" + +module Vmpooler + module Dns + module Google + module Clouddns + class Error < StandardError; end + # Your code goes here... + end + end + end +end diff --git a/lib/vmpooler/dns/google/clouddns/version.rb b/lib/vmpooler/dns/google/clouddns/version.rb new file mode 100644 index 0000000..6cc436b --- /dev/null +++ b/lib/vmpooler/dns/google/clouddns/version.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +module Vmpooler + module Dns + module Google + module Clouddns + VERSION = "0.1.0" + end + end + end +end diff --git a/sig/vmpooler/dns/google/clouddns.rbs b/sig/vmpooler/dns/google/clouddns.rbs new file mode 100644 index 0000000..ee79317 --- /dev/null +++ b/sig/vmpooler/dns/google/clouddns.rbs @@ -0,0 +1,10 @@ +module Vmpooler + module Dns + module Google + module Clouddns + VERSION: String + # See the writing guide of rbs: https://github.com/ruby/rbs#guides + end + end + end +end diff --git a/vmpooler-dns-google-clouddns.gemspec b/vmpooler-dns-google-clouddns.gemspec new file mode 100644 index 0000000..9529191 --- /dev/null +++ b/vmpooler-dns-google-clouddns.gemspec @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +require_relative "lib/vmpooler/dns/google/clouddns/version" + +Gem::Specification.new do |spec| + spec.name = "vmpooler-dns-google-clouddns" + spec.version = Vmpooler::Dns::Google::Clouddns::VERSION + spec.authors = ["TODO: Write your name"] + spec.email = ["TODO: Write your email address"] + + spec.summary = "TODO: Write a short summary, because RubyGems requires one." + spec.description = "TODO: Write a longer description or delete this line." + spec.homepage = "TODO: Put your gem's website or public repo URL here." + spec.required_ruby_version = ">= 2.6.0" + + spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'" + + spec.metadata["homepage_uri"] = spec.homepage + spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here." + spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here." + + # Specify which files should be added to the gem when it is released. + # The `git ls-files -z` loads the files in the RubyGem that have been added into git. + spec.files = Dir.chdir(__dir__) do + `git ls-files -z`.split("\x0").reject do |f| + (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|circleci)|appveyor)}) + end + end + spec.bindir = "exe" + spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) } + spec.require_paths = ["lib"] + + # Uncomment to register a new dependency of your gem + # spec.add_dependency "example-gem", "~> 1.0" + + # For more information and examples about making a new gem, check out our + # guide at: https://bundler.io/guides/creating_gem.html +end From 4c366a7a79e2b0e3293f0d37c1053d9783a0c7b5 Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Mon, 30 Jan 2023 16:15:29 -0500 Subject: [PATCH 02/41] Add license --- LICENSE | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. From f6165999d187115124fa3e32693393757de4fc89 Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Mon, 30 Jan 2023 16:15:53 -0500 Subject: [PATCH 03/41] Add dependabot and standard workflows --- .github/dependabot.yml | 7 +++ .github/workflows/release.yml | 89 ++++++++++++++++++++++++++++++++++ .github/workflows/security.yml | 39 +++++++++++++++ .github/workflows/testing.yml | 48 ++++++++++++++++++ 4 files changed, 183 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/security.yml create mode 100644 .github/workflows/testing.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..81e0069 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: +- package-ecosystem: bundler + directory: "/" + schedule: + interval: weekly + open-pull-requests-limit: 10 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ff17b10 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,89 @@ +name: Release Gem + +on: workflow_dispatch + +jobs: + release: + runs-on: ubuntu-latest + if: github.repository == 'puppetlabs/vmpooler-dns-google-clouddns' + steps: + - uses: actions/checkout@v3 + + - name: Get Current Version + uses: actions/github-script@v6 + 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: | + version=$(grep VERSION lib/vmpooler-dns-google-clouddns/version.rb |rev |cut -d "'" -f2 |rev) + echo "version=$version" >> $GITHUB_OUTPUT + echo "Found version $version from lib/vmpooler-dns-google-clouddns/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.nv.outputs.version }} + token: ${{ secrets.GITHUB_TOKEN }} + bodyfile: release-notes.md + draft: false + prerelease: false + + # This step should closely match what is used in `docker/Dockerfile` in vmpooler-deployment + - name: Install Ruby jruby-9.3.6.0 + uses: ruby/setup-ruby@v1 + with: + ruby-version: 'jruby-9.3.6.0' + + - 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 }}' diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml new file mode 100644 index 0000000..666c602 --- /dev/null +++ b/.github/workflows/security.yml @@ -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 }} diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml new file mode 100644 index 0000000..86955f6 --- /dev/null +++ b/.github/workflows/testing.yml @@ -0,0 +1,48 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake +# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby + +name: Testing + +on: + pull_request: + branches: + - main + +jobs: + rubocop: + runs-on: ubuntu-latest + strategy: + matrix: + ruby-version: + - 'jruby-9.3.6.0' + - 'jruby-9.4.0.0' + 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 Rubocop + run: bundle exec rake rubocop + + spec_tests: + runs-on: ubuntu-latest + strategy: + matrix: + ruby-version: + - 'jruby-9.3.6.0' + - 'jruby-9.4.0.0' + 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 From 162c034e3278cc09223942ba8a491c589236af25 Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Mon, 30 Jan 2023 16:16:24 -0500 Subject: [PATCH 04/41] Add changelog generator and scripts to update files --- .github_changelog_generator | 3 +++ update-changelog | 5 +++++ update-gemfile-lock | 7 +++++++ 3 files changed, 15 insertions(+) create mode 100644 .github_changelog_generator create mode 100755 update-changelog create mode 100755 update-gemfile-lock diff --git a/.github_changelog_generator b/.github_changelog_generator new file mode 100644 index 0000000..b978ce8 --- /dev/null +++ b/.github_changelog_generator @@ -0,0 +1,3 @@ +project=vmpooler-dns-google-clouddns +user=puppetlabs +exclude_labels=maintenance \ No newline at end of file diff --git a/update-changelog b/update-changelog new file mode 100755 index 0000000..52abc15 --- /dev/null +++ b/update-changelog @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +docker run -it --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-dns-google-clouddns/version.rb |rev |cut -d "'" -f2 |rev) diff --git a/update-gemfile-lock b/update-gemfile-lock new file mode 100755 index 0000000..74e9c78 --- /dev/null +++ b/update-gemfile-lock @@ -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.3.6-jdk \ + /bin/bash -c 'apt-get update -qq && apt-get install -y --no-install-recommends make git && cd /app && gem install bundler && bundle install --jobs 3 && bundle update; echo "LOCK_FILE_UPDATE_EXIT_CODE=$?"' From 5787a82a0ba9b5e712245b5b058440038e71a83c Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Mon, 30 Jan 2023 16:18:49 -0500 Subject: [PATCH 05/41] Move version identifier and update gemfile and gemspec --- Gemfile | 15 +- Gemfile.lock | 208 ++++++++++++++++++++ lib/vmpooler-dns-google-clouddns/version.rb | 5 + lib/vmpooler/dns/google/clouddns/version.rb | 11 -- vmpooler-dns-google-clouddns.gemspec | 46 ++--- 5 files changed, 242 insertions(+), 43 deletions(-) create mode 100644 Gemfile.lock create mode 100644 lib/vmpooler-dns-google-clouddns/version.rb delete mode 100644 lib/vmpooler/dns/google/clouddns/version.rb diff --git a/Gemfile b/Gemfile index b923589..122d6b5 100644 --- a/Gemfile +++ b/Gemfile @@ -1,10 +1,13 @@ -# frozen_string_literal: true +source ENV['GEM_SOURCE'] || 'https://rubygems.org' -source "https://rubygems.org" - -# Specify your gem's dependencies in vmpooler-dns-google-clouddns.gemspec gemspec -gem "rake", "~> 13.0" +# Evaluate Gemfile.local if it exists +if File.exists? "#{__FILE__}.local" + instance_eval(File.read("#{__FILE__}.local")) +end -gem "rubocop", "~> 1.21" +# Evaluate ~/.gemfile if it exists +if File.exists?(File.join(Dir.home, '.gemfile')) + instance_eval(File.read(File.join(Dir.home, '.gemfile'))) +end diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..1680833 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,208 @@ +PATH + remote: . + specs: + vmpooler-dns-google-clouddns (0.1.0) + google-cloud-dns (~> 0.35.1) + googleauth (>= 0.16.2, < 1.3.0) + vmpooler (~> 2.3, >= 1.3.0) + +GEM + remote: https://rubygems.org/ + specs: + addressable (2.8.1) + public_suffix (>= 2.0.2, < 6.0) + ast (2.4.2) + bindata (2.4.14) + concurrent-ruby (1.2.0) + connection_pool (2.3.0) + declarative (0.0.20) + deep_merge (1.2.2) + diff-lcs (1.5.0) + docile (1.4.0) + faraday (2.7.4) + faraday-net_http (>= 2.0, < 3.1) + ruby2_keywords (>= 0.0.4) + faraday-net_http (3.0.2) + google-apis-core (0.10.0) + 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-apis-dns_v1 (0.29.0) + google-apis-core (>= 0.9.1, < 2.a) + google-cloud-core (1.6.0) + google-cloud-env (~> 1.0) + google-cloud-errors (~> 1.0) + google-cloud-dns (0.35.1) + google-apis-dns_v1 (~> 0.1) + google-cloud-core (~> 1.6) + googleauth (>= 0.16.2, < 2.a) + zonefile (~> 1.04) + google-cloud-env (1.6.0) + faraday (>= 0.17.3, < 3.0) + google-cloud-errors (1.3.0) + googleauth (1.2.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.6.0) + memoist (0.16.2) + mini_mime (1.1.2) + multi_json (1.15.0) + mustermann (2.0.2) + ruby2_keywords (~> 0.0.1) + net-ldap (0.17.1) + nio4r (2.5.8-java) + opentelemetry-api (1.1.0) + opentelemetry-common (0.19.6) + opentelemetry-api (~> 1.0) + opentelemetry-exporter-jaeger (0.20.1) + opentelemetry-api (~> 1.0) + opentelemetry-common (~> 0.19.2) + opentelemetry-sdk (~> 1.0) + thrift + opentelemetry-instrumentation-base (0.19.0) + opentelemetry-api (~> 1.0) + opentelemetry-instrumentation-concurrent_ruby (0.19.2) + opentelemetry-api (~> 1.0) + opentelemetry-instrumentation-base (~> 0.19.0) + opentelemetry-instrumentation-http_client (0.19.4) + opentelemetry-api (~> 1.0) + opentelemetry-common (~> 0.19.3) + opentelemetry-instrumentation-base (~> 0.19.0) + opentelemetry-instrumentation-redis (0.21.3) + opentelemetry-api (~> 1.0) + opentelemetry-common (~> 0.19.3) + opentelemetry-instrumentation-base (~> 0.19.0) + opentelemetry-instrumentation-sinatra (0.19.3) + opentelemetry-api (~> 1.0) + opentelemetry-common (~> 0.19.3) + opentelemetry-instrumentation-base (~> 0.19.0) + opentelemetry-registry (0.2.0) + opentelemetry-api (~> 1.1) + opentelemetry-resource_detectors (0.19.1) + google-cloud-env + opentelemetry-sdk + opentelemetry-sdk (1.2.0) + opentelemetry-api (~> 1.1) + opentelemetry-common (~> 0.19.3) + opentelemetry-registry (~> 0.2) + opentelemetry-semantic_conventions + opentelemetry-semantic_conventions (1.8.0) + opentelemetry-api (~> 1.0) + os (1.1.4) + parallel (1.22.1) + parser (3.2.0.0) + ast (~> 2.4.1) + pickup (0.0.11) + prometheus-client (2.1.0) + public_suffix (5.0.1) + puma (5.6.5-java) + nio4r (~> 2.0) + rack (2.2.6.2) + rack-protection (2.2.4) + rack + rainbow (3.1.1) + rake (13.0.6) + redis (4.8.0) + regexp_parser (2.6.2) + 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.5) + rspec (3.12.0) + rspec-core (~> 3.12.0) + rspec-expectations (~> 3.12.0) + rspec-mocks (~> 3.12.0) + rspec-core (3.12.0) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.12.0) + rspec-mocks (3.12.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.12.0) + rspec-support (3.12.0) + 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.24.1) + parser (>= 3.1.1.0) + ruby-progressbar (1.11.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 (2.2.4) + mustermann (~> 2.0) + rack (~> 2.2) + rack-protection (= 2.2.4) + tilt (~> 2.0) + spicy-proton (2.1.15) + bindata (~> 2.3) + statsd-ruby (1.5.0) + thrift (0.17.0) + tilt (2.0.11) + trailblazer-option (0.1.2) + uber (0.1.0) + unicode-display_width (1.8.0) + vmpooler (2.4.0) + concurrent-ruby (~> 1.1) + connection_pool (~> 2.2) + deep_merge (~> 1.2) + net-ldap (~> 0.16) + opentelemetry-exporter-jaeger (= 0.20.1) + opentelemetry-instrumentation-concurrent_ruby (= 0.19.2) + opentelemetry-instrumentation-http_client (= 0.19.4) + opentelemetry-instrumentation-redis (= 0.21.3) + opentelemetry-instrumentation-sinatra (= 0.19.3) + opentelemetry-resource_detectors (= 0.19.1) + opentelemetry-sdk (~> 1.0, >= 1.0.2) + pickup (~> 0.0.11) + prometheus-client (~> 2.0) + puma (~> 5.0, >= 5.0.4) + rack (~> 2.2) + rake (~> 13.0) + redis (~> 4.1) + sinatra (~> 2.0) + spicy-proton (~> 2.1) + statsd-ruby (~> 1.4) + webrick (1.8.1) + zonefile (1.06) + +PLATFORMS + universal-java-1.8 + universal-java-11 + +DEPENDENCIES + rspec (>= 3.2) + rubocop (~> 1.1.0) + simplecov (>= 0.11.2) + vmpooler-dns-google-clouddns! + +BUNDLED WITH + 2.4.5 diff --git a/lib/vmpooler-dns-google-clouddns/version.rb b/lib/vmpooler-dns-google-clouddns/version.rb new file mode 100644 index 0000000..fb3095a --- /dev/null +++ b/lib/vmpooler-dns-google-clouddns/version.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +module VmpoolerDnsGoogleClouddns + VERSION = '0.1.0' +end diff --git a/lib/vmpooler/dns/google/clouddns/version.rb b/lib/vmpooler/dns/google/clouddns/version.rb deleted file mode 100644 index 6cc436b..0000000 --- a/lib/vmpooler/dns/google/clouddns/version.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -module Vmpooler - module Dns - module Google - module Clouddns - VERSION = "0.1.0" - end - end - end -end diff --git a/vmpooler-dns-google-clouddns.gemspec b/vmpooler-dns-google-clouddns.gemspec index 9529191..5c0f10f 100644 --- a/vmpooler-dns-google-clouddns.gemspec +++ b/vmpooler-dns-google-clouddns.gemspec @@ -1,38 +1,32 @@ # frozen_string_literal: true -require_relative "lib/vmpooler/dns/google/clouddns/version" +lib = File.expand_path('../lib', __FILE__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) +require 'vmpooler-dns-google-clouddns/version' Gem::Specification.new do |spec| - spec.name = "vmpooler-dns-google-clouddns" - spec.version = Vmpooler::Dns::Google::Clouddns::VERSION - spec.authors = ["TODO: Write your name"] - spec.email = ["TODO: Write your email address"] + spec.name = "vmpooler-dns-google-clouddns" + spec.version = VmpoolerDnsGoogleClouddns::VERSION + spec.authors = ["Puppet by Perforce"] + spec.email = ["support@puppet.com"] - spec.summary = "TODO: Write a short summary, because RubyGems requires one." - spec.description = "TODO: Write a longer description or delete this line." - spec.homepage = "TODO: Put your gem's website or public repo URL here." - spec.required_ruby_version = ">= 2.6.0" - - spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'" + spec.summary = "Google Cloud DNS for VMPooler" + spec.homepage = "https://github.com/puppetlabs/vmpooler-dns-google-clouddns" + spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0') spec.metadata["homepage_uri"] = spec.homepage - spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here." - spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here." + spec.metadata["source_code_uri"] = spec.homepage + spec.metadata["changelog_uri"] = "https://github.com/puppetlabs/vmpooler-dns-google-clouddns/blob/main/CHANGELOG.md" # Specify which files should be added to the gem when it is released. - # The `git ls-files -z` loads the files in the RubyGem that have been added into git. - spec.files = Dir.chdir(__dir__) do - `git ls-files -z`.split("\x0").reject do |f| - (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|circleci)|appveyor)}) - end - end - spec.bindir = "exe" - spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) } + spec.files = Dir[ "lib/**/*" ] spec.require_paths = ["lib"] + spec.add_dependency "googleauth", ">= 0.16.2", "< 1.3.0" + spec.add_dependency "google-cloud-dns", "~> 0.35.1" + spec.add_dependency 'vmpooler', '>= 1.3.0', '~> 2.3' - # Uncomment to register a new dependency of your gem - # spec.add_dependency "example-gem", "~> 1.0" - - # For more information and examples about making a new gem, check out our - # guide at: https://bundler.io/guides/creating_gem.html + # Testing dependencies + spec.add_development_dependency 'rspec', '>= 3.2' + spec.add_development_dependency 'rubocop', '~> 1.1.0' + spec.add_development_dependency 'simplecov', '>= 0.11.2' end From 405b52b2e1f1abb5e7823951135a507b2107643f Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Mon, 30 Jan 2023 16:31:05 -0500 Subject: [PATCH 06/41] Add rakefile and rubocop config from other provider gems --- .jrubyrc | 2 ++ .rubocop.yml | 54 +++++++++++++++++++++++++++++++++++++++------ Rakefile | 27 ++++++++++++++++++----- spec/spec_helper.rb | 14 ++++++++++++ 4 files changed, 85 insertions(+), 12 deletions(-) create mode 100644 .jrubyrc create mode 100644 spec/spec_helper.rb diff --git a/.jrubyrc b/.jrubyrc new file mode 100644 index 0000000..e140581 --- /dev/null +++ b/.jrubyrc @@ -0,0 +1,2 @@ +# for simplecov to work in jruby, without this we are getting errors when debugging spec tests +debug.fullTrace=true diff --git a/.rubocop.yml b/.rubocop.yml index e3462a7..850e19f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,13 +1,53 @@ AllCops: - TargetRubyVersion: 2.6 + Include: + - 'lib/**/*.rb' + Exclude: + - 'scripts/**/*' + - 'spec/**/*' + - 'vendor/**/*' + - Gemfile + - Rakefile -Style/StringLiterals: +# These short variable names make sense as exceptions to the rule, but generally I think short variable names do hurt readability +Naming/MethodParameterName: + AllowedNames: + - vm + - dc + - s + - x + - f + +#new cops: +Lint/DuplicateRegexpCharacterClassElement: # (new in 1.1) Enabled: true - EnforcedStyle: double_quotes - -Style/StringLiteralsInInterpolation: +Lint/EmptyBlock: # (new in 1.1) Enabled: true - EnforcedStyle: double_quotes +Lint/ToEnumArguments: # (new in 1.1) + Enabled: true +Lint/UnmodifiedReduceAccumulator: # (new in 1.1) + Enabled: true +Style/ArgumentsForwarding: # (new in 1.1) + Enabled: false +Style/DocumentDynamicEvalDefinition: # (new in 1.1) + Enabled: true +Style/SwapValues: # (new in 1.1) + Enabled: false +#disabled + +Metrics/AbcSize: + Enabled: false +Metrics/ClassLength: + Enabled: false +Metrics/CyclomaticComplexity: + Enabled: false +Metrics/MethodLength: + Enabled: false +Metrics/PerceivedComplexity: + Enabled: false +Metrics/ParameterLists: + Enabled: false Layout/LineLength: - Max: 120 + Enabled: false +Metrics/BlockLength: + Enabled: false diff --git a/Rakefile b/Rakefile index 1924143..76d6a80 100644 --- a/Rakefile +++ b/Rakefile @@ -1,8 +1,25 @@ -# frozen_string_literal: true +require 'rspec/core/rake_task' -require "bundler/gem_tasks" -require "rubocop/rake_task" +rubocop_available = Gem::Specification::find_all_by_name('rubocop').any? +require 'rubocop/rake_task' if rubocop_available -RuboCop::RakeTask.new +desc 'Run rspec tests with coloring.' +RSpec::Core::RakeTask.new(:test) do |t| + t.rspec_opts = %w[--color --format documentation] + t.pattern = 'spec/' +end -task default: :rubocop +desc 'Run rspec tests and save JUnit output to results.xml.' +RSpec::Core::RakeTask.new(:junit) do |t| + t.rspec_opts = %w[-r yarjuf -f JUnit -o results.xml] + t.pattern = 'spec/' +end + +if rubocop_available + desc 'Run RuboCop' + RuboCop::RakeTask.new(:rubocop) do |task| + task.options << '--display-cop-names' + end +end + +task :default => [:test] diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..4cc72cf --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +require 'simplecov' +SimpleCov.start do + add_filter '/spec/' +end + +def project_root_dir + File.dirname(File.dirname(__FILE__)) +end + +def fixtures_dir + File.join(project_root_dir, 'spec', 'fixtures') +end \ No newline at end of file From a7eb48d0b717caad0fbc58d6876c7e7795b3fe91 Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Mon, 30 Jan 2023 16:42:42 -0500 Subject: [PATCH 07/41] Remove bin files --- bin/console | 15 --------------- bin/setup | 8 -------- 2 files changed, 23 deletions(-) delete mode 100755 bin/console delete mode 100755 bin/setup diff --git a/bin/console b/bin/console deleted file mode 100755 index 677aabe..0000000 --- a/bin/console +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env ruby -# frozen_string_literal: true - -require "bundler/setup" -require "vmpooler/dns/google/clouddns" - -# You can add fixtures and/or initialization code here to make experimenting -# with your gem easier. You can also use a different console, if you like. - -# (If you use this, don't forget to add pry to your Gemfile!) -# require "pry" -# Pry.start - -require "irb" -IRB.start(__FILE__) diff --git a/bin/setup b/bin/setup deleted file mode 100755 index dce67d8..0000000 --- a/bin/setup +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail -IFS=$'\n\t' -set -vx - -bundle install - -# Do any other automated setup that you need to do here From 22873d4c1ac422e35b0976a2b05320bd07a69584 Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Mon, 30 Jan 2023 16:45:02 -0500 Subject: [PATCH 08/41] Rename/relocate clouddns to match other providers --- lib/vmpooler/dns/google/clouddns.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/vmpooler/dns/google/clouddns.rb b/lib/vmpooler/dns/google/clouddns.rb index 6b9bf8b..92a91c3 100644 --- a/lib/vmpooler/dns/google/clouddns.rb +++ b/lib/vmpooler/dns/google/clouddns.rb @@ -1,13 +1,15 @@ # frozen_string_literal: true -require_relative "clouddns/version" +require 'googleauth' +require 'google/cloud/dns' module Vmpooler - module Dns - module Google - module Clouddns - class Error < StandardError; end - # Your code goes here... + class PoolManager + class Dns + class Google + class Clouddns + # Your code goes here... + end end end end From ecff3e10aafa3bb0b6136bd46145012776659aa4 Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Mon, 30 Jan 2023 16:45:18 -0500 Subject: [PATCH 09/41] Copy release instructions to the readme --- README.md | 44 ++++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index b1277b1..6e6534d 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,31 @@ -# Vmpooler::Dns::Google::Clouddns +# vmpooler-dns-google-clouddns -TODO: Delete this and the text below, and describe your gem - -Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/vmpooler/dns/google/clouddns`. To experiment with that code, run `bin/console` for an interactive prompt. - -## Installation - -TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org. - -Install the gem and add to the application's Gemfile by executing: - - $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG - -If bundler is not being used to manage dependencies, install the gem by executing: - - $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG +- [vmpooler-dns-google-clouddns](#vmpooler-dns-google-clouddns) + - [Usage](#usage) + - [Update the Gemfile Lock](#update-the-gemfile-lock) + - [Releasing](#releasing) + - [License](#license) ## Usage -TODO: Write usage instructions here +Examples of deploying VMPooler with extra providers can be found in the [puppetlabs/vmpooler-deployment](https://github.com/puppetlabs/vmpooler-deployment) repository. -## Development +## Update the Gemfile Lock -After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment. +To update the `Gemfile.lock` run `./update-gemfile-lock`. -To install this gem onto your local machine, run `bundle exec rake install`. 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 the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org). +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). -## Contributing +## Releasing -Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/vmpooler-dns-google-clouddns. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/vmpooler-dns-google-clouddns/blob/initial-implementation/CODE_OF_CONDUCT.md). +Follow these steps to publish a new GitHub release, and build and push the gem to . -## Code of Conduct +1. Bump the "VERSION" in `lib/vmpooler-dns-google-clouddns/version.rb` appropriately based on changes in `CHANGELOG.md` since the last release. +2. Run `./update-gemfile-lock` to update `Gemfile.lock`. +3. Run `./update-changelog` to update `CHANGELOG.md`. +4. Commit and push changes to a new branch, then open a pull request against `main` and be sure to add the "maintenance" label. +5. After the pull request is approved and merged, then navigate to Actions --> Release Gem --> run workflow --> Branch: main --> Run workflow. -Everyone interacting in the Vmpooler::Dns::Google::Clouddns project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/vmpooler-dns-google-clouddns/blob/initial-implementation/CODE_OF_CONDUCT.md). +## License + +vmpooler-dns-google-clouddns is distributed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html). See the [LICENSE](LICENSE) file for more details. From 2ff6e599322bbc9ba0adc73bfa4a5b96a46eda87 Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Mon, 30 Jan 2023 16:54:44 -0500 Subject: [PATCH 10/41] Remove default workflow --- .github/workflows/main.yml | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 782a4be..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Ruby - -on: - push: - branches: - - initial-implementation - - pull_request: - -jobs: - build: - runs-on: ubuntu-latest - name: Ruby ${{ matrix.ruby }} - strategy: - matrix: - ruby: - - '2.6.8' - - steps: - - uses: actions/checkout@v3 - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true - - name: Run the default task - run: bundle exec rake From 1c0b560a67cac540ae6289172c3ca75b02104466 Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Tue, 18 Apr 2023 12:20:52 -0400 Subject: [PATCH 11/41] Rename remove email --- .github/workflows/release.yml | 6 +++--- .github_changelog_generator | 4 ++-- Gemfile.lock | 4 ++-- README.md | 8 ++++---- .../version.rb | 2 +- lib/vmpooler/dns/{google => gcp}/clouddns.rb | 2 +- update-changelog | 2 +- ...oogle-clouddns.gemspec => vmpooler-dns-gcp.gemspec | 11 +++++------ 8 files changed, 19 insertions(+), 20 deletions(-) rename lib/{vmpooler-dns-google-clouddns => vmpooler-dns-gcp}/version.rb (62%) rename lib/vmpooler/dns/{google => gcp}/clouddns.rb (92%) rename vmpooler-dns-google-clouddns.gemspec => vmpooler-dns-gcp.gemspec (75%) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ff17b10..a1a9dc7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,7 +5,7 @@ on: workflow_dispatch jobs: release: runs-on: ubuntu-latest - if: github.repository == 'puppetlabs/vmpooler-dns-google-clouddns' + if: github.repository == 'puppetlabs/vmpooler-dns-gcp' steps: - uses: actions/checkout@v3 @@ -25,9 +25,9 @@ jobs: - name: Get Next Version id: nv run: | - version=$(grep VERSION lib/vmpooler-dns-google-clouddns/version.rb |rev |cut -d "'" -f2 |rev) + version=$(grep VERSION lib/vmpooler-dns-gcp/version.rb |rev |cut -d "'" -f2 |rev) echo "version=$version" >> $GITHUB_OUTPUT - echo "Found version $version from lib/vmpooler-dns-google-clouddns/version.rb" + echo "Found version $version from lib/vmpooler-dns-gcp/version.rb" - name: Generate Changelog uses: docker://githubchangeloggenerator/github-changelog-generator:1.16.2 diff --git a/.github_changelog_generator b/.github_changelog_generator index b978ce8..411780b 100644 --- a/.github_changelog_generator +++ b/.github_changelog_generator @@ -1,3 +1,3 @@ -project=vmpooler-dns-google-clouddns +project=vmpooler-dns-gcp user=puppetlabs -exclude_labels=maintenance \ No newline at end of file +exclude_labels=maintenance diff --git a/Gemfile.lock b/Gemfile.lock index 1680833..66d3ad3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - vmpooler-dns-google-clouddns (0.1.0) + vmpooler-dns-gcp (0.1.0) google-cloud-dns (~> 0.35.1) googleauth (>= 0.16.2, < 1.3.0) vmpooler (~> 2.3, >= 1.3.0) @@ -202,7 +202,7 @@ DEPENDENCIES rspec (>= 3.2) rubocop (~> 1.1.0) simplecov (>= 0.11.2) - vmpooler-dns-google-clouddns! + vmpooler-dns-gcp! BUNDLED WITH 2.4.5 diff --git a/README.md b/README.md index 6e6534d..0e29595 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# vmpooler-dns-google-clouddns +# vmpooler-dns-gcp -- [vmpooler-dns-google-clouddns](#vmpooler-dns-google-clouddns) +- [vmpooler-dns-gcp](#vmpooler-dns-gcp) - [Usage](#usage) - [Update the Gemfile Lock](#update-the-gemfile-lock) - [Releasing](#releasing) @@ -20,7 +20,7 @@ Verify, and update if needed, that the docker tag in the script and GitHub actio Follow these steps to publish a new GitHub release, and build and push the gem to . -1. Bump the "VERSION" in `lib/vmpooler-dns-google-clouddns/version.rb` appropriately based on changes in `CHANGELOG.md` since the last release. +1. Bump the "VERSION" in `lib/vmpooler-dns-gcp/version.rb` appropriately based on changes in `CHANGELOG.md` since the last release. 2. Run `./update-gemfile-lock` to update `Gemfile.lock`. 3. Run `./update-changelog` to update `CHANGELOG.md`. 4. Commit and push changes to a new branch, then open a pull request against `main` and be sure to add the "maintenance" label. @@ -28,4 +28,4 @@ Follow these steps to publish a new GitHub release, and build and push the gem t ## License -vmpooler-dns-google-clouddns is distributed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html). See the [LICENSE](LICENSE) file for more details. +vmpooler-dns-gcp is distributed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html). See the [LICENSE](LICENSE) file for more details. diff --git a/lib/vmpooler-dns-google-clouddns/version.rb b/lib/vmpooler-dns-gcp/version.rb similarity index 62% rename from lib/vmpooler-dns-google-clouddns/version.rb rename to lib/vmpooler-dns-gcp/version.rb index fb3095a..c38e817 100644 --- a/lib/vmpooler-dns-google-clouddns/version.rb +++ b/lib/vmpooler-dns-gcp/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module VmpoolerDnsGoogleClouddns +module VmpoolerDnsGcp VERSION = '0.1.0' end diff --git a/lib/vmpooler/dns/google/clouddns.rb b/lib/vmpooler/dns/gcp/clouddns.rb similarity index 92% rename from lib/vmpooler/dns/google/clouddns.rb rename to lib/vmpooler/dns/gcp/clouddns.rb index 92a91c3..62b597c 100644 --- a/lib/vmpooler/dns/google/clouddns.rb +++ b/lib/vmpooler/dns/gcp/clouddns.rb @@ -6,7 +6,7 @@ require 'google/cloud/dns' module Vmpooler class PoolManager class Dns - class Google + class Gcp class Clouddns # Your code goes here... end diff --git a/update-changelog b/update-changelog index 52abc15..9f3ec69 100755 --- a/update-changelog +++ b/update-changelog @@ -2,4 +2,4 @@ docker run -it --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-dns-google-clouddns/version.rb |rev |cut -d "'" -f2 |rev) + github_changelog_generator --future-release $(grep VERSION lib/vmpooler-dns-gcp/version.rb |rev |cut -d "'" -f2 |rev) diff --git a/vmpooler-dns-google-clouddns.gemspec b/vmpooler-dns-gcp.gemspec similarity index 75% rename from vmpooler-dns-google-clouddns.gemspec rename to vmpooler-dns-gcp.gemspec index 5c0f10f..9a7a44c 100644 --- a/vmpooler-dns-google-clouddns.gemspec +++ b/vmpooler-dns-gcp.gemspec @@ -2,21 +2,20 @@ lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -require 'vmpooler-dns-google-clouddns/version' +require 'vmpooler-dns-gcp/version' Gem::Specification.new do |spec| - spec.name = "vmpooler-dns-google-clouddns" - spec.version = VmpoolerDnsGoogleClouddns::VERSION + spec.name = "vmpooler-dns-gcp" + spec.version = VmpoolerDnsGcp::VERSION spec.authors = ["Puppet by Perforce"] - spec.email = ["support@puppet.com"] spec.summary = "Google Cloud DNS for VMPooler" - spec.homepage = "https://github.com/puppetlabs/vmpooler-dns-google-clouddns" + spec.homepage = "https://github.com/puppetlabs/vmpooler-dns-gcp" spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0') spec.metadata["homepage_uri"] = spec.homepage spec.metadata["source_code_uri"] = spec.homepage - spec.metadata["changelog_uri"] = "https://github.com/puppetlabs/vmpooler-dns-google-clouddns/blob/main/CHANGELOG.md" + spec.metadata["changelog_uri"] = "https://github.com/puppetlabs/vmpooler-dns-gcp/blob/main/CHANGELOG.md" # Specify which files should be added to the gem when it is released. spec.files = Dir[ "lib/**/*" ] From d4bbd086aec2aefd1249c6d8ff4f26a713e24bc7 Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Fri, 3 Feb 2023 17:03:33 -0500 Subject: [PATCH 12/41] Very rough working example --- lib/vmpooler/dns/gcp/clouddns.rb | 79 +++++++++++++++++++++++++++++++- 1 file changed, 77 insertions(+), 2 deletions(-) diff --git a/lib/vmpooler/dns/gcp/clouddns.rb b/lib/vmpooler/dns/gcp/clouddns.rb index 62b597c..d3f6c31 100644 --- a/lib/vmpooler/dns/gcp/clouddns.rb +++ b/lib/vmpooler/dns/gcp/clouddns.rb @@ -7,8 +7,83 @@ module Vmpooler class PoolManager class Dns class Gcp - class Clouddns - # Your code goes here... + # This class represent a DNS plugin to CRUD resources in google clouddns. + class Clouddns < Vmpooler::PoolManager::Dns::Base + # The connection_pool method is normally used only for testing + attr_reader :connection_pool + + def initialize(config, logger, metrics, redis_connection_pool, name, options) + super(config, logger, metrics, redis_connection_pool, name, options) + + task_limit = global_config[:config].nil? || global_config[:config]['task_limit'].nil? ? 10 : global_config[:config]['task_limit'].to_i + + default_connpool_size = [provided_pools.count, task_limit, 2].max + # connpool_size = provider_config['connection_pool_size'].nil? ? default_connpool_size : provider_config['connection_pool_size'].to_i + connpool_timeout = 60 + # logger.log('d', "[#{name}] ConnPool - Creating a connection pool of size #{connpool_size} with timeout #{connpool_timeout}") + logger.log('d', "[#{name}] ConnPool - Creating a connection pool of size #{default_connpool_size} with timeout #{connpool_timeout}") + @connection_pool = Vmpooler::PoolManager::GenericConnectionPool.new( + metrics: metrics, + connpool_type: 'dns_connection_pool', + connpool_provider: name, + size: default_connpool_size, + # size: connpool_size, + timeout: connpool_timeout + ) do + logger.log('d', "[#{name}] Connection Pool - Creating a connection object") + # Need to wrap the vSphere connection object in another object. The generic connection pooler will preserve + # the object reference for the connection, which means it cannot "reconnect" by creating an entirely new connection + # object. Instead by wrapping it in a Hash, the Hash object reference itself never changes but the content of the + # Hash can change, and is preserved across invocations. + new_conn = connect_to_gcp + { connection: new_conn } + end + end + + def name + 'gcp-clouddns' + end + + def create_or_replace_record(hostname) + ip = get_ip(hostname) + connection.zone('vmpooler-example-com').add(hostname, 'A', 60, ip) + end + + def connection + @connection_pool.with_metrics do |pool_object| + return ensured_gcp_connection(pool_object) + end + end + + def ensured_gcp_connection(connection_pool_object) + connection_pool_object[:connection] = connect_to_gcp unless connection_pool_object[:connection] + connection_pool_object[:connection] + end + + def connect_to_gcp + max_tries = global_config[:config]['max_tries'] || 3 + retry_factor = global_config[:config]['retry_factor'] || 10 + try = 1 + begin + scopes = ['https://www.googleapis.com/auth/cloud-platform'] + + Google::Auth.get_application_default(scopes) + + dns = Google::Cloud::Dns.new + # dns.authorization = authorization + + metrics.increment('connect.open') + dns + rescue StandardError => e + metrics.increment('connect.fail') + raise e if try >= max_tries + + sleep(try * retry_factor) + try += 1 + retry + end + end + end end end From ad57ae053fba8e7c8112aa1c18ec93052fcae383 Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Tue, 7 Feb 2023 06:40:57 -0500 Subject: [PATCH 13/41] Add delete record --- lib/vmpooler/dns/gcp/clouddns.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/vmpooler/dns/gcp/clouddns.rb b/lib/vmpooler/dns/gcp/clouddns.rb index d3f6c31..97377ba 100644 --- a/lib/vmpooler/dns/gcp/clouddns.rb +++ b/lib/vmpooler/dns/gcp/clouddns.rb @@ -49,6 +49,16 @@ module Vmpooler connection.zone('vmpooler-example-com').add(hostname, 'A', 60, ip) end + def delete_record(hostname) + retries = 0 + connection.zone('vmpooler-example-com').remove(hostname, 'A') + rescue Google::Cloud::FailedPreconditionError => e + # this error was experienced intermittently, will retry to see if it can complete successfully + # the error is Google::Cloud::FailedPreconditionError: conditionNotMet: Precondition not met for 'entity.change.deletions[1]' + sleep 5 + retry if (retries += 1) < 30 + end + def connection @connection_pool.with_metrics do |pool_object| return ensured_gcp_connection(pool_object) From cbb3ad3904e462abca4f277b550df06cb0180244 Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Tue, 7 Feb 2023 07:29:17 -0500 Subject: [PATCH 14/41] Get zone from config --- lib/vmpooler/dns/gcp/clouddns.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/vmpooler/dns/gcp/clouddns.rb b/lib/vmpooler/dns/gcp/clouddns.rb index 97377ba..48232c1 100644 --- a/lib/vmpooler/dns/gcp/clouddns.rb +++ b/lib/vmpooler/dns/gcp/clouddns.rb @@ -44,14 +44,19 @@ module Vmpooler 'gcp-clouddns' end + # main configuration options + def zone_name + dns_config['zone_name'] + end + def create_or_replace_record(hostname) ip = get_ip(hostname) - connection.zone('vmpooler-example-com').add(hostname, 'A', 60, ip) + connection.zone(zone_name).add(hostname, 'A', 60, ip) end def delete_record(hostname) retries = 0 - connection.zone('vmpooler-example-com').remove(hostname, 'A') + connection.zone(zone_name).remove(hostname, 'A') rescue Google::Cloud::FailedPreconditionError => e # this error was experienced intermittently, will retry to see if it can complete successfully # the error is Google::Cloud::FailedPreconditionError: conditionNotMet: Precondition not met for 'entity.change.deletions[1]' From 9bef22abe6fe452cfb2cc4853cdbeecd66dd914c Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Fri, 10 Feb 2023 08:24:02 -0500 Subject: [PATCH 15/41] Fix auth --- lib/vmpooler/dns/gcp/clouddns.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/vmpooler/dns/gcp/clouddns.rb b/lib/vmpooler/dns/gcp/clouddns.rb index 48232c1..e65643c 100644 --- a/lib/vmpooler/dns/gcp/clouddns.rb +++ b/lib/vmpooler/dns/gcp/clouddns.rb @@ -45,6 +45,10 @@ module Vmpooler end # main configuration options + def project + dns_config['project'] + end + def zone_name dns_config['zone_name'] end @@ -80,12 +84,11 @@ module Vmpooler retry_factor = global_config[:config]['retry_factor'] || 10 try = 1 begin - scopes = ['https://www.googleapis.com/auth/cloud-platform'] - - Google::Auth.get_application_default(scopes) + Google::Cloud::Dns.configure do |config| + config.project_id = project + end dns = Google::Cloud::Dns.new - # dns.authorization = authorization metrics.increment('connect.open') dns From 103a73b298a28d36ad86181794929e0ac5bb694f Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Wed, 22 Feb 2023 11:56:07 -0500 Subject: [PATCH 16/41] Fix rubocops --- lib/vmpooler/dns/gcp/clouddns.rb | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/lib/vmpooler/dns/gcp/clouddns.rb b/lib/vmpooler/dns/gcp/clouddns.rb index e65643c..476da08 100644 --- a/lib/vmpooler/dns/gcp/clouddns.rb +++ b/lib/vmpooler/dns/gcp/clouddns.rb @@ -44,8 +44,8 @@ module Vmpooler 'gcp-clouddns' end - # main configuration options - def project + # main configuration options + def project dns_config['project'] end @@ -55,7 +55,18 @@ module Vmpooler def create_or_replace_record(hostname) ip = get_ip(hostname) - connection.zone(zone_name).add(hostname, 'A', 60, ip) + begin + change = connection.zone(zone_name).add(hostname, 'A', 60, ip) + debug_logger("#{change.id} - #{change.started_at} - #{change.status} DNS address added") if change + rescue Google::Cloud::AlreadyExistsError => _e + # the error is Google::Cloud::AlreadyExistsError: alreadyExists: The resource 'entity.change.additions[0]' named 'instance-8.test.vmpooler.net. (A)' already exists + # the error is Google::Cloud::AlreadyExistsError: alreadyExists: The resource 'entity.change.additions[0]' named 'instance-8.test.vmpooler.net. (A)' already exists + change = connection.zone(zone_name).replace(hostname, 'A', 60, ip) + debug_logger("#{change.id} - #{change.started_at} - #{change.status} DNS address previously existed and was replaced") if change + rescue Google::Cloud::FailedPreconditionError => e + debug_logger("DNS create failed, retrying error: #{e}") + retry if (retries += 1) < 30 + end end def delete_record(hostname) @@ -64,6 +75,7 @@ module Vmpooler rescue Google::Cloud::FailedPreconditionError => e # this error was experienced intermittently, will retry to see if it can complete successfully # the error is Google::Cloud::FailedPreconditionError: conditionNotMet: Precondition not met for 'entity.change.deletions[1]' + debug_logger("GCP DNS delete_record failed, retrying error: #{e}") sleep 5 retry if (retries += 1) < 30 end @@ -87,21 +99,28 @@ module Vmpooler Google::Cloud::Dns.configure do |config| config.project_id = project end - + dns = Google::Cloud::Dns.new - + metrics.increment('connect.open') dns rescue StandardError => e metrics.increment('connect.fail') raise e if try >= max_tries - + sleep(try * retry_factor) try += 1 retry end end + # used in local dev environment, set DEBUG_FLAG=true + # this way the upstream vmpooler manager does not get polluted with logs + def debug_logger(message, send_to_upstream: false) + # the default logger is simple and does not enforce debug levels (the first argument) + puts message if ENV['DEBUG_FLAG'] + logger.log('[g]', message) if send_to_upstream + end end end end From fb8c1687518e82f404c21e05080ffa0f3e4fae4f Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Thu, 23 Feb 2023 08:37:33 -0500 Subject: [PATCH 17/41] Add rspec tests --- lib/vmpooler/dns/gcp/clouddns.rb | 54 ++++-- spec/clouddns_helper.rb | 26 +++ spec/helpers.rb | 14 ++ spec/spec_helper.rb | 6 + spec/unit/dns/clouddns_spec.rb | 294 +++++++++++++++++++++++++++++++ vmpooler-dns-gcp.gemspec | 1 + 6 files changed, 376 insertions(+), 19 deletions(-) create mode 100644 spec/clouddns_helper.rb create mode 100644 spec/helpers.rb create mode 100644 spec/unit/dns/clouddns_spec.rb diff --git a/lib/vmpooler/dns/gcp/clouddns.rb b/lib/vmpooler/dns/gcp/clouddns.rb index 476da08..3db831e 100644 --- a/lib/vmpooler/dns/gcp/clouddns.rb +++ b/lib/vmpooler/dns/gcp/clouddns.rb @@ -2,6 +2,7 @@ require 'googleauth' require 'google/cloud/dns' +require 'vmpooler/dns/base' module Vmpooler class PoolManager @@ -54,30 +55,38 @@ module Vmpooler end def create_or_replace_record(hostname) + retries = 0 ip = get_ip(hostname) - begin - change = connection.zone(zone_name).add(hostname, 'A', 60, ip) - debug_logger("#{change.id} - #{change.started_at} - #{change.status} DNS address added") if change - rescue Google::Cloud::AlreadyExistsError => _e - # the error is Google::Cloud::AlreadyExistsError: alreadyExists: The resource 'entity.change.additions[0]' named 'instance-8.test.vmpooler.net. (A)' already exists - # the error is Google::Cloud::AlreadyExistsError: alreadyExists: The resource 'entity.change.additions[0]' named 'instance-8.test.vmpooler.net. (A)' already exists - change = connection.zone(zone_name).replace(hostname, 'A', 60, ip) - debug_logger("#{change.id} - #{change.started_at} - #{change.status} DNS address previously existed and was replaced") if change - rescue Google::Cloud::FailedPreconditionError => e - debug_logger("DNS create failed, retrying error: #{e}") - retry if (retries += 1) < 30 + if ip.nil? + debug_logger("An IP Address was not recorded for #{hostname}") + else + begin + change = connection.zone(zone_name).add(hostname, 'A', 60, ip) + debug_logger("#{change.id} - #{change.started_at} - #{change.status} DNS address added") if change + rescue Google::Cloud::AlreadyExistsError => _e + # the error is Google::Cloud::AlreadyExistsError: alreadyExists: The resource 'entity.change.additions[0]' named 'instance-8.test.vmpooler.net. (A)' already exists + # the error is Google::Cloud::AlreadyExistsError: alreadyExists: The resource 'entity.change.additions[0]' named 'instance-8.test.vmpooler.net. (A)' already exists + change = connection.zone(zone_name).replace(hostname, 'A', 60, ip) + debug_logger("#{change.id} - #{change.started_at} - #{change.status} DNS address previously existed and was replaced") if change + rescue Google::Cloud::FailedPreconditionError => e + debug_logger("DNS create failed, retrying error: #{e}") + sleep 5 + retry if (retries += 1) < 30 + end end end def delete_record(hostname) retries = 0 - connection.zone(zone_name).remove(hostname, 'A') - rescue Google::Cloud::FailedPreconditionError => e - # this error was experienced intermittently, will retry to see if it can complete successfully - # the error is Google::Cloud::FailedPreconditionError: conditionNotMet: Precondition not met for 'entity.change.deletions[1]' - debug_logger("GCP DNS delete_record failed, retrying error: #{e}") - sleep 5 - retry if (retries += 1) < 30 + begin + connection.zone(zone_name).remove(hostname, 'A') + rescue Google::Cloud::FailedPreconditionError => e + # this error was experienced intermittently, will retry to see if it can complete successfully + # the error is Google::Cloud::FailedPreconditionError: conditionNotMet: Precondition not met for 'entity.change.deletions[1]' + debug_logger("GCP DNS delete_record failed, retrying error: #{e}") + sleep 5 + retry if (retries += 1) < 30 + end end def connection @@ -87,10 +96,17 @@ module Vmpooler end def ensured_gcp_connection(connection_pool_object) - connection_pool_object[:connection] = connect_to_gcp unless connection_pool_object[:connection] + connection_pool_object[:connection] = connect_to_gcp unless gcp_connection_ok?(connection_pool_object[:connection]) connection_pool_object[:connection] end + def gcp_connection_ok?(connection) + _result = connection.id + true + rescue StandardError + false + end + def connect_to_gcp max_tries = global_config[:config]['max_tries'] || 3 retry_factor = global_config[:config]['retry_factor'] || 10 diff --git a/spec/clouddns_helper.rb b/spec/clouddns_helper.rb new file mode 100644 index 0000000..9d072d8 --- /dev/null +++ b/spec/clouddns_helper.rb @@ -0,0 +1,26 @@ +MockDnsZone = Struct.new( + # https://github.com/googleapis/google-cloud-ruby/blob/main/google-cloud-dns/lib/google/cloud/dns/zone.rb + :service, :gapi, :id, :name, :dns, :description, :name_servers, :name_server_set, :created_at +) do + def add(name, type, ttl, data) + change = MockDnsChange.new + change.additions(name, type, ttl, data) + # return name + end +end + +# -------------------- +# Main GoogleCloudDnsProject Object +# -------------------- +MockGoogleCloudDnsProjectConnection = Struct.new( + # https://cloud.google.com/ruby/docs/reference/google-cloud-dns/latest/Google-Cloud#Google__Cloud_dns_instance_ + :scope, :retries, :timeout +) do + def zone + MockDnsZone.new + end +end + +def mock_Google_Cloud_Dns_Project_Connection(options = {}) + MockGoogleCloudDnsProjectConnection.new() +end \ No newline at end of file diff --git a/spec/helpers.rb b/spec/helpers.rb new file mode 100644 index 0000000..478a869 --- /dev/null +++ b/spec/helpers.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +require 'mock_redis' + +def redis + @redis ||= MockRedis.new + @redis +end + +# Mock an object which represents a Logger. This stops the proliferation +# of allow(logger).to .... expectations in tests. +class MockLogger + def log(_level, string); end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 4cc72cf..8693400 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,6 +4,12 @@ require 'simplecov' SimpleCov.start do add_filter '/spec/' end +require 'helpers' +require 'rspec' +require 'vmpooler' +require 'redis' +require 'vmpooler/metrics' +require 'clouddns_helper' def project_root_dir File.dirname(File.dirname(__FILE__)) diff --git a/spec/unit/dns/clouddns_spec.rb b/spec/unit/dns/clouddns_spec.rb new file mode 100644 index 0000000..cba2f23 --- /dev/null +++ b/spec/unit/dns/clouddns_spec.rb @@ -0,0 +1,294 @@ +require 'spec_helper' +require 'mock_redis' +require 'vmpooler/dns/gcp/clouddns' + +describe 'Vmpooler::PoolManager::Dns::Gcp' do + let(:logger) { MockLogger.new } + let(:metrics) { Vmpooler::Metrics::DummyStatsd.new } + let(:poolname) { 'debian-9' } + let(:options) { { 'param' => 'value' } } + let(:name) { 'gcp' } + let(:zone_name) { 'vmpooler-example-com' } + let(:config) { YAML.load(<<~EOT + --- + :config: + max_tries: 3 + retry_factor: 10 + :dns_configs: + :#{name}: + dns_class: gcp-clouddns + project: vmpooler-example + domain: vmpooler.example.com + zone_name: vmpooler-example-com + dns_zone_resource_name: vmpooler-example-com + :providers: + :dummy: + filename: '/tmp/dummy-backing.yaml' + :pools: + - name: '#{poolname}' + alias: [ 'mockpool' ] + template: 'Templates/debian-9-x86_64' + size: 5 + timeout: 10 + ready_ttl: 1440 + provider: 'dummy' + dns_config: '#{name}' +EOT + ) + } + + let(:vmname) { 'spicy-proton' } + let(:connection_options) {{}} + let(:connection) { mock_Google_Cloud_Dns_Project_Connection(connection_options) } + let(:redis_connection_pool) do + Vmpooler::PoolManager::GenericConnectionPool.new( + metrics: metrics, + connpool_type: 'redis_connection_pool', + connpool_provider: 'testprovider', + size: 1, + timeout: 5 + ) { MockRedis.new } + end + + subject { Vmpooler::PoolManager::Dns::Gcp::Clouddns.new(config, logger, metrics, redis_connection_pool, name, options) } + + describe '#name' do + it 'should be gcp-clouddns' do + expect(subject.name).to eq('gcp-clouddns') + end + end + + describe '#project' do + it 'should be the project specified in the dns config' do + expect(subject.project).to eq('vmpooler-example') + end + end + + describe '#zone_name' do + it 'should be the zone_name specified in the dns config' do + expect(subject.zone_name).to eq('vmpooler-example-com') + end + end + + describe '#create_or_replace_record' do + let(:hostname) { 'spicy-proton' } + let(:zone) { MockDnsZone.new } + let(:ip) { '169.254.255.255' } + + context 'when adding a record' do + before(:each) do + allow(Google::Cloud::Dns).to receive(:configure) + allow(Google::Cloud::Dns).to receive(:new).and_return(connection) + allow(connection).to receive(:zone).and_return(zone) + allow(subject).to receive(:get_ip).and_return(ip) + end + + it 'should attempt to add a record' do + expect(zone).to receive(:add).with(hostname, 'A', 60, ip) + result = subject.create_or_replace_record(hostname) + end + end + + context 'when record already exists' do + before(:each) do + allow(Google::Cloud::Dns).to receive(:configure) + allow(Google::Cloud::Dns).to receive(:new).and_return(connection) + allow(connection).to receive(:zone).and_return(zone) + allow(subject).to receive(:get_ip).and_return(ip) + end + + it 'should attempt to replace a record' do + allow(zone).to receive(:add).with(:hostname, 'A', 60, ip).and_raise(Google::Cloud::AlreadyExistsError,'MockError') + expect(zone).to receive(:replace).with(:hostname, 'A', 60, ip) + allow(subject).to receive(:get_ip).and_return(ip) + result = subject.create_or_replace_record(:hostname) + end + end + + context 'when add record fails' do + before(:each) do + allow(Google::Cloud::Dns).to receive(:configure) + allow(Google::Cloud::Dns).to receive(:new).and_return(connection) + allow(connection).to receive(:zone).and_return(zone) + allow(subject).to receive(:get_ip).and_return(ip) + end + + it 'should retry' do + allow(zone).to receive(:add).with(:hostname, 'A', 60, ip).and_raise(Google::Cloud::FailedPreconditionError,'MockError') + expect(zone).to receive(:add).with(:hostname, 'A', 60, ip).exactly(30).times + allow(subject).to receive(:sleep) + result = subject.create_or_replace_record(:hostname) + end + end + + context 'when IP does not exist' do + let(:ip) { nil } + + before(:each) do + allow(Google::Cloud::Dns).to receive(:configure) + allow(Google::Cloud::Dns).to receive(:new).and_return(connection) + allow(connection).to receive(:zone).and_return(zone) + allow(subject).to receive(:get_ip).and_return(ip) + end + + it 'should not attempt to add a record' do + allow(zone).to receive(:add).with(:hostname, 'A', 60, ip).and_raise(Google::Cloud::AlreadyExistsError,'MockError') + expect(zone).to_not have_received(:add) + allow(subject).to receive(:get_ip).and_return(ip) + result = subject.create_or_replace_record(:hostname) + end + end + end + + describe "#delete_record" do + let(:hostname) { 'spicy-proton' } + let(:zone) { MockDnsZone.new } + + context 'when removing a record' do + before(:each) do + allow(Google::Cloud::Dns).to receive(:configure) + allow(Google::Cloud::Dns).to receive(:new).and_return(connection) + allow(connection).to receive(:zone).and_return(zone) + end + + it 'should attempt to remove a record' do + expect(zone).to receive(:remove).with(:hostname, 'A') + result = subject.delete_record(:hostname) + end + end + + context 'when removing a record fails' do + before(:each) do + allow(Google::Cloud::Dns).to receive(:configure) + allow(Google::Cloud::Dns).to receive(:new).and_return(connection) + allow(connection).to receive(:zone).and_return(zone) + end + + it 'should retry' do + allow(zone).to receive(:remove).with(:hostname, 'A').and_raise(Google::Cloud::FailedPreconditionError,'MockError') + expect(zone).to receive(:remove).with(:hostname, 'A').exactly(30).times + allow(subject).to receive(:sleep) + result = subject.delete_record(:hostname) + end + end + end + + describe '#ensured_gcp_connection' do + let(:connection1) { mock_Google_Cloud_Dns_Project_Connection(connection_options) } + let(:connection2) { mock_Google_Cloud_Dns_Project_Connection(connection_options) } + + before(:each) do + allow(subject).to receive(:connect_to_gcp).and_return(connection1) + end + + it 'should return the same connection object when calling the pool multiple times' do + subject.connection_pool.with_metrics do |pool_object| + expect(pool_object[:connection]).to be(connection1) + end + subject.connection_pool.with_metrics do |pool_object| + expect(pool_object[:connection]).to be(connection1) + end + subject.connection_pool.with_metrics do |pool_object| + expect(pool_object[:connection]).to be(connection1) + end + end + + context 'when the connection breaks' do + before(:each) do + # Emulate the connection state being good, then bad, then good again + expect(subject).to receive(:gcp_connection_ok?).and_return(true, false, true) + expect(subject).to receive(:connect_to_gcp).and_return(connection1, connection2) + end + + it 'should restore the connection' do + subject.connection_pool.with_metrics do |pool_object| + # This line needs to be added to all instances of the connection_pool allocation + connection = subject.ensured_gcp_connection(pool_object) + + expect(connection).to be(connection1) + end + + subject.connection_pool.with_metrics do |pool_object| + connection = subject.ensured_gcp_connection(pool_object) + # The second connection would have failed. This test ensures that a + # new connection object was created. + expect(connection).to be(connection2) + end + + subject.connection_pool.with_metrics do |pool_object| + connection = subject.ensured_gcp_connection(pool_object) + expect(connection).to be(connection2) + end + end + end + end + + describe '#connect_to_gcp' do + before(:each) do + allow(Google::Cloud::Dns).to receive(:configure) + allow(Google::Cloud::Dns).to receive(:new).and_return(connection) + end + + context 'successful connection' do + it 'should return the connection object' do + result = subject.connect_to_gcp + + expect(result).to be(connection) + end + + it 'should increment the connect.open counter' do + expect(metrics).to receive(:increment).with('connect.open') + subject.connect_to_gcp + end + end + + context 'connection is initially unsuccessful' do + before(:each) do + # Simulate a failure and then success + allow(Google::Cloud::Dns).to receive(:configure) + expect(Google::Cloud::Dns).to receive(:new).and_raise(RuntimeError,'MockError') + allow(subject).to receive(:sleep) + end + + it 'should return the connection object' do + result = subject.connect_to_gcp + + expect(result).to be(connection) + end + + it 'should increment the connect.fail and then connect.open counter' do + expect(metrics).to receive(:increment).with('connect.fail').exactly(1).times + expect(metrics).to receive(:increment).with('connect.open').exactly(1).times + subject.connect_to_gcp + end + end + + context 'connection is always unsuccessful' do + before(:each) do + allow(Google::Cloud::Dns).to receive(:configure) + allow(Google::Cloud::Dns).to receive(:new).exactly(3).times.and_raise(RuntimeError,'MockError') + allow(subject).to receive(:sleep) + end + + it 'should retry the connection attempt config.max_tries times' do + expect(Google::Cloud::Dns).to receive(:new).exactly(config[:config]['max_tries']).times + + begin + # Swallow any errors + subject.connect_to_gcp + rescue + end + end + + it 'should increment the connect.fail counter config.max_tries times' do + expect(metrics).to receive(:increment).with('connect.fail').exactly(config[:config]['max_tries']).times + + begin + # Swallow any errors + subject.connect_to_gcp + rescue + end + end + end + end +end \ No newline at end of file diff --git a/vmpooler-dns-gcp.gemspec b/vmpooler-dns-gcp.gemspec index 9a7a44c..fe416c7 100644 --- a/vmpooler-dns-gcp.gemspec +++ b/vmpooler-dns-gcp.gemspec @@ -25,6 +25,7 @@ Gem::Specification.new do |spec| spec.add_dependency 'vmpooler', '>= 1.3.0', '~> 2.3' # Testing dependencies + spec.add_development_dependency 'mock_redis', '>= 0.17.0' spec.add_development_dependency 'rspec', '>= 3.2' spec.add_development_dependency 'rubocop', '~> 1.1.0' spec.add_development_dependency 'simplecov', '>= 0.11.2' From ec8923641dbcb583c7f989202f22cb50b2ee33b1 Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Thu, 23 Feb 2023 08:42:06 -0500 Subject: [PATCH 18/41] Update lockfile for mock_redis --- Gemfile.lock | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Gemfile.lock b/Gemfile.lock index 66d3ad3..ccb908a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -56,6 +56,8 @@ GEM jwt (2.6.0) memoist (0.16.2) mini_mime (1.1.2) + mock_redis (0.36.0) + ruby2_keywords multi_json (1.15.0) mustermann (2.0.2) ruby2_keywords (~> 0.0.1) @@ -199,6 +201,7 @@ PLATFORMS universal-java-11 DEPENDENCIES + mock_redis (>= 0.17.0) rspec (>= 3.2) rubocop (~> 1.1.0) simplecov (>= 0.11.2) From e3a8455ead0478c58b659d920d3de5c224df245d Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Thu, 23 Feb 2023 11:14:28 -0500 Subject: [PATCH 19/41] Bump jruby 9.4.0.0 to 9.4.1.0 in test matrix --- .github/workflows/testing.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 86955f6..784c332 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -19,7 +19,7 @@ jobs: matrix: ruby-version: - 'jruby-9.3.6.0' - - 'jruby-9.4.0.0' + - 'jruby-9.4.1.0' steps: - uses: actions/checkout@v3 - name: Set up Ruby @@ -36,7 +36,7 @@ jobs: matrix: ruby-version: - 'jruby-9.3.6.0' - - 'jruby-9.4.0.0' + - 'jruby-9.4.1.0' steps: - uses: actions/checkout@v3 - name: Set up Ruby From 8c73d160d91b245cf3dc02cb319a88c9756bf149 Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Mon, 17 Apr 2023 09:38:30 -0400 Subject: [PATCH 20/41] Rename for consistency Squash working --- lib/vmpooler/dns/gcp.rb | 139 +++++++++++++++++++++++++++++ lib/vmpooler/dns/gcp/clouddns.rb | 144 ------------------------------- spec/unit/dns/clouddns_spec.rb | 10 +-- 3 files changed, 144 insertions(+), 149 deletions(-) create mode 100644 lib/vmpooler/dns/gcp.rb delete mode 100644 lib/vmpooler/dns/gcp/clouddns.rb diff --git a/lib/vmpooler/dns/gcp.rb b/lib/vmpooler/dns/gcp.rb new file mode 100644 index 0000000..6ee2ec1 --- /dev/null +++ b/lib/vmpooler/dns/gcp.rb @@ -0,0 +1,139 @@ +# frozen_string_literal: true + +require 'googleauth' +require 'google/cloud/dns' +require 'vmpooler/dns/base' + +module Vmpooler + class PoolManager + class Dns + # This class represent a DNS plugin to CRUD resources in Google Cloud DNS. + class Gcp < Vmpooler::PoolManager::Dns::Base + # The connection_pool method is normally used only for testing + attr_reader :connection_pool + + def initialize(config, logger, metrics, redis_connection_pool, name, options) + super(config, logger, metrics, redis_connection_pool, name, options) + + task_limit = global_config[:config].nil? || global_config[:config]['task_limit'].nil? ? 10 : global_config[:config]['task_limit'].to_i + + default_connpool_size = [provided_pools.count, task_limit, 2].max + connpool_timeout = 60 + logger.log('d', "[#{name}] ConnPool - Creating a connection pool of size #{default_connpool_size} with timeout #{connpool_timeout}") + @connection_pool = Vmpooler::PoolManager::GenericConnectionPool.new( + metrics: metrics, + connpool_type: 'dns_connection_pool', + connpool_provider: name, + size: default_connpool_size, + timeout: connpool_timeout + ) do + logger.log('d', "[#{name}] Connection Pool - Creating a connection object") + # Need to wrap the GCP connection object in another object. The generic connection pooler will preserve + # the object reference for the connection, which means it cannot "reconnect" by creating an entirely new connection + # object. Instead by wrapping it in a Hash, the Hash object reference itself never changes but the content of the + # Hash can change, and is preserved across invocations. + new_conn = connect_to_gcp + { connection: new_conn } + end + end + + def name + 'gcp' + end + + # main configuration options + def project + dns_config['project'] + end + + def zone_name + dns_config['zone_name'] + end + + def create_or_replace_record(hostname) + retries = 0 + ip = get_ip(hostname) + if ip.nil? + debug_logger("An IP Address was not recorded for #{hostname}") + else + begin + change = connection.zone(zone_name).add(hostname, 'A', 60, ip) + debug_logger("#{change.id} - #{change.started_at} - #{change.status} DNS address added") if change + rescue Google::Cloud::AlreadyExistsError => _e + # the error is Google::Cloud::AlreadyExistsError: alreadyExists: The resource 'entity.change.additions[0]' named 'instance-8.test.vmpooler.net. (A)' already exists + # the error is Google::Cloud::AlreadyExistsError: alreadyExists: The resource 'entity.change.additions[0]' named 'instance-8.test.vmpooler.net. (A)' already exists + change = connection.zone(zone_name).replace(hostname, 'A', 60, ip) + debug_logger("#{change.id} - #{change.started_at} - #{change.status} DNS address previously existed and was replaced") if change + rescue Google::Cloud::FailedPreconditionError => e + debug_logger("DNS create failed, retrying error: #{e}") + sleep 5 + retry if (retries += 1) < 30 + end + end + end + + def delete_record(hostname) + retries = 0 + begin + connection.zone(zone_name).remove(hostname, 'A') + rescue Google::Cloud::FailedPreconditionError => e + # this error was experienced intermittently, will retry to see if it can complete successfully + # the error is Google::Cloud::FailedPreconditionError: conditionNotMet: Precondition not met for 'entity.change.deletions[1]' + debug_logger("GCP DNS delete_record failed, retrying error: #{e}") + sleep 5 + retry if (retries += 1) < 30 + end + end + + def connection + @connection_pool.with_metrics do |pool_object| + return ensured_gcp_connection(pool_object) + end + end + + def ensured_gcp_connection(connection_pool_object) + connection_pool_object[:connection] = connect_to_gcp unless gcp_connection_ok?(connection_pool_object[:connection]) + connection_pool_object[:connection] + end + + def gcp_connection_ok?(connection) + _result = connection.id + true + rescue StandardError + false + end + + def connect_to_gcp + max_tries = global_config[:config]['max_tries'] || 3 + retry_factor = global_config[:config]['retry_factor'] || 10 + try = 1 + begin + Google::Cloud::Dns.configure do |config| + config.project_id = project + end + + dns = Google::Cloud::Dns.new + + metrics.increment('connect.open') + dns + rescue StandardError => e + metrics.increment('connect.fail') + raise e if try >= max_tries + + sleep(try * retry_factor) + try += 1 + retry + end + end + + # used in local dev environment, set DEBUG_FLAG=true + # this way the upstream vmpooler manager does not get polluted with logs + def debug_logger(message, send_to_upstream: false) + # the default logger is simple and does not enforce debug levels (the first argument) + puts message if ENV['DEBUG_FLAG'] + logger.log('[g]', message) if send_to_upstream + end + end + end + end +end diff --git a/lib/vmpooler/dns/gcp/clouddns.rb b/lib/vmpooler/dns/gcp/clouddns.rb deleted file mode 100644 index 3db831e..0000000 --- a/lib/vmpooler/dns/gcp/clouddns.rb +++ /dev/null @@ -1,144 +0,0 @@ -# frozen_string_literal: true - -require 'googleauth' -require 'google/cloud/dns' -require 'vmpooler/dns/base' - -module Vmpooler - class PoolManager - class Dns - class Gcp - # This class represent a DNS plugin to CRUD resources in google clouddns. - class Clouddns < Vmpooler::PoolManager::Dns::Base - # The connection_pool method is normally used only for testing - attr_reader :connection_pool - - def initialize(config, logger, metrics, redis_connection_pool, name, options) - super(config, logger, metrics, redis_connection_pool, name, options) - - task_limit = global_config[:config].nil? || global_config[:config]['task_limit'].nil? ? 10 : global_config[:config]['task_limit'].to_i - - default_connpool_size = [provided_pools.count, task_limit, 2].max - # connpool_size = provider_config['connection_pool_size'].nil? ? default_connpool_size : provider_config['connection_pool_size'].to_i - connpool_timeout = 60 - # logger.log('d', "[#{name}] ConnPool - Creating a connection pool of size #{connpool_size} with timeout #{connpool_timeout}") - logger.log('d', "[#{name}] ConnPool - Creating a connection pool of size #{default_connpool_size} with timeout #{connpool_timeout}") - @connection_pool = Vmpooler::PoolManager::GenericConnectionPool.new( - metrics: metrics, - connpool_type: 'dns_connection_pool', - connpool_provider: name, - size: default_connpool_size, - # size: connpool_size, - timeout: connpool_timeout - ) do - logger.log('d', "[#{name}] Connection Pool - Creating a connection object") - # Need to wrap the vSphere connection object in another object. The generic connection pooler will preserve - # the object reference for the connection, which means it cannot "reconnect" by creating an entirely new connection - # object. Instead by wrapping it in a Hash, the Hash object reference itself never changes but the content of the - # Hash can change, and is preserved across invocations. - new_conn = connect_to_gcp - { connection: new_conn } - end - end - - def name - 'gcp-clouddns' - end - - # main configuration options - def project - dns_config['project'] - end - - def zone_name - dns_config['zone_name'] - end - - def create_or_replace_record(hostname) - retries = 0 - ip = get_ip(hostname) - if ip.nil? - debug_logger("An IP Address was not recorded for #{hostname}") - else - begin - change = connection.zone(zone_name).add(hostname, 'A', 60, ip) - debug_logger("#{change.id} - #{change.started_at} - #{change.status} DNS address added") if change - rescue Google::Cloud::AlreadyExistsError => _e - # the error is Google::Cloud::AlreadyExistsError: alreadyExists: The resource 'entity.change.additions[0]' named 'instance-8.test.vmpooler.net. (A)' already exists - # the error is Google::Cloud::AlreadyExistsError: alreadyExists: The resource 'entity.change.additions[0]' named 'instance-8.test.vmpooler.net. (A)' already exists - change = connection.zone(zone_name).replace(hostname, 'A', 60, ip) - debug_logger("#{change.id} - #{change.started_at} - #{change.status} DNS address previously existed and was replaced") if change - rescue Google::Cloud::FailedPreconditionError => e - debug_logger("DNS create failed, retrying error: #{e}") - sleep 5 - retry if (retries += 1) < 30 - end - end - end - - def delete_record(hostname) - retries = 0 - begin - connection.zone(zone_name).remove(hostname, 'A') - rescue Google::Cloud::FailedPreconditionError => e - # this error was experienced intermittently, will retry to see if it can complete successfully - # the error is Google::Cloud::FailedPreconditionError: conditionNotMet: Precondition not met for 'entity.change.deletions[1]' - debug_logger("GCP DNS delete_record failed, retrying error: #{e}") - sleep 5 - retry if (retries += 1) < 30 - end - end - - def connection - @connection_pool.with_metrics do |pool_object| - return ensured_gcp_connection(pool_object) - end - end - - def ensured_gcp_connection(connection_pool_object) - connection_pool_object[:connection] = connect_to_gcp unless gcp_connection_ok?(connection_pool_object[:connection]) - connection_pool_object[:connection] - end - - def gcp_connection_ok?(connection) - _result = connection.id - true - rescue StandardError - false - end - - def connect_to_gcp - max_tries = global_config[:config]['max_tries'] || 3 - retry_factor = global_config[:config]['retry_factor'] || 10 - try = 1 - begin - Google::Cloud::Dns.configure do |config| - config.project_id = project - end - - dns = Google::Cloud::Dns.new - - metrics.increment('connect.open') - dns - rescue StandardError => e - metrics.increment('connect.fail') - raise e if try >= max_tries - - sleep(try * retry_factor) - try += 1 - retry - end - end - - # used in local dev environment, set DEBUG_FLAG=true - # this way the upstream vmpooler manager does not get polluted with logs - def debug_logger(message, send_to_upstream: false) - # the default logger is simple and does not enforce debug levels (the first argument) - puts message if ENV['DEBUG_FLAG'] - logger.log('[g]', message) if send_to_upstream - end - end - end - end - end -end diff --git a/spec/unit/dns/clouddns_spec.rb b/spec/unit/dns/clouddns_spec.rb index cba2f23..c8841b7 100644 --- a/spec/unit/dns/clouddns_spec.rb +++ b/spec/unit/dns/clouddns_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' require 'mock_redis' -require 'vmpooler/dns/gcp/clouddns' +require 'vmpooler/dns/gcp' describe 'Vmpooler::PoolManager::Dns::Gcp' do let(:logger) { MockLogger.new } @@ -16,7 +16,7 @@ describe 'Vmpooler::PoolManager::Dns::Gcp' do retry_factor: 10 :dns_configs: :#{name}: - dns_class: gcp-clouddns + dns_class: gcp project: vmpooler-example domain: vmpooler.example.com zone_name: vmpooler-example-com @@ -50,11 +50,11 @@ EOT ) { MockRedis.new } end - subject { Vmpooler::PoolManager::Dns::Gcp::Clouddns.new(config, logger, metrics, redis_connection_pool, name, options) } + subject { Vmpooler::PoolManager::Dns::Gcp.new(config, logger, metrics, redis_connection_pool, name, options) } describe '#name' do - it 'should be gcp-clouddns' do - expect(subject.name).to eq('gcp-clouddns') + it 'should be gcp' do + expect(subject.name).to eq('gcp') end end From 63c15c3cbbcb27e40939025d1858a7d34ec9f637 Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Mon, 27 Feb 2023 12:02:29 -0500 Subject: [PATCH 21/41] Update docs --- README.md | 21 ++++++++++++++++++++- sig/vmpooler/dns/google/clouddns.rbs | 10 ---------- util/vmpooler-dns-gcp-role.yaml | 14 ++++++++++++++ 3 files changed, 34 insertions(+), 11 deletions(-) delete mode 100644 sig/vmpooler/dns/google/clouddns.rbs create mode 100644 util/vmpooler-dns-gcp-role.yaml diff --git a/README.md b/README.md index 0e29595..8afa87f 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,33 @@ # vmpooler-dns-gcp - [vmpooler-dns-gcp](#vmpooler-dns-gcp) + - [Requirements](#requirements) - [Usage](#usage) - [Update the Gemfile Lock](#update-the-gemfile-lock) - [Releasing](#releasing) - [License](#license) +## Requirements + +1. A Google Cloud Project with the [Cloud DNS](https://cloud.google.com/dns/) enabled. +2. A custom IAM role with the permissions listed in `util/vmpooler-dns-gcp-role.yaml`. +3. A service account assigned to the custom role above. +4. A service account key, using the account above, exported as `GOOGLE_APPLICATION_CREDENTIALS` where VMPooler is run. + ## Usage -Examples of deploying VMPooler with extra providers can be found in the [puppetlabs/vmpooler-deployment](https://github.com/puppetlabs/vmpooler-deployment) repository. +Example dns config setup: + +```yaml +:dns_configs: + :example: + dns_class: gcp + project: vmpooler-example + domain: vmpooler.example.com + zone_name: vmpooler-example-com +``` + +Examples of deploying VMPooler with dns configs can be found in the [puppetlabs/vmpooler-deployment](https://github.com/puppetlabs/vmpooler-deployment) repository. ## Update the Gemfile Lock diff --git a/sig/vmpooler/dns/google/clouddns.rbs b/sig/vmpooler/dns/google/clouddns.rbs deleted file mode 100644 index ee79317..0000000 --- a/sig/vmpooler/dns/google/clouddns.rbs +++ /dev/null @@ -1,10 +0,0 @@ -module Vmpooler - module Dns - module Google - module Clouddns - VERSION: String - # See the writing guide of rbs: https://github.com/ruby/rbs#guides - end - end - end -end diff --git a/util/vmpooler-dns-gcp-role.yaml b/util/vmpooler-dns-gcp-role.yaml new file mode 100644 index 0000000..bff6b98 --- /dev/null +++ b/util/vmpooler-dns-gcp-role.yaml @@ -0,0 +1,14 @@ +title: VMPooler DNS GCP +description: VMPooler DNS GCP Plugin +stage: GA +includedPermissions: +- dns.changes.create +- dns.changes.get +- dns.changes.list +- dns.managedZones.get +- dns.managedZones.list +- dns.resourceRecordSets.create +- dns.resourceRecordSets.update +- dns.resourceRecordSets.delete +- dns.resourceRecordSets.get +- dns.resourceRecordSets.list From 735f57c754a658001fcc5b5971d06bc1a38e4892 Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Mon, 27 Feb 2023 13:15:00 -0500 Subject: [PATCH 22/41] Renamed spec files --- spec/{clouddns_helper.rb => gcp_helper.rb} | 2 +- spec/spec_helper.rb | 4 ++-- spec/unit/dns/{clouddns_spec.rb => gcp_spec.rb} | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) rename spec/{clouddns_helper.rb => gcp_helper.rb} (99%) rename spec/unit/dns/{clouddns_spec.rb => gcp_spec.rb} (99%) diff --git a/spec/clouddns_helper.rb b/spec/gcp_helper.rb similarity index 99% rename from spec/clouddns_helper.rb rename to spec/gcp_helper.rb index 9d072d8..65add92 100644 --- a/spec/clouddns_helper.rb +++ b/spec/gcp_helper.rb @@ -23,4 +23,4 @@ end def mock_Google_Cloud_Dns_Project_Connection(options = {}) MockGoogleCloudDnsProjectConnection.new() -end \ No newline at end of file +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 8693400..1891dfa 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,7 +9,7 @@ require 'rspec' require 'vmpooler' require 'redis' require 'vmpooler/metrics' -require 'clouddns_helper' +require 'gcp_helper' def project_root_dir File.dirname(File.dirname(__FILE__)) @@ -17,4 +17,4 @@ end def fixtures_dir File.join(project_root_dir, 'spec', 'fixtures') -end \ No newline at end of file +end diff --git a/spec/unit/dns/clouddns_spec.rb b/spec/unit/dns/gcp_spec.rb similarity index 99% rename from spec/unit/dns/clouddns_spec.rb rename to spec/unit/dns/gcp_spec.rb index c8841b7..2c16907 100644 --- a/spec/unit/dns/clouddns_spec.rb +++ b/spec/unit/dns/gcp_spec.rb @@ -291,4 +291,4 @@ EOT end end end -end \ No newline at end of file +end From 15077755d8e6d5694b9b4238cee1151aff7e2e38 Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Tue, 7 Mar 2023 12:38:32 -0500 Subject: [PATCH 23/41] Use jruby 9.4.1 --- .github/workflows/release.yml | 4 ++-- .github/workflows/testing.yml | 2 -- Gemfile.lock | 4 ++-- README.md | 7 +++---- release-prep | 15 +++++++++++++++ update-changelog | 5 ----- update-gemfile-lock | 4 ++-- 7 files changed, 24 insertions(+), 17 deletions(-) create mode 100755 release-prep delete mode 100755 update-changelog diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a1a9dc7..428c102 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -70,10 +70,10 @@ jobs: prerelease: false # This step should closely match what is used in `docker/Dockerfile` in vmpooler-deployment - - name: Install Ruby jruby-9.3.6.0 + - name: Install Ruby jruby-9.4.1.0 uses: ruby/setup-ruby@v1 with: - ruby-version: 'jruby-9.3.6.0' + ruby-version: 'jruby-9.4.1.0' - name: Build gem run: gem build *.gemspec diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 784c332..eac55b3 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -18,7 +18,6 @@ jobs: strategy: matrix: ruby-version: - - 'jruby-9.3.6.0' - 'jruby-9.4.1.0' steps: - uses: actions/checkout@v3 @@ -35,7 +34,6 @@ jobs: strategy: matrix: ruby-version: - - 'jruby-9.3.6.0' - 'jruby-9.4.1.0' steps: - uses: actions/checkout@v3 diff --git a/Gemfile.lock b/Gemfile.lock index ccb908a..e97ba76 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -44,7 +44,7 @@ GEM zonefile (~> 1.04) google-cloud-env (1.6.0) faraday (>= 0.17.3, < 3.0) - google-cloud-errors (1.3.0) + google-cloud-errors (1.3.1) googleauth (1.2.0) faraday (>= 0.17.3, < 3.a) jwt (>= 1.4, < 3.0) @@ -109,7 +109,7 @@ GEM public_suffix (5.0.1) puma (5.6.5-java) nio4r (~> 2.0) - rack (2.2.6.2) + rack (2.2.6.3) rack-protection (2.2.4) rack rainbow (3.1.1) diff --git a/README.md b/README.md index 8afa87f..0f25d9e 100644 --- a/README.md +++ b/README.md @@ -40,10 +40,9 @@ Verify, and update if needed, that the docker tag in the script and GitHub actio Follow these steps to publish a new GitHub release, and build and push the gem to . 1. Bump the "VERSION" in `lib/vmpooler-dns-gcp/version.rb` appropriately based on changes in `CHANGELOG.md` since the last release. -2. Run `./update-gemfile-lock` to update `Gemfile.lock`. -3. Run `./update-changelog` to update `CHANGELOG.md`. -4. Commit and push changes to a new branch, then open a pull request against `main` and be sure to add the "maintenance" label. -5. After the pull request is approved and merged, then navigate to Actions --> Release Gem --> run workflow --> Branch: main --> Run workflow. +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 diff --git a/release-prep b/release-prep new file mode 100755 index 0000000..31d7f07 --- /dev/null +++ b/release-prep @@ -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 -it --rm \ + -v $(pwd):/app \ + jruby:9.4.1.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 -it --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-dns-gcp/version.rb |rev |cut -d "'" -f2 |rev) + diff --git a/update-changelog b/update-changelog deleted file mode 100755 index 9f3ec69..0000000 --- a/update-changelog +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -docker run -it --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-dns-gcp/version.rb |rev |cut -d "'" -f2 |rev) diff --git a/update-gemfile-lock b/update-gemfile-lock index 74e9c78..778bde9 100755 --- a/update-gemfile-lock +++ b/update-gemfile-lock @@ -3,5 +3,5 @@ # The container tag should closely match what is used in `docker/Dockerfile` in vmpooler-deployment docker run -it --rm \ -v $(pwd):/app \ - jruby:9.3.6-jdk \ - /bin/bash -c 'apt-get update -qq && apt-get install -y --no-install-recommends make git && cd /app && gem install bundler && bundle install --jobs 3 && bundle update; echo "LOCK_FILE_UPDATE_EXIT_CODE=$?"' + jruby:9.4.1.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 && bundle update; echo "LOCK_FILE_UPDATE_EXIT_CODE=$?"' From 8646c7d63717a66ad31f94a2750dd633d704dc00 Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Wed, 15 Mar 2023 15:55:52 -0400 Subject: [PATCH 24/41] Update Gemfile.lock --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index e97ba76..566b97e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -109,7 +109,7 @@ GEM public_suffix (5.0.1) puma (5.6.5-java) nio4r (~> 2.0) - rack (2.2.6.3) + rack (2.2.6.4) rack-protection (2.2.4) rack rainbow (3.1.1) @@ -131,7 +131,7 @@ GEM rspec-expectations (3.12.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) - rspec-mocks (3.12.3) + rspec-mocks (3.12.4) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) rspec-support (3.12.0) From 8cce46c068f80990e61fcdd3730b359ecff770d4 Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Tue, 28 Mar 2023 18:13:25 -0400 Subject: [PATCH 25/41] Bump vmpooler requirement and add install gemfile script --- Gemfile.lock | 4 ++-- install-gemfile-lock | 7 +++++++ vmpooler-dns-gcp.gemspec | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) create mode 100755 install-gemfile-lock diff --git a/Gemfile.lock b/Gemfile.lock index 566b97e..dd65fd9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -4,7 +4,7 @@ PATH vmpooler-dns-gcp (0.1.0) google-cloud-dns (~> 0.35.1) googleauth (>= 0.16.2, < 1.3.0) - vmpooler (~> 2.3, >= 1.3.0) + vmpooler (~> 3.0) GEM remote: https://rubygems.org/ @@ -172,7 +172,7 @@ GEM trailblazer-option (0.1.2) uber (0.1.0) unicode-display_width (1.8.0) - vmpooler (2.4.0) + vmpooler (3.0.0) concurrent-ruby (~> 1.1) connection_pool (~> 2.2) deep_merge (~> 1.2) diff --git a/install-gemfile-lock b/install-gemfile-lock new file mode 100755 index 0000000..07cbd49 --- /dev/null +++ b/install-gemfile-lock @@ -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.1.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=$?"' diff --git a/vmpooler-dns-gcp.gemspec b/vmpooler-dns-gcp.gemspec index fe416c7..a05a249 100644 --- a/vmpooler-dns-gcp.gemspec +++ b/vmpooler-dns-gcp.gemspec @@ -22,7 +22,7 @@ Gem::Specification.new do |spec| spec.require_paths = ["lib"] spec.add_dependency "googleauth", ">= 0.16.2", "< 1.3.0" spec.add_dependency "google-cloud-dns", "~> 0.35.1" - spec.add_dependency 'vmpooler', '>= 1.3.0', '~> 2.3' + spec.add_dependency 'vmpooler', '~> 3.0' # Testing dependencies spec.add_development_dependency 'mock_redis', '>= 0.17.0' From 3df8183dc1e885f257b5ddf188fd9cdb9b686324 Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Tue, 18 Apr 2023 12:16:26 -0400 Subject: [PATCH 26/41] Bundle install to remove old java 8 version --- Gemfile.lock | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index dd65fd9..c1dd62e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -62,6 +62,7 @@ GEM mustermann (2.0.2) ruby2_keywords (~> 0.0.1) net-ldap (0.17.1) + nio4r (2.5.8) nio4r (2.5.8-java) opentelemetry-api (1.1.0) opentelemetry-common (0.19.6) @@ -107,6 +108,8 @@ GEM pickup (0.0.11) prometheus-client (2.1.0) public_suffix (5.0.1) + puma (5.6.5) + nio4r (~> 2.0) puma (5.6.5-java) nio4r (~> 2.0) rack (2.2.6.4) @@ -197,7 +200,6 @@ GEM zonefile (1.06) PLATFORMS - universal-java-1.8 universal-java-11 DEPENDENCIES @@ -208,4 +210,4 @@ DEPENDENCIES vmpooler-dns-gcp! BUNDLED WITH - 2.4.5 + 2.4.10 From 0ce1f2c63b8a7bdec915c60ea73d47a75966a31d Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Tue, 18 Apr 2023 20:55:49 -0400 Subject: [PATCH 27/41] 1.0.0 release prep --- CHANGELOG.md | 12 ++++++++++++ Gemfile.lock | 5 +---- lib/vmpooler-dns-gcp/version.rb | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b42514..e69c291 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [1.0.0](https://github.com/puppetlabs/vmpooler-dns-gcp/tree/1.0.0) (2023-04-19) + +[Full Changelog](https://github.com/puppetlabs/vmpooler-dns-gcp/compare/0.0.1...1.0.0) + +**Implemented enhancements:** + +- \(RE-15124\) Initial implementation [\#1](https://github.com/puppetlabs/vmpooler-dns-gcp/pull/1) ([yachub](https://github.com/yachub)) + +## [0.0.1](https://github.com/puppetlabs/vmpooler-dns-gcp/tree/0.0.1) (2023-01-27) + +[Full Changelog](https://github.com/puppetlabs/vmpooler-dns-gcp/compare/2663cfaac4ccbf7273615ff493b5670e46702571...0.0.1) + \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)* diff --git a/Gemfile.lock b/Gemfile.lock index c1dd62e..bdeed66 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - vmpooler-dns-gcp (0.1.0) + vmpooler-dns-gcp (1.0.0) google-cloud-dns (~> 0.35.1) googleauth (>= 0.16.2, < 1.3.0) vmpooler (~> 3.0) @@ -62,7 +62,6 @@ GEM mustermann (2.0.2) ruby2_keywords (~> 0.0.1) net-ldap (0.17.1) - nio4r (2.5.8) nio4r (2.5.8-java) opentelemetry-api (1.1.0) opentelemetry-common (0.19.6) @@ -108,8 +107,6 @@ GEM pickup (0.0.11) prometheus-client (2.1.0) public_suffix (5.0.1) - puma (5.6.5) - nio4r (~> 2.0) puma (5.6.5-java) nio4r (~> 2.0) rack (2.2.6.4) diff --git a/lib/vmpooler-dns-gcp/version.rb b/lib/vmpooler-dns-gcp/version.rb index c38e817..c93ff3f 100644 --- a/lib/vmpooler-dns-gcp/version.rb +++ b/lib/vmpooler-dns-gcp/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module VmpoolerDnsGcp - VERSION = '0.1.0' + VERSION = '1.0.0' end From e9c8d8798abbab3221f791d2748e0406ef2953ab Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Wed, 19 Apr 2023 16:56:57 -0400 Subject: [PATCH 28/41] Bump jruby to 9.4.2.0 --- .github/workflows/release.yml | 4 ++-- .github/workflows/testing.yml | 4 ++-- install-gemfile-lock | 2 +- release-prep | 2 +- update-gemfile-lock | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 428c102..5f3c38d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -70,10 +70,10 @@ jobs: prerelease: false # This step should closely match what is used in `docker/Dockerfile` in vmpooler-deployment - - name: Install Ruby jruby-9.4.1.0 + - name: Install Ruby jruby-9.4.2.0 uses: ruby/setup-ruby@v1 with: - ruby-version: 'jruby-9.4.1.0' + ruby-version: 'jruby-9.4.2.0' - name: Build gem run: gem build *.gemspec diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index eac55b3..54dab4b 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -18,7 +18,7 @@ jobs: strategy: matrix: ruby-version: - - 'jruby-9.4.1.0' + - 'jruby-9.4.2.0' steps: - uses: actions/checkout@v3 - name: Set up Ruby @@ -34,7 +34,7 @@ jobs: strategy: matrix: ruby-version: - - 'jruby-9.4.1.0' + - 'jruby-9.4.2.0' steps: - uses: actions/checkout@v3 - name: Set up Ruby diff --git a/install-gemfile-lock b/install-gemfile-lock index 07cbd49..94a5e5e 100755 --- a/install-gemfile-lock +++ b/install-gemfile-lock @@ -3,5 +3,5 @@ # 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.1.0-jdk11 \ + jruby:9.4.2.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=$?"' diff --git a/release-prep b/release-prep index 31d7f07..8ccc889 100755 --- a/release-prep +++ b/release-prep @@ -5,7 +5,7 @@ # Update Gemfile.lock docker run -it --rm \ -v $(pwd):/app \ - jruby:9.4.1.0-jdk11 \ + jruby:9.4.2.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 diff --git a/update-gemfile-lock b/update-gemfile-lock index 778bde9..6e09b52 100755 --- a/update-gemfile-lock +++ b/update-gemfile-lock @@ -3,5 +3,5 @@ # 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.1.0-jdk11 \ + jruby:9.4.2.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 && bundle update; echo "LOCK_FILE_UPDATE_EXIT_CODE=$?"' From af28f9e8bdd8c14a2e4c1a45a598cae6e52c8b29 Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Thu, 20 Apr 2023 08:51:22 -0400 Subject: [PATCH 29/41] Migrate issue management to Jira --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 0f25d9e..b5ff1fb 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ - [Requirements](#requirements) - [Usage](#usage) - [Update the Gemfile Lock](#update-the-gemfile-lock) + - [Submitting Issues](#submitting-issues) - [Releasing](#releasing) - [License](#license) @@ -35,6 +36,10 @@ 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). +## Submitting Issues + +Please file any issues or requests in Jira at where project development is tracked across all VMPooler related components. + ## Releasing Follow these steps to publish a new GitHub release, and build and push the gem to . From 7b234006af7636bb8d3ef0e3d33ceb0cb16e2de5 Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Mon, 1 May 2023 08:26:50 -0400 Subject: [PATCH 30/41] 1.1.0 release prep --- CHANGELOG.md | 9 +++++++++ Gemfile.lock | 2 +- lib/vmpooler-dns-gcp/version.rb | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e69c291..f951323 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## [1.1.0](https://github.com/puppetlabs/vmpooler-dns-gcp/tree/1.1.0) (2023-05-01) + +[Full Changelog](https://github.com/puppetlabs/vmpooler-dns-gcp/compare/1.0.0...1.1.0) + +**Merged pull requests:** + +- Migrate issue management to Jira [\#4](https://github.com/puppetlabs/vmpooler-dns-gcp/pull/4) ([yachub](https://github.com/yachub)) +- Bump jruby to 9.4.2.0 [\#3](https://github.com/puppetlabs/vmpooler-dns-gcp/pull/3) ([yachub](https://github.com/yachub)) + ## [1.0.0](https://github.com/puppetlabs/vmpooler-dns-gcp/tree/1.0.0) (2023-04-19) [Full Changelog](https://github.com/puppetlabs/vmpooler-dns-gcp/compare/0.0.1...1.0.0) diff --git a/Gemfile.lock b/Gemfile.lock index bdeed66..7a6198f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - vmpooler-dns-gcp (1.0.0) + vmpooler-dns-gcp (1.1.0) google-cloud-dns (~> 0.35.1) googleauth (>= 0.16.2, < 1.3.0) vmpooler (~> 3.0) diff --git a/lib/vmpooler-dns-gcp/version.rb b/lib/vmpooler-dns-gcp/version.rb index c93ff3f..8ded2a1 100644 --- a/lib/vmpooler-dns-gcp/version.rb +++ b/lib/vmpooler-dns-gcp/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module VmpoolerDnsGcp - VERSION = '1.0.0' + VERSION = '1.1.0' end From 50241297167926a4785724f740a3e73d919b3fe1 Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Mon, 1 May 2023 08:27:22 -0400 Subject: [PATCH 31/41] Comment changelog validation until jira support is added --- .github/workflows/release.yml | 38 +++++++++++++++++------------------ 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5f3c38d..c92ed8a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,26 +29,26 @@ jobs: echo "version=$version" >> $GITHUB_OUTPUT echo "Found version $version from lib/vmpooler-dns-gcp/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: 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: 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 From 0dc2618101cc468a69e11b59577c8d61f07411a0 Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Thu, 20 Apr 2023 08:51:22 -0400 Subject: [PATCH 32/41] Revert "Migrate issue management to Jira" This reverts commit af28f9e8bdd8c14a2e4c1a45a598cae6e52c8b29. --- README.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/README.md b/README.md index b5ff1fb..0f25d9e 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,6 @@ - [Requirements](#requirements) - [Usage](#usage) - [Update the Gemfile Lock](#update-the-gemfile-lock) - - [Submitting Issues](#submitting-issues) - [Releasing](#releasing) - [License](#license) @@ -36,10 +35,6 @@ 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). -## Submitting Issues - -Please file any issues or requests in Jira at where project development is tracked across all VMPooler related components. - ## Releasing Follow these steps to publish a new GitHub release, and build and push the gem to . From 54675fd3e93e205efddaa332f4bdab7f7e6852ca Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Mon, 1 May 2023 08:27:22 -0400 Subject: [PATCH 33/41] Revert "Comment changelog validation until jira support is added" This reverts commit 50241297167926a4785724f740a3e73d919b3fe1. --- .github/workflows/release.yml | 38 +++++++++++++++++------------------ 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c92ed8a..5f3c38d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,26 +29,26 @@ jobs: echo "version=$version" >> $GITHUB_OUTPUT echo "Found version $version from lib/vmpooler-dns-gcp/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: 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: 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 From ecd19d909da9950a6a8936cdb3307e6f1e47913b Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Thu, 10 Aug 2023 07:16:13 -0400 Subject: [PATCH 34/41] Bump jruby to 9.4.3.0 and update lockfile --- .github/workflows/release.yml | 4 +- .github/workflows/testing.yml | 4 +- Gemfile.lock | 158 ++++++++++++++++++---------------- install-gemfile-lock | 2 +- release-prep | 2 +- update-gemfile-lock | 2 +- 6 files changed, 90 insertions(+), 82 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5f3c38d..643733f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -70,10 +70,10 @@ jobs: prerelease: false # This step should closely match what is used in `docker/Dockerfile` in vmpooler-deployment - - name: Install Ruby jruby-9.4.2.0 + - name: Install Ruby jruby-9.4.3.0 uses: ruby/setup-ruby@v1 with: - ruby-version: 'jruby-9.4.2.0' + ruby-version: 'jruby-9.4.3.0' - name: Build gem run: gem build *.gemspec diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 54dab4b..105fc8e 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -18,7 +18,7 @@ jobs: strategy: matrix: ruby-version: - - 'jruby-9.4.2.0' + - 'jruby-9.4.3.0' steps: - uses: actions/checkout@v3 - name: Set up Ruby @@ -34,7 +34,7 @@ jobs: strategy: matrix: ruby-version: - - 'jruby-9.4.2.0' + - 'jruby-9.4.3.0' steps: - uses: actions/checkout@v3 - name: Set up Ruby diff --git a/Gemfile.lock b/Gemfile.lock index 7a6198f..e7c5cdf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,21 +9,21 @@ PATH GEM remote: https://rubygems.org/ specs: - addressable (2.8.1) + addressable (2.8.5) public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) - bindata (2.4.14) - concurrent-ruby (1.2.0) - connection_pool (2.3.0) + bindata (2.4.15) + 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.4) + faraday (2.7.10) faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) faraday-net_http (3.0.2) - google-apis-core (0.10.0) + google-apis-core (0.11.1) addressable (~> 2.5, >= 2.5.1) googleauth (>= 0.16.2, < 2.a) httpclient (>= 2.8.1, < 3.a) @@ -32,8 +32,8 @@ GEM retriable (>= 2.0, < 4.a) rexml webrick - google-apis-dns_v1 (0.29.0) - google-apis-core (>= 0.9.1, < 2.a) + google-apis-dns_v1 (0.32.0) + google-apis-core (>= 0.11.0, < 2.a) google-cloud-core (1.6.0) google-cloud-env (~> 1.0) google-cloud-errors (~> 1.0) @@ -53,88 +53,96 @@ GEM os (>= 0.9, < 2.0) signet (>= 0.16, < 2.a) httpclient (2.8.3) - jwt (2.6.0) + jwt (2.7.1) memoist (0.16.2) - mini_mime (1.1.2) - mock_redis (0.36.0) - ruby2_keywords + mini_mime (1.1.5) + mock_redis (0.37.0) multi_json (1.15.0) - mustermann (2.0.2) + mustermann (3.0.0) ruby2_keywords (~> 0.0.1) - net-ldap (0.17.1) - nio4r (2.5.8-java) - opentelemetry-api (1.1.0) - opentelemetry-common (0.19.6) + net-ldap (0.18.0) + nio4r (2.5.9-java) + opentelemetry-api (1.2.1) + opentelemetry-common (0.20.0) opentelemetry-api (~> 1.0) - opentelemetry-exporter-jaeger (0.20.1) - opentelemetry-api (~> 1.0) - opentelemetry-common (~> 0.19.2) - opentelemetry-sdk (~> 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.19.0) + opentelemetry-instrumentation-base (0.22.2) opentelemetry-api (~> 1.0) - opentelemetry-instrumentation-concurrent_ruby (0.19.2) + opentelemetry-registry (~> 0.1) + opentelemetry-instrumentation-concurrent_ruby (0.21.1) opentelemetry-api (~> 1.0) - opentelemetry-instrumentation-base (~> 0.19.0) - opentelemetry-instrumentation-http_client (0.19.4) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-http_client (0.22.2) opentelemetry-api (~> 1.0) - opentelemetry-common (~> 0.19.3) - opentelemetry-instrumentation-base (~> 0.19.0) - opentelemetry-instrumentation-redis (0.21.3) + opentelemetry-common (~> 0.20.0) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-rack (0.23.4) opentelemetry-api (~> 1.0) - opentelemetry-common (~> 0.19.3) - opentelemetry-instrumentation-base (~> 0.19.0) - opentelemetry-instrumentation-sinatra (0.19.3) + opentelemetry-common (~> 0.20.0) + opentelemetry-instrumentation-base (~> 0.22.1) + opentelemetry-instrumentation-redis (0.25.3) opentelemetry-api (~> 1.0) - opentelemetry-common (~> 0.19.3) - opentelemetry-instrumentation-base (~> 0.19.0) - opentelemetry-registry (0.2.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.19.1) + opentelemetry-resource_detectors (0.24.1) google-cloud-env - opentelemetry-sdk - opentelemetry-sdk (1.2.0) + opentelemetry-sdk (~> 1.0) + opentelemetry-sdk (1.3.0) opentelemetry-api (~> 1.1) - opentelemetry-common (~> 0.19.3) + opentelemetry-common (~> 0.20) opentelemetry-registry (~> 0.2) opentelemetry-semantic_conventions - opentelemetry-semantic_conventions (1.8.0) + opentelemetry-semantic_conventions (1.10.0) opentelemetry-api (~> 1.0) os (1.1.4) - parallel (1.22.1) - parser (3.2.0.0) + parallel (1.23.0) + parser (3.2.2.3) ast (~> 2.4.1) + racc pickup (0.0.11) - prometheus-client (2.1.0) - public_suffix (5.0.1) - puma (5.6.5-java) + prometheus-client (4.2.1) + public_suffix (5.0.3) + puma (6.3.0-java) nio4r (~> 2.0) - rack (2.2.6.4) - rack-protection (2.2.4) - rack + racc (1.7.1-java) + rack (2.2.8) + rack-protection (3.1.0) + rack (~> 2.2, >= 2.2.4) rainbow (3.1.1) rake (13.0.6) - redis (4.8.0) - regexp_parser (2.6.2) + 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.5) + 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.0) + rspec-core (3.12.2) rspec-support (~> 3.12.0) - rspec-expectations (3.12.2) + rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) - rspec-mocks (3.12.4) + rspec-mocks (3.12.6) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) - rspec-support (3.12.0) + rspec-support (3.12.1) rubocop (1.1.0) parallel (~> 1.10) parser (>= 2.7.1.5) @@ -144,9 +152,9 @@ GEM rubocop-ast (>= 1.0.1) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (1.24.1) - parser (>= 3.1.1.0) - ruby-progressbar (1.11.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) @@ -159,38 +167,38 @@ GEM simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) simplecov_json_formatter (0.1.4) - sinatra (2.2.4) - mustermann (~> 2.0) - rack (~> 2.2) - rack-protection (= 2.2.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) statsd-ruby (1.5.0) - thrift (0.17.0) - tilt (2.0.11) + 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.0.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.20.1) - opentelemetry-instrumentation-concurrent_ruby (= 0.19.2) - opentelemetry-instrumentation-http_client (= 0.19.4) - opentelemetry-instrumentation-redis (= 0.21.3) - opentelemetry-instrumentation-sinatra (= 0.19.3) - opentelemetry-resource_detectors (= 0.19.1) - opentelemetry-sdk (~> 1.0, >= 1.0.2) + 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.0) - puma (~> 5.0, >= 5.0.4) - rack (~> 2.2) + prometheus-client (>= 2, < 5) + puma (>= 5.0.4, < 7) + rack (>= 2.2, < 4.0) rake (~> 13.0) redis (~> 4.1) - sinatra (~> 2.0) + sinatra (>= 2, < 4) spicy-proton (~> 2.1) statsd-ruby (~> 1.4) webrick (1.8.1) diff --git a/install-gemfile-lock b/install-gemfile-lock index 94a5e5e..a479b0d 100755 --- a/install-gemfile-lock +++ b/install-gemfile-lock @@ -3,5 +3,5 @@ # 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.2.0-jdk11 \ + 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=$?"' diff --git a/release-prep b/release-prep index 8ccc889..562088e 100755 --- a/release-prep +++ b/release-prep @@ -5,7 +5,7 @@ # Update Gemfile.lock docker run -it --rm \ -v $(pwd):/app \ - jruby:9.4.2.0-jdk11 \ + 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 diff --git a/update-gemfile-lock b/update-gemfile-lock index 6e09b52..43b530c 100755 --- a/update-gemfile-lock +++ b/update-gemfile-lock @@ -3,5 +3,5 @@ # 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.2.0-jdk11 \ + 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 && bundle update; echo "LOCK_FILE_UPDATE_EXIT_CODE=$?"' From 28bfe327e72617a79f0293fc3fe0835c01064890 Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Thu, 10 Aug 2023 12:21:03 -0400 Subject: [PATCH 35/41] 1.2.0 release prep --- CHANGELOG.md | 8 ++++++++ Gemfile.lock | 2 +- lib/vmpooler-dns-gcp/version.rb | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f951323..7d4be70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [1.2.0](https://github.com/puppetlabs/vmpooler-dns-gcp/tree/1.2.0) (2023-08-10) + +[Full Changelog](https://github.com/puppetlabs/vmpooler-dns-gcp/compare/1.1.0...1.2.0) + +**Implemented enhancements:** + +- Bump jruby to 9.4.3.0 and update lockfile [\#7](https://github.com/puppetlabs/vmpooler-dns-gcp/pull/7) ([yachub](https://github.com/yachub)) + ## [1.1.0](https://github.com/puppetlabs/vmpooler-dns-gcp/tree/1.1.0) (2023-05-01) [Full Changelog](https://github.com/puppetlabs/vmpooler-dns-gcp/compare/1.0.0...1.1.0) diff --git a/Gemfile.lock b/Gemfile.lock index e7c5cdf..0dce770 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - vmpooler-dns-gcp (1.1.0) + vmpooler-dns-gcp (1.2.0) google-cloud-dns (~> 0.35.1) googleauth (>= 0.16.2, < 1.3.0) vmpooler (~> 3.0) diff --git a/lib/vmpooler-dns-gcp/version.rb b/lib/vmpooler-dns-gcp/version.rb index 8ded2a1..358f93f 100644 --- a/lib/vmpooler-dns-gcp/version.rb +++ b/lib/vmpooler-dns-gcp/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module VmpoolerDnsGcp - VERSION = '1.1.0' + VERSION = '1.2.0' end From 74d07d44e301ce8e2181be170ff3793757f67e47 Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Tue, 5 Dec 2023 17:16:35 -0500 Subject: [PATCH 36/41] syncing files from release-engineering-repo-standards --- .github/dependabot.yml | 6 ++++++ .github/workflows/auto_release_prep.yml | 11 +++++++++++ .github/workflows/dependabot_merge.yml | 8 ++++++++ .github/workflows/ensure_label.yml | 8 ++++++++ 4 files changed, 33 insertions(+) create mode 100644 .github/workflows/auto_release_prep.yml create mode 100644 .github/workflows/dependabot_merge.yml create mode 100644 .github/workflows/ensure_label.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 81e0069..4ae585a 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,3 +5,9 @@ updates: schedule: interval: weekly open-pull-requests-limit: 10 + +- package-ecosystem: github-actions + directory: "/" + schedule: + interval: weekly + open-pull-requests-limit: 10 diff --git a/.github/workflows/auto_release_prep.yml b/.github/workflows/auto_release_prep.yml new file mode 100644 index 0000000..0a76371 --- /dev/null +++ b/.github/workflows/auto_release_prep.yml @@ -0,0 +1,11 @@ +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: + version-file-path: lib/vmpooler-dns-gcp/version.rb diff --git a/.github/workflows/dependabot_merge.yml b/.github/workflows/dependabot_merge.yml new file mode 100644 index 0000000..75b9cea --- /dev/null +++ b/.github/workflows/dependabot_merge.yml @@ -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 diff --git a/.github/workflows/ensure_label.yml b/.github/workflows/ensure_label.yml new file mode 100644 index 0000000..50a5fa8 --- /dev/null +++ b/.github/workflows/ensure_label.yml @@ -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 From dacde4c5cc81456e6c698982a3bd44db90bb0042 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 7 Dec 2023 13:46:35 +0000 Subject: [PATCH 37/41] 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] --- .github/workflows/security.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index 666c602..0a6c0dd 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -22,7 +22,7 @@ jobs: - name: check lock run: '[ -f "Gemfile.lock" ] && echo "package lock file exists, skipping" || bundle lock' # install java - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: distribution: 'temurin' # See 'Supported distributions' for available options java-version: '17' From ba18d31a0b3ca363d453ac408ebf3584f365cebe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 7 Dec 2023 13:51:31 +0000 Subject: [PATCH 38/41] 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] --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 643733f..f7527eb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,7 +10,7 @@ jobs: - uses: actions/checkout@v3 - name: Get Current Version - uses: actions/github-script@v6 + uses: actions/github-script@v7 id: cv with: script: | From abcd731b71f28bcb1590088ed5b14bb8047a98bd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 7 Dec 2023 13:55:32 +0000 Subject: [PATCH 39/41] 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] --- .github/workflows/release.yml | 2 +- .github/workflows/security.yml | 2 +- .github/workflows/testing.yml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f7527eb..5b4896c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest if: github.repository == 'puppetlabs/vmpooler-dns-gcp' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Get Current Version uses: actions/github-script@v7 diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index 0a6c0dd..ba273f5 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout repo content - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 1 - name: setup ruby diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 105fc8e..1f2f421 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -20,7 +20,7 @@ jobs: ruby-version: - 'jruby-9.4.3.0' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: @@ -36,7 +36,7 @@ jobs: ruby-version: - 'jruby-9.4.3.0' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: From 0960eaa2c4dc1f1e447027957377960c4d4f9110 Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Mon, 15 Jan 2024 09:24:45 -0500 Subject: [PATCH 40/41] Fix missing param in auto_release_prep --- .github/workflows/auto_release_prep.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/auto_release_prep.yml b/.github/workflows/auto_release_prep.yml index 0a76371..0cacec4 100644 --- a/.github/workflows/auto_release_prep.yml +++ b/.github/workflows/auto_release_prep.yml @@ -8,4 +8,5 @@ jobs: uses: puppetlabs/release-engineering-repo-standards/.github/workflows/auto_release_prep.yml@v1 secrets: inherit with: + project-type: ruby version-file-path: lib/vmpooler-dns-gcp/version.rb From f83996b8eace1ec2f94382bdfea6af4a3ca4de6e Mon Sep 17 00:00:00 2001 From: Jake Spain Date: Fri, 19 Jan 2024 15:34:43 -0500 Subject: [PATCH 41/41] Remove interactive option from release prep script --- release-prep | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release-prep b/release-prep index 562088e..a319a6a 100755 --- a/release-prep +++ b/release-prep @@ -3,13 +3,13 @@ # The container tag should closely match what is used in `docker/Dockerfile` in vmpooler-deployment # # Update Gemfile.lock -docker run -it --rm \ +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 -it --rm -e CHANGELOG_GITHUB_TOKEN -v $(pwd):/usr/local/src/your-app \ +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-dns-gcp/version.rb |rev |cut -d "'" -f2 |rev)