From 5c9cd631d6f5235f0fa326985a46555123417e08 Mon Sep 17 00:00:00 2001 From: Trey Dockendorf Date: Tue, 14 Nov 2023 13:54:31 -0500 Subject: [PATCH] Support Puppet 8 and stdlib 9.x Drop Debian 9 and Ubuntu 18.04 as EOL Add EL9, Debian 11 and Ubuntu 22.04 support --- .fixtures.yml | 2 +- .github/workflows/ci.yaml | 28 ++++++++++++----- .github/workflows/release.yaml | 5 ++-- .sync.yml | 30 ++++--------------- Gemfile | 27 ++++++----------- Rakefile | 4 +-- metadata.json | 8 ++--- .../nodesets/{debian-10.yml => debian-11.yml} | 13 ++++---- .../nodesets/{rocky-8.yml => el8.yml} | 13 ++++---- spec/acceptance/nodesets/el9.yml | 25 ++++++++++++++++ .../{ubuntu-1804.yml => ubuntu-2004.yml} | 15 ++++++---- spec/acceptance/nodesets/ubuntu-2204.yml | 24 +++++++++++++++ spec/spec_helper.rb | 2 +- 13 files changed, 119 insertions(+), 77 deletions(-) rename spec/acceptance/nodesets/{debian-10.yml => debian-11.yml} (72%) rename spec/acceptance/nodesets/{rocky-8.yml => el8.yml} (61%) create mode 100644 spec/acceptance/nodesets/el9.yml rename spec/acceptance/nodesets/{ubuntu-1804.yml => ubuntu-2004.yml} (50%) create mode 100644 spec/acceptance/nodesets/ubuntu-2204.yml diff --git a/.fixtures.yml b/.fixtures.yml index d7d9fc0..d91eebd 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -3,7 +3,7 @@ fixtures: repositories: 'stdlib': repo: 'https://github.com/puppetlabs/puppetlabs-stdlib.git' - ref: 'v8.0.0' + ref: 'v9.0.0' 'host_core': repo: 'https://github.com/puppetlabs/puppetlabs-host_core.git' ref: 'v1.1.0' diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c3e4800..3ad9440 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,27 +15,35 @@ jobs: fail-fast: false matrix: include: - - ruby: 2.7.0 + - ruby: 2.7.8 puppet: 7 fixtures: .fixtures.yml allow_failure: false - - ruby: 2.7.0 + - ruby: 2.7.8 puppet: 7 fixtures: .fixtures-latest.yml allow_failure: true + - ruby: 3.2.2 + puppet: 8 + fixtures: .fixtures.yml + allow_failure: false + - ruby: 3.2.2 + puppet: 8 + fixtures: .fixtures-latest.yml + allow_failure: true env: BUNDLE_WITHOUT: system_tests:release PUPPET_GEM_VERSION: "~> ${{ matrix.puppet }}.0" - FACTER_GEM_VERSION: "< 4.0" FIXTURES_YML: ${{ matrix.fixtures }} name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }} fixtures=${{ matrix.fixtures }}) steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup ruby uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true + cache-version: 2 bundler: '2.1.0' - name: Validate run: bundle exec rake check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint @@ -47,11 +55,14 @@ jobs: fail-fast: false matrix: set: - - "debian-10" - - "rocky-8" - - "ubuntu-1804" + - "el8" + - "el9" + - "debian-11" + - "ubuntu-2004" + - "ubuntu-2204" puppet: - "puppet7" + - "puppet8" env: BUNDLE_WITHOUT: development:release BEAKER_debug: true @@ -68,12 +79,13 @@ jobs: sudo apt-get remove mysql-server --purge sudo apt-get install apparmor-profiles sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup ruby uses: ruby/setup-ruby@v1 with: ruby-version: '2.7' bundler-cache: true + cache-version: 2 bundler: '2.1.0' - name: Run tests run: bundle exec rake beaker diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3756228..da72f01 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -14,17 +14,18 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Ruby uses: ruby/setup-ruby@v1 with: ruby-version: '2.7' bundler-cache: true + cache-version: 2 bundler: '2.1.0' - name: Build and Deploy env: # Configure secrets here: # https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets - BLACKSMITH_FORGE_USERNAME: 'ghoneycutt' + BLACKSMITH_FORGE_USERNAME: 'tailoredautomation' BLACKSMITH_FORGE_API_KEY: '${{ secrets.PUPPET_FORGE_API_KEY }}' run: bundle exec rake module:push diff --git a/.sync.yml b/.sync.yml index 12d8083..3da69d7 100644 --- a/.sync.yml +++ b/.sync.yml @@ -7,23 +7,15 @@ # for the default values. --- .github/workflows/ci.yaml: - unit_name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }} fixtures=${{ matrix.fixtures }}) - unit_includes: - - ruby: '2.7.0' - puppet: '7' - fixtures: .fixtures.yml - allow_failure: false - - ruby: '2.7.0' - puppet: '7' - fixtures: .fixtures-latest.yml - allow_failure: true acceptance_matrix: set: - - debian-10 - - rocky-8 - - ubuntu-1804 + - el8 + - el9 + - debian-11 + - ubuntu-2004 puppet: - puppet7 + - puppet8 .travis.yml: delete: true Rakefile: @@ -32,15 +24,3 @@ Rakefile: delete: true appveyor.yml: delete: true -spec/acceptance/nodesets/centos-6.yml: - delete: true -spec/acceptance/nodesets/centos-7.yml: - delete: true -spec/acceptance/nodesets/centos-8.yml: - delete: true -spec/acceptance/nodesets/ubuntu-1604.yml: - delete: true -spec/acceptance/nodesets/debian-8.yml: - delete: true -spec/acceptance/nodesets/debian-9.yml: - delete: true diff --git a/Gemfile b/Gemfile index 92f8329..c5101c4 100644 --- a/Gemfile +++ b/Gemfile @@ -17,32 +17,23 @@ ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments minor_version = ruby_version_segments[0..1].join('.') group :development do - gem "facter", '< 4.0', require: false - gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0') - gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0') - gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0') - gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9') - 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 "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw] - 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 "puppet-lint-param-docs", require: false - gem "voxpupuli-puppet-lint-plugins", '>= 3.0', require: false - gem "github_changelog_generator", require: false, git: 'https://github.com/skywinder/github-changelog-generator', ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2') + gem "voxpupuli-test", '6.0.0', require: false + gem "rubocop-performance", '~> 1.18', require: false + gem "faraday", '~> 1.0', require: false + gem "github_changelog_generator", require: false + gem "puppet-blacksmith", require: false + gem "puppet-strings", require: false end group :system_tests do - gem "puppet-module-posix-system-r#{minor_version}", '~> 0.5', require: false, platforms: [:ruby] - gem "puppet-module-win-system-r#{minor_version}", '~> 0.5', require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 4.0') + gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 4.29') gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.1') gem "beaker-pe", require: false gem "beaker-hostgenerator" gem "beaker-rspec" gem "beaker-docker" gem "beaker-puppet" + gem "beaker-puppet_install_helper", require: false + gem "beaker-module_install_helper", require: false end puppet_version = ENV['PUPPET_GEM_VERSION'] diff --git a/Rakefile b/Rakefile index 4d81bdb..173d2d3 100644 --- a/Rakefile +++ b/Rakefile @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'bundler' -require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any? +require 'beaker-rspec/rake_task' if Bundler.rubygems.find_name('beaker-rspec').any? require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-syntax/tasks/puppet-syntax' require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any? @@ -57,7 +57,7 @@ if Bundler.rubygems.find_name('github_changelog_generator').any? config.header = "# Change log\n\nAll notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org)." config.add_pr_wo_labels = true config.issues = false - config.merge_prefix = "### UNCATEGORIZED PRS; LABEL THEM ON GITHUB" + config.merge_prefix = "### Merged pull requests:" config.configure_sections = { "Changed" => { "prefix" => "### Changed", diff --git a/metadata.json b/metadata.json index 6d33754..ee8d671 100644 --- a/metadata.json +++ b/metadata.json @@ -14,7 +14,7 @@ }, { "name": "puppetlabs/stdlib", - "version_requirement": ">= 8.0.0 < 9.0.0" + "version_requirement": ">= 8.0.0 < 10.0.0" } ], "operatingsystem_support": [ @@ -49,11 +49,11 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 7.0.0 < 8.0.0" + "version_requirement": ">= 7.0.0 < 9.0.0" } ], "description": "Can ensure entries for localhost, localhost6, and $::fqdn,\nincluding aliases and optionally purge unmanaged entries.", - "pdk-version": "2.5.0", + "pdk-version": "3.0.0", "template-url": "https://github.com/tailored-automation/pdk-templates#main", - "template-ref": "heads/main-0-g37b4517" + "template-ref": "heads/main-0-g53868f7" } diff --git a/spec/acceptance/nodesets/debian-10.yml b/spec/acceptance/nodesets/debian-11.yml similarity index 72% rename from spec/acceptance/nodesets/debian-10.yml rename to spec/acceptance/nodesets/debian-11.yml index 5ac8bdd..676694f 100644 --- a/spec/acceptance/nodesets/debian-10.yml +++ b/spec/acceptance/nodesets/debian-11.yml @@ -1,10 +1,10 @@ HOSTS: - debian10: + debian11: roles: - agent - platform: debian-10-amd64 + platform: debian-11-amd64 hypervisor: docker - image: debian:10 + image: debian:11 docker_preserve_image: true docker_cmd: - '/sbin/init' @@ -14,11 +14,14 @@ HOSTS: - 'echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen' - 'echo "LANG=en_US.UTF-8" > /etc/locale.conf' - 'locale-gen en_US.UTF-8' - docker_container_name: 'hosts-debian10' + docker_env: + - LANG=en_US.UTF-8 + - LANGUAGE=en_US.UTF-8 + - LC_ALL=en_US.UTF-8 + docker_container_name: 'hosts-debian11' CONFIG: log_level: debug type: foss ssh: password: root auth_methods: ["password"] - diff --git a/spec/acceptance/nodesets/rocky-8.yml b/spec/acceptance/nodesets/el8.yml similarity index 61% rename from spec/acceptance/nodesets/rocky-8.yml rename to spec/acceptance/nodesets/el8.yml index 093bbc0..8fa057f 100644 --- a/spec/acceptance/nodesets/rocky-8.yml +++ b/spec/acceptance/nodesets/el8.yml @@ -1,17 +1,21 @@ HOSTS: - rocky-8: + el8: roles: - agent platform: el-8-x86_64 hypervisor: docker - image: rockylinux/rockylinux:8 + image: almalinux:8 docker_preserve_image: true docker_cmd: - '/usr/sbin/init' docker_image_commands: - - 'yum install -y dnf-utils' + - 'dnf install -y dnf-utils' - 'dnf config-manager --set-enabled powertools' - - 'yum install -y wget which cronie iproute initscripts' + - 'dnf install -y wget which cronie iproute initscripts' + docker_env: + - LANG=en_US.UTF-8 + - LANGUAGE=en_US.UTF-8 + - LC_ALL=en_US.UTF-8 docker_container_name: 'hosts-el8' CONFIG: log_level: debug @@ -19,4 +23,3 @@ CONFIG: ssh: password: root auth_methods: ["password"] - diff --git a/spec/acceptance/nodesets/el9.yml b/spec/acceptance/nodesets/el9.yml new file mode 100644 index 0000000..4d35900 --- /dev/null +++ b/spec/acceptance/nodesets/el9.yml @@ -0,0 +1,25 @@ +HOSTS: + el9: + roles: + - agent + platform: el-9-x86_64 + hypervisor: docker + image: almalinux:9 + docker_preserve_image: true + docker_cmd: + - '/usr/sbin/init' + docker_image_commands: + - 'dnf install -y dnf-utils' + - 'dnf config-manager --set-enabled crb' + - 'dnf install -y wget which cronie iproute initscripts' + docker_env: + - LANG=en_US.UTF-8 + - LANGUAGE=en_US.UTF-8 + - LC_ALL=en_US.UTF-8 + docker_container_name: 'hosts-el9' +CONFIG: + log_level: debug + type: foss +ssh: + password: root + auth_methods: ["password"] diff --git a/spec/acceptance/nodesets/ubuntu-1804.yml b/spec/acceptance/nodesets/ubuntu-2004.yml similarity index 50% rename from spec/acceptance/nodesets/ubuntu-1804.yml rename to spec/acceptance/nodesets/ubuntu-2004.yml index 08d8811..4cd136e 100644 --- a/spec/acceptance/nodesets/ubuntu-1804.yml +++ b/spec/acceptance/nodesets/ubuntu-2004.yml @@ -1,21 +1,24 @@ HOSTS: - ubuntu1804: + ubuntu2004: roles: - agent - platform: ubuntu-18.04-amd64 + platform: ubuntu-20.04-amd64 hypervisor : docker - image: ubuntu:18.04 + image: ubuntu:20.04 docker_preserve_image: true docker_cmd: '["/sbin/init"]' docker_image_commands: - "rm -f /etc/dpkg/dpkg.cfg.d/excludes" - - 'apt-get install -y wget net-tools locales apt-transport-https ca-certificates' + - 'apt-get install -y wget net-tools iproute2 locales apt-transport-https ca-certificates' - 'locale-gen en_US.UTF-8' - docker_container_name: 'hosts-ubuntu1804' + docker_env: + - LANG=en_US.UTF-8 + - LANGUAGE=en_US.UTF-8 + - LC_ALL=en_US.UTF-8 + docker_container_name: 'hosts-ubuntu2004' CONFIG: log_level: debug type: foss ssh: password: root auth_methods: ["password"] - diff --git a/spec/acceptance/nodesets/ubuntu-2204.yml b/spec/acceptance/nodesets/ubuntu-2204.yml new file mode 100644 index 0000000..871fa96 --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-2204.yml @@ -0,0 +1,24 @@ +HOSTS: + ubuntu2204: + roles: + - agent + platform: ubuntu-22.04-amd64 + hypervisor : docker + image: ubuntu:22.04 + docker_preserve_image: true + docker_cmd: '["/sbin/init"]' + docker_image_commands: + - "rm -f /etc/dpkg/dpkg.cfg.d/excludes" + - 'apt-get install -y wget net-tools iproute2 locales apt-transport-https ca-certificates' + - 'locale-gen en_US.UTF-8' + docker_env: + - LANG=en_US.UTF-8 + - LANGUAGE=en_US.UTF-8 + - LC_ALL=en_US.UTF-8 + docker_container_name: 'hosts-ubuntu2204' +CONFIG: + log_level: debug + type: foss +ssh: + password: root + auth_methods: ["password"] diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9b1fa6f..df8fdf4 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -25,7 +25,7 @@ next unless File.exist?(f) && File.readable?(f) && File.size?(f) begin - default_facts.merge!(YAML.safe_load(File.read(f), [], [], true)) + default_facts.merge!(YAML.safe_load(File.read(f))) rescue => e RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}" end