From 24d2929d67011fbd4ea27fc94025ee14390e74cd Mon Sep 17 00:00:00 2001 From: Michael Hashizume Date: Fri, 10 Feb 2023 10:51:00 -0800 Subject: (MODULES-11371) Updates PDK template This commit runs `pdk update` using the most recent template at the time (2.7.1) and updates metadata.json to allow Puppet versions < 9.0.0 in preparation for the release of Puppet 8. --- .devcontainer/README.md | 38 +++++++++++++++++++++++++++++++ .devcontainer/devcontainer.json | 16 +++++-------- .github/workflows/auto_release.yml | 16 ++++++++----- .rubocop.yml | 2 +- Gemfile | 46 +++++++++++++++++++++++--------------- Rakefile | 1 + metadata.json | 8 +++---- 7 files changed, 88 insertions(+), 39 deletions(-) create mode 100644 .devcontainer/README.md diff --git a/.devcontainer/README.md b/.devcontainer/README.md new file mode 100644 index 0000000..a719361 --- /dev/null +++ b/.devcontainer/README.md @@ -0,0 +1,38 @@ +# devcontainer + + +For format details, see https://aka.ms/devcontainer.json. + +For config options, see the README at: +https://github.com/microsoft/vscode-dev-containers/tree/v0.140.1/containers/puppet + +``` json +{ + "name": "Puppet Development Kit (Community)", + "dockerFile": "Dockerfile", + + // Set *default* container specific settings.json values on container create. + "settings": { + "terminal.integrated.profiles.linux": { + "bash": { + "path": "bash", + } + } + }, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "puppet.puppet-vscode", + "rebornix.Ruby" + ], + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "pdk --version", +} +``` + + + diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f1a55dc..fe7a8b1 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,23 +1,17 @@ -// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: -// https://github.com/microsoft/vscode-dev-containers/tree/v0.140.1/containers/puppet { "name": "Puppet Development Kit (Community)", "dockerFile": "Dockerfile", - // Set *default* container specific settings.json values on container create. "settings": { - "terminal.integrated.shell.linux": "/bin/bash" + "terminal.integrated.profiles.linux": { + "bash": { + "path": "bash", + } + } }, - // Add the IDs of extensions you want installed when the container is created. "extensions": [ "puppet.puppet-vscode", "rebornix.Ruby" ] - - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], - - // Use 'postCreateCommand' to run commands after the container is created. - // "postCreateCommand": "pdk --version", } diff --git a/.github/workflows/auto_release.yml b/.github/workflows/auto_release.yml index e028483..f4aed44 100644 --- a/.github/workflows/auto_release.yml +++ b/.github/workflows/auto_release.yml @@ -14,6 +14,7 @@ jobs: runs-on: ubuntu-20.04 steps: + - name: "Honeycomb: Start recording" uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1 with: @@ -25,7 +26,6 @@ jobs: run: | echo STEP_ID="auto-release" >> $GITHUB_ENV echo STEP_START=$(date +%s) >> $GITHUB_ENV - - name: "Checkout Source" if: ${{ github.repository_owner == 'puppetlabs' }} uses: actions/checkout@v2 @@ -46,8 +46,14 @@ jobs: run: | echo "::set-output name=ver::$(jq --raw-output .version metadata.json)" - - name: "Commit changes" + - name: "Check if a release is necessary" if: ${{ github.repository_owner == 'puppetlabs' }} + id: check + run: | + git diff --quiet CHANGELOG.md && echo "::set-output name=release::false" || echo "::set-output name=release::true" + + - name: "Commit changes" + if: ${{ github.repository_owner == 'puppetlabs' && steps.check.outputs.release == 'true' }} run: | git config --local user.email "${{ github.repository_owner }}@users.noreply.github.com" git config --local user.name "GitHub Action" @@ -57,7 +63,7 @@ jobs: - name: Create Pull Request id: cpr uses: puppetlabs/peter-evans-create-pull-request@v3 - if: ${{ github.repository_owner == 'puppetlabs' }} + if: ${{ github.repository_owner == 'puppetlabs' && steps.check.outputs.release == 'true' }} with: token: ${{ secrets.GITHUB_TOKEN }} commit-message: "Release prep v${{ steps.gv.outputs.ver }}" @@ -73,11 +79,11 @@ jobs: labels: "maintenance" - name: PR outputs - if: ${{ github.repository_owner == 'puppetlabs' }} + if: ${{ github.repository_owner == 'puppetlabs' && steps.check.outputs.release == 'true' }} run: | echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" - + - name: "Honeycomb: Record finish step" if: ${{ always() }} run: | diff --git a/.rubocop.yml b/.rubocop.yml index 4416e78..5019c2b 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -4,7 +4,7 @@ require: - rubocop-rspec AllCops: DisplayCopNames: true - TargetRubyVersion: '2.4' + TargetRubyVersion: '2.5' Include: - "**/*.rb" Exclude: diff --git a/Gemfile b/Gemfile index b48e755..4c131b4 100644 --- a/Gemfile +++ b/Gemfile @@ -13,32 +13,42 @@ def location_for(place_or_version, fake_version = nil) end end -ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments -minor_version = ruby_version_segments[0..1].join('.') - group :development do - gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "json", '= 2.3.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 2.8.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "puppet-module-posix-default-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby] - gem "puppet-module-posix-dev-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby] - gem "puppet-module-win-default-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "puppet-module-win-dev-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw] + gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) + gem "json", '= 2.3.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) + gem "json", '= 2.5.1', require: false if Gem::Requirement.create(['>= 3.0.0', '< 3.0.5']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) + gem "json", '= 2.6.1', require: false if Gem::Requirement.create(['>= 3.1.0', '< 3.1.3']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) + gem "json", '= 2.6.3', require: false if Gem::Requirement.create(['>= 3.2.0', '< 4.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) + gem "voxpupuli-puppet-lint-plugins", '~> 3.1', require: false + gem "facterdb", '~> 1.18', require: false + gem "metadata-json-lint", '>= 2.0.2', '< 4.0.0', require: false + gem "puppetlabs_spec_helper", '>= 3.0.0', '< 5.0.0', require: false + gem "rspec-puppet-facts", '~> 2.0', require: false + gem "codecov", '~> 0.2', require: false + gem "dependency_checker", '~> 0.2', require: false + gem "parallel_tests", '~> 3.4', require: false + gem "pry", '~> 0.10', require: false + gem "simplecov-console", '~> 0.5', require: false + gem "puppet-debugger", '~> 1.0', require: false + gem "rubocop", '= 1.6.1', require: false + gem "rubocop-performance", '= 1.9.1', require: false + gem "rubocop-rspec", '= 2.0.1', require: false + gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw] gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 4.30') gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.9') - gem "beaker-pe", require: false + gem "beaker-pe", require: false gem "beaker-hostgenerator" gem "beaker-rspec" gem "beaker-puppet", *location_for(ENV['BEAKER_PUPPET_VERSION'] || '~> 1.22') - gem "github_changelog_generator", require: false - gem "async", '~> 1', require: false - gem "beaker-module_install_helper", require: false - gem "beaker-puppet_install_helper", require: false - gem "nokogiri", require: false + gem "github_changelog_generator", require: false + gem "async", '~> 1', require: false + gem "beaker-module_install_helper", require: false + gem "beaker-puppet_install_helper", require: false + gem "nokogiri", require: false end group :system_tests do - gem "puppet-module-posix-system-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby] - gem "puppet-module-win-system-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw] + gem "puppet_litmus", '< 1.0.0', require: false, platforms: [:ruby] + gem "serverspec", '~> 2.41', require: false end puppet_version = ENV['PUPPET_GEM_VERSION'] diff --git a/Rakefile b/Rakefile index 2906c15..0f8754e 100644 --- a/Rakefile +++ b/Rakefile @@ -43,6 +43,7 @@ end PuppetLint.configuration.send('disable_relative') + if Bundler.rubygems.find_name('github_changelog_generator').any? GitHubChangelogGenerator::RakeTask.new :changelog do |config| raise "Set CHANGELOG_GITHUB_TOKEN environment variable eg 'export CHANGELOG_GITHUB_TOKEN=valid_token_here'" if Rake.application.top_level_tasks.include? "changelog" and ENV['CHANGELOG_GITHUB_TOKEN'].nil? diff --git a/metadata.json b/metadata.json index 08b30a9..a433d57 100644 --- a/metadata.json +++ b/metadata.json @@ -42,10 +42,10 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 6.0.0 < 8.0.0" + "version_requirement": ">= 6.0.0 < 9.0.0" } ], - "pdk-version": "2.3.0", - "template-url": "https://github.com/puppetlabs/pdk-templates#2.2.0", - "template-ref": "tags/2.2.0-0-g2381db6" + "pdk-version": "2.6.1", + "template-url": "https://github.com/puppetlabs/pdk-templates#2.7.1", + "template-ref": "tags/2.7.1-0-g9a16c87" } -- cgit v1.2.3 From 22dd5eafa5a5e57006e8f5070a05e186056a907a Mon Sep 17 00:00:00 2001 From: Michael Hashizume Date: Fri, 10 Feb 2023 10:56:30 -0800 Subject: (MODULES-11378) Update GitHub Action Ubuntu runner GitHub is deprecating Ubuntu 18.04 runners on April 1, 2023. This commit switches all Ubuntu 18.04 runners used in GitHub Actions to Ubuntu 20.04. https://github.blog/changelog/2022-08-09-github-actions-the-ubuntu-18-04-actions-runner-image-is-being-deprecated-and-will-be-removed-by-12-1-22/ This commit also updates all instances of the actions/checkout@v2 to actions/checkout@v3 in perparation for the former's deprecation as part of the NodeJS deprecation. https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/ Additionally, this commit removes a Gem that was mistakenly committed in https://github.com/puppetlabs/puppetlabs-augeas_core/commit/76e710a94692ecc0c1881c7d7814e84e63ff69db --- .github/workflows/auto_release.yml | 2 +- .../dispatch_unit_tests_with_nightly_puppet_gem.yaml | 6 +++--- .github/workflows/puppet-latest.gem | Bin 2772480 -> 0 bytes .github/workflows/release.yml | 4 ++-- .github/workflows/static_code_analysis.yaml | 4 ++-- .../workflows/unit_tests_with_nightly_puppet_gem.yaml | 6 +++--- .../unit_tests_with_released_puppet_gem.yaml | 6 +++--- 7 files changed, 14 insertions(+), 14 deletions(-) delete mode 100644 .github/workflows/puppet-latest.gem diff --git a/.github/workflows/auto_release.yml b/.github/workflows/auto_release.yml index f4aed44..7bae1db 100644 --- a/.github/workflows/auto_release.yml +++ b/.github/workflows/auto_release.yml @@ -28,7 +28,7 @@ jobs: echo STEP_START=$(date +%s) >> $GITHUB_ENV - name: "Checkout Source" if: ${{ github.repository_owner == 'puppetlabs' }} - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 persist-credentials: false diff --git a/.github/workflows/dispatch_unit_tests_with_nightly_puppet_gem.yaml b/.github/workflows/dispatch_unit_tests_with_nightly_puppet_gem.yaml index fed0724..541c3ec 100644 --- a/.github/workflows/dispatch_unit_tests_with_nightly_puppet_gem.yaml +++ b/.github/workflows/dispatch_unit_tests_with_nightly_puppet_gem.yaml @@ -72,9 +72,9 @@ jobs: strategy: matrix: - os: [ 'ubuntu-18.04', 'macos-latest', 'windows-2019' ] + os: [ 'ubuntu-20.04', 'macos-latest', 'windows-2019' ] include: - - os: 'ubuntu-18.04' + - os: 'ubuntu-20.04' os_type: 'Linux' env_set_cmd: 'export ' gem_file_postfix: '.gem' @@ -90,7 +90,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Install ruby version ${{ env.ruby_version }} uses: ruby/setup-ruby@v1 diff --git a/.github/workflows/puppet-latest.gem b/.github/workflows/puppet-latest.gem deleted file mode 100644 index 447f424..0000000 Binary files a/.github/workflows/puppet-latest.gem and /dev/null differ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1509f6e..d9604ad 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: ref: ${{ github.ref }} clean: true @@ -33,7 +33,7 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: ref: ${{ github.ref }} clean: true diff --git a/.github/workflows/static_code_analysis.yaml b/.github/workflows/static_code_analysis.yaml index 9a132eb..b639220 100644 --- a/.github/workflows/static_code_analysis.yaml +++ b/.github/workflows/static_code_analysis.yaml @@ -15,10 +15,10 @@ jobs: ruby_version: 2.6 extra_checks: check:symlinks check:git_ignore check:dot_underscore check:test_file - runs-on: 'ubuntu-18.04' + runs-on: 'ubuntu-20.04' steps: - name: Checkout current PR code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 diff --git a/.github/workflows/unit_tests_with_nightly_puppet_gem.yaml b/.github/workflows/unit_tests_with_nightly_puppet_gem.yaml index 88604d0..b2c6a12 100644 --- a/.github/workflows/unit_tests_with_nightly_puppet_gem.yaml +++ b/.github/workflows/unit_tests_with_nightly_puppet_gem.yaml @@ -12,7 +12,7 @@ jobs: name: ${{ matrix.os_type }} / Puppet${{ matrix.puppet_version }} gem / Ruby ${{ matrix.ruby }} strategy: matrix: - os: [ 'ubuntu-18.04', 'macos-latest', 'windows-2019' ] + os: [ 'ubuntu-20.04', 'macos-latest', 'windows-2019' ] puppet_version: [ 6, 7 ] include: - puppet_version: 6 @@ -20,7 +20,7 @@ jobs: - puppet_version: 7 ruby: 2.7 - - os: 'ubuntu-18.04' + - os: 'ubuntu-20.04' os_type: 'Linux' env_set_cmd: 'export ' gem_file: 'puppet-latest.gem' @@ -36,7 +36,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout current PR code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Install ruby version ${{ matrix.ruby }} uses: ruby/setup-ruby@v1 diff --git a/.github/workflows/unit_tests_with_released_puppet_gem.yaml b/.github/workflows/unit_tests_with_released_puppet_gem.yaml index c316cb0..8b5afcb 100644 --- a/.github/workflows/unit_tests_with_released_puppet_gem.yaml +++ b/.github/workflows/unit_tests_with_released_puppet_gem.yaml @@ -12,7 +12,7 @@ jobs: name: ${{ matrix.os_type }} / Puppet${{ matrix.puppet_version }} gem / Ruby ${{ matrix.ruby }} strategy: matrix: - os: [ 'ubuntu-18.04', 'macos-latest', 'windows-2019' ] + os: [ 'ubuntu-20.04', 'macos-latest', 'windows-2019' ] puppet_version: [ 6, 7 ] include: - puppet_version: 6 @@ -20,7 +20,7 @@ jobs: - puppet_version: 7 ruby: 2.7 - - os: 'ubuntu-18.04' + - os: 'ubuntu-20.04' os_type: 'Linux' - os: 'macos-latest' os_type: 'macOS' @@ -32,7 +32,7 @@ jobs: PUPPET_GEM_VERSION: ~> ${{ matrix.puppet_version }}.0 steps: - name: Checkout current PR code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Install ruby version ${{ matrix.ruby }} uses: ruby/setup-ruby@v1 -- cgit v1.2.3 From 2e4c5a6cc8bad4fc5eb4ed654f0759609e46a73d Mon Sep 17 00:00:00 2001 From: Michael Hashizume Date: Tue, 14 Feb 2023 14:45:43 -0800 Subject: (MODULES-11371) Change auto release Docker image The PDK Docker image does not contain any build tools, which causes the installation of gems that use native extensions to fail. This commit changes the Docker image used in the Auto Release GitHub Action from the PDK image to the Puppet dev-tools image, which contains packages like `make` necessary for building native extensions. --- .github/workflows/auto_release.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/auto_release.yml b/.github/workflows/auto_release.yml index 7bae1db..3799f04 100644 --- a/.github/workflows/auto_release.yml +++ b/.github/workflows/auto_release.yml @@ -33,10 +33,12 @@ jobs: fetch-depth: 0 persist-credentials: false + # We use the dev tools image here because the PDK image does not have the + # build tools necessary to compile native extensions. - name: "PDK Release prep" - uses: docker://puppet/iac_release:ci + uses: docker://puppet/puppet-dev-tools:4.x with: - args: 'release prep --force' + args: 'pdk release prep --force --debug' env: CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -- cgit v1.2.3 From c00f7e3b92be621b6bc3bfa795fd35d1dd1bb566 Mon Sep 17 00:00:00 2001 From: Michael Hashizume Date: Tue, 14 Feb 2023 15:16:17 -0800 Subject: (MODULES-11371) Add Vox Beaker gem In 24d2929, we updated the module according to PDK template 7.2.1, which updated puppetlabs_spec_helper. The updated version of puppetlabs_spec_helper removed the Beaker rake task, which we use for acceptance testing. This commit adds the voxpupuli-acceptance gem, which re-adds the Beaker rake task. --- Gemfile | 1 + Rakefile | 1 + spec/spec_helper_acceptance.rb | 1 + 3 files changed, 3 insertions(+) diff --git a/Gemfile b/Gemfile index 4c131b4..b1261c6 100644 --- a/Gemfile +++ b/Gemfile @@ -49,6 +49,7 @@ end group :system_tests do gem "puppet_litmus", '< 1.0.0', require: false, platforms: [:ruby] gem "serverspec", '~> 2.41', require: false + gem "voxpupuli-acceptance" end puppet_version = ENV['PUPPET_GEM_VERSION'] diff --git a/Rakefile b/Rakefile index 0f8754e..10ddd14 100644 --- a/Rakefile +++ b/Rakefile @@ -7,6 +7,7 @@ require 'puppet-syntax/tasks/puppet-syntax' require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any? require 'github_changelog_generator/task' if Bundler.rubygems.find_name('github_changelog_generator').any? require 'puppet-strings/tasks' if Bundler.rubygems.find_name('puppet-strings').any? +require 'voxpupuli/acceptance/rake' def changelog_user return unless Rake.application.top_level_tasks.include? "changelog" diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 40a011d..c8f667c 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,6 +1,7 @@ require 'beaker-rspec' require 'beaker/module_install_helper' require 'beaker/puppet_install_helper' +require 'voxpupuli/acceptance/spec_helper_acceptance' RSpec.configure do |c| c.before :suite do -- cgit v1.2.3 From c2e7fa274cab18db16a6f31b7506f582da83d737 Mon Sep 17 00:00:00 2001 From: Michael Hashizume Date: Tue, 14 Feb 2023 15:17:21 -0800 Subject: (MODULES-11371) Pin gems for auto release Modeling after the learnings of the support team in commit puppetlabs/puppetlabs-puppet_metrics_collector@78dd858 This commit pins the github_changelog_generator gem to its latest version to make it work, and the concurrent-ruby to an older version to compensate for the version of PDK shipped in the dev-tools container image. --- .sync.yml | 3 +++ Gemfile | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.sync.yml b/.sync.yml index e267a46..8df567d 100644 --- a/.sync.yml +++ b/.sync.yml @@ -40,6 +40,9 @@ Gemfile: from_env: BEAKER_PUPPET_VERSION version: '~> 1.22' - gem: github_changelog_generator + version: '= 1.16.4' + - gem: concurrent-ruby + version: '= 1.1.10' - gem: async version: '~> 1' - gem: beaker-module_install_helper diff --git a/Gemfile b/Gemfile index b1261c6..6a6c641 100644 --- a/Gemfile +++ b/Gemfile @@ -40,7 +40,8 @@ group :development do gem "beaker-hostgenerator" gem "beaker-rspec" gem "beaker-puppet", *location_for(ENV['BEAKER_PUPPET_VERSION'] || '~> 1.22') - gem "github_changelog_generator", require: false + gem "github_changelog_generator", '= 1.16.4', require: false + gem "concurrent-ruby", '= 1.1.10', require: false gem "async", '~> 1', require: false gem "beaker-module_install_helper", require: false gem "beaker-puppet_install_helper", require: false -- cgit v1.2.3