diff --git a/.github/workflows/add_new_issue_to_triage_project.yml b/.github/workflows/add_new_issue_to_triage_project.yml index 775d16e..4f101eb 100644 --- a/.github/workflows/add_new_issue_to_triage_project.yml +++ b/.github/workflows/add_new_issue_to_triage_project.yml @@ -1,7 +1,7 @@ --- name: Add new issues to triage project -on: +'on': issues: types: - opened diff --git a/.github/workflows/pr_tests.yml b/.github/workflows/pr_tests.yml index 21ca28c..9c0e683 100644 --- a/.github/workflows/pr_tests.yml +++ b/.github/workflows/pr_tests.yml @@ -11,8 +11,8 @@ # The testing matrix considers ruby/puppet versions supported by SIMP and PE: # ------------------------------------------------------------------------------ # Release Puppet Ruby EOL -# PE 2019.8 6.22 2.5 2022-12 (LTS) -# PE 2021.Y 7.x 2.7 Quarterly updates +# PE 2021.Y 7.x 2.7 2025-02 (LTS) +# PE 2023.Y 8.x 3.2 Biannual updates # # https://puppet.com/docs/pe/latest/component_versions_in_recent_pe_releases.html # https://puppet.com/misc/puppet-enterprise-lifecycle @@ -20,14 +20,14 @@ # # https://docs.github.com/en/actions/reference/events-that-trigger-workflows # - +--- name: PR Tests -on: +'on': pull_request: types: [opened, reopened, synchronize] env: - PUPPET_VERSION: '~> 7' + PUPPET_VERSION: '~> 8' jobs: puppet-syntax: @@ -38,7 +38,7 @@ jobs: - name: "Install Ruby ${{matrix.puppet.ruby_version}}" uses: ruby/setup-ruby@v1 # ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0 with: - ruby-version: 2.7 + ruby-version: 3.2 bundler-cache: true - run: "bundle exec rake syntax" @@ -50,13 +50,13 @@ jobs: - name: "Install Ruby ${{matrix.puppet.ruby_version}}" uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7 + ruby-version: 3.2 bundler-cache: true - run: "bundle exec rake lint" - run: "bundle exec rake metadata_lint" ruby-style: - if: false # TODO Modules will need: rubocop in Gemfile, .rubocop.yml + if: false # TODO Modules will need: rubocop in Gemfile, .rubocop.yml name: 'Ruby Style (experimental)' runs-on: ubuntu-latest continue-on-error: true @@ -65,7 +65,7 @@ jobs: - name: "Install Ruby ${{matrix.puppet.ruby_version}}" uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7 + ruby-version: 3.2 bundler-cache: true - run: | bundle show @@ -76,10 +76,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: 'Install Ruby 2.7' + - name: 'Install Ruby 3.2' uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7 + ruby-version: 3.2 bundler-cache: true - run: bundle exec rake check:dot_underscore - run: bundle exec rake check:test_file @@ -92,7 +92,7 @@ jobs: - name: 'Install Ruby ${{matrix.puppet.ruby_version}}' uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7 + ruby-version: 3.2 bundler-cache: true - name: 'Tags and changelogs' run: | diff --git a/.github/workflows/release_rpms.yml b/.github/workflows/release_rpms.yml index 450ff7c..04f1ef5 100644 --- a/.github/workflows/release_rpms.yml +++ b/.github/workflows/release_rpms.yml @@ -31,7 +31,7 @@ --- name: 'RELENG: Build + attach RPMs to GitHub Release' -on: +'on': workflow_dispatch: inputs: release_tag: @@ -71,10 +71,10 @@ on: description: "Dry run (Test-build RPMs)" required: false default: 'no' - #verbose: - # description: 'Verbose RPM builds when "yes"' - # required: false - # default: 'no' + # verbose: + # description: 'Verbose RPM builds when "yes"' + # required: false + # default: 'no' rebuild_number: description: 'If this is an RPM rebuild, put the number of the rebuild here' required: false @@ -255,13 +255,13 @@ jobs: simp_core_ref_for_building_rpms: ${{ secrets.SIMP_CORE_REF_FOR_BUILDING_RPMS }} simp_builder_docker_image: 'docker.io/simpproject/simp_build_${{ github.event.inputs.build_container_os }}:latest' path_to_build: "${{ (github.event.inputs.path_to_build != null && format('{0}/{1}', github.workspace, github.event.inputs.path_to_build)) || github.workspace }}" - verbose: 'no' #${{ github.event.inputs.verbose }} + verbose: 'no' # ${{ github.event.inputs.verbose }} - name: "Wipe all previous assets from GitHub Release (when clean == 'yes')" if: ${{ github.event.inputs.clean == 'yes' && github.event.inputs.dry_run != 'yes' }} uses: actions/github-script@v6 env: - release_id: ${{ steps.release-api.outputs.id }} + release_id: ${{ steps.release-api.outputs.id }} with: github-token: ${{ github.event.inputs.target_repo_token || secrets.GITHUB_TOKEN }} script: | @@ -282,7 +282,7 @@ jobs: env: rpm_file_paths: ${{ steps.build-and-sign-rpm.outputs.rpm_file_paths }} rpm_gpg_file: ${{ steps.build-and-sign-rpm.outputs.rpm_gpg_file }} - release_id: ${{ steps.release-api.outputs.id }} + release_id: ${{ steps.release-api.outputs.id }} clobber: ${{ github.event.inputs.clobber }} clean: ${{ github.event.inputs.clean }} dry_run: ${{ github.event.inputs.dry_run }} diff --git a/.github/workflows/tag_deploy.yml b/.github/workflows/tag_deploy.yml index 2191ab1..10a5d1c 100644 --- a/.github/workflows/tag_deploy.yml +++ b/.github/workflows/tag_deploy.yml @@ -30,7 +30,7 @@ --- name: 'Tag: Release to GitHub w/RPMs + Puppet Forge' -on: +'on': push: tags: # NOTE: These filter patterns aren't actually regexes: @@ -39,7 +39,7 @@ on: - '[0-9]+\.[0-9]+\.[0-9]+\-[a-z]+[0-9]+' env: - PUPPET_VERSION: '~> 7' + PUPPET_VERSION: '~> 8' jobs: releng-checks: @@ -55,7 +55,7 @@ jobs: clean: true - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7 + ruby-version: 3.2 bundler-cache: true - run: bundle exec rake pkg:check_version - run: bundle exec rake pkg:compare_latest_tag @@ -67,7 +67,8 @@ jobs: create-github-release: name: Deploy GitHub Release - needs: [ releng-checks ] + needs: + - releng-checks if: github.repository_owner == 'simp' runs-on: ubuntu-latest outputs: @@ -117,17 +118,18 @@ jobs: id: create_release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - IS_PRERELASE: ${{ steps.tag-check.outputs.prerelease }} + IS_PRERELEASE: ${{ steps.tag-check.outputs.prerelease }} run: | echo "${RELEASE_MESSAGE}" > /tmp/.commit-msg.txt args=(-F /tmp/.commit-msg.txt) - [[ $IS_PRERELASE == yes ]] && args+=(--prerelease) + [[ "$IS_PRERELEASE" == yes ]] && args+=(--prerelease) gh release create ${args[@]} "$TARGET_TAG" build-and-attach-rpms: name: Trigger RPM release - needs: [ create-github-release ] + needs: + - create-github-release if: github.repository_owner == 'simp' runs-on: ubuntu-latest env: @@ -165,7 +167,8 @@ jobs: deploy-to-puppet-forge: name: 'Deploy PuppetForge Release' - needs: [ create-github-release ] + needs: + - create-github-release if: (github.repository_owner == 'simp') && (needs.create-github-release.outputs.prerelease != 'yes') runs-on: ubuntu-latest env: @@ -180,7 +183,7 @@ jobs: clean: true - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7 + ruby-version: 3.2 bundler-cache: true - name: Build Puppet module (PDK) run: bundle exec pdk build --force diff --git a/.github/workflows/validate_tokens.yml b/.github/workflows/validate_tokens.yml index 11dd5f3..cfbba7b 100644 --- a/.github/workflows/validate_tokens.yml +++ b/.github/workflows/validate_tokens.yml @@ -21,7 +21,7 @@ --- name: 'Manual: Validate API tokens' -on: +'on': - workflow_dispatch jobs: @@ -66,4 +66,3 @@ jobs: echo "::debug ::${scopes}" exit 1 fi - diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8698d3c..c39a363 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,13 +8,12 @@ # ------------------------------------------------------------------------------ # The testing matrix considers ruby/puppet versions supported by SIMP and PE: # -# https://puppet.com/docs/pe/2019.8/component_versions_in_recent_pe_releases.html +# https://puppet.com/docs/pe/latest/component_versions_in_recent_pe_releases.html # https://puppet.com/misc/puppet-enterprise-lifecycle -# https://puppet.com/docs/pe/2018.1/overview/getting_support_for_pe.html # ------------------------------------------------------------------------------ # Release Puppet Ruby EOL -# PE 2019.8 6.28 2.5.7 2023-07 (LTS) -# PE 2021.7 7.20 2.7.6 TBD (LTS) +# PE 2021.7 7.30 2.7.8 2025-02 (LTS) +# PE 2023.8 8.6 3.2.3 TBD --- stages: @@ -30,29 +29,29 @@ variables: # fail. The intended value for PUPPET_VERSION is provided by the `pup_#` YAML # anchors. If it is still `UNDEFINED`, all the other setting from the job's # anchor are also missing. - PUPPET_VERSION: 'UNDEFINED' # <- Matrixed jobs MUST override this (or fail) - BUNDLER_VERSION: '2.2.19' + PUPPET_VERSION: 'UNDEFINED' # <- Matrixed jobs MUST override this (or fail) + BUNDLER_VERSION: '2.4.22' SIMP_MATRIX_LEVEL: '1' SIMP_FORCE_RUN_MATRIX: 'no' # Force dependencies into a path the gitlab-runner user can write to. # (This avoids some failures on Runners with misconfigured ruby environments.) - GEM_HOME: .vendor/gem_install + GEM_HOME: .vendor/gem_install BUNDLE_CACHE_PATH: .vendor/bundle - BUNDLE_PATH: .vendor/bundle - BUNDLE_BIN: .vendor/gem_install/bin - BUNDLE_NO_PRUNE: 'true' + BUNDLE_PATH: .vendor/bundle + BUNDLE_BIN: .vendor/gem_install/bin + BUNDLE_NO_PRUNE: 'true' .snippets: before_beaker_google: # Logic for beaker-google environments - echo -e "\e[0Ksection_start:`date +%s`:before_script05[collapsed=true]\r\e[0KGCP environment checks" - - "if [ \"$BEAKER_HYPERVISOR\" == google ]; then mkdir -p ~/.ssh; chmod 700 ~/.ssh; test -f ~/.ssh/google_compute_engine || ssh-keygen -f ~/.ssh/google_compute_engine < /dev/null; echo 'gem \"beaker-google\"' >> Gemfile.local ; fi" + - "if [ \"$BEAKER_HYPERVISOR\" == google ]; then mkdir -p ~/.ssh; chmod 700 ~/.ssh; test -f ~/.ssh/google_compute_engine || ssh-keygen -f ~/.ssh/google_compute_engine < /dev/null; echo 'gem \"beaker-google\"' >> Gemfile.local ; fi" # yamllint disable rule:line-length - echo -e "\e[0Ksection_end:`date +%s`:before_script05\r\e[0K" before: # Print important environment variables that may affect this job - - 'ruby -e "puts %(\n\n), %q(=)*80, %(\nSIMP-relevant Environment Variables:\n\n#{e=ENV.keys.grep(/^PUPPET|^SIMP|^BEAKER|MATRIX|GOOGLE/); pad=((e.map{|x| x.size}.max||0)+1); e.map{|v| %( * #{%(#{v}:).ljust(pad)} #{39.chr + ENV[v] + 39.chr}\n)}.join}\n), %q(=)*80, %(\n\n)" || :' + - 'ruby -e "puts %(\n\n), %q(=)*80, %(\nSIMP-relevant Environment Variables:\n\n#{e=ENV.keys.grep(/^PUPPET|^SIMP|^BEAKER|MATRIX|GOOGLE/); pad=((e.map{|x| x.size}.max||0)+1); e.map{|v| %( * #{%(#{v}:).ljust(pad)} #{39.chr + ENV[v] + 39.chr}\n)}.join}\n), %q(=)*80, %(\n\n)" || :' # yamllint disable rule:line-length - echo -e "\e[0Ksection_start:`date +%s`:before_script10[collapsed=true]\r\e[0KDiagnostic ruby & gem information" # Diagnostic ruby & gem information @@ -67,7 +66,10 @@ variables: # * Use $MATRIX_RUBY_VERSION ruby, install if not present - echo -e "\e[0Ksection_start:`date +%s`:before_script20[collapsed=true]\r\e[0KEnsure RVM & ruby is installed" - "if command -v rvm; then if declare -p rvm_path &> /dev/null; then source \"${rvm_path}/scripts/rvm\"; else source \"$HOME/.rvm/scripts/rvm\" || source /etc/profile.d/rvm.sh; fi; fi" - - "if command -v rvm && ! grep rvm_install_on_use_flag=1 ~/.rvmrc; then echo rvm_install_on_use_flag=1 >> ~/.rvmrc || echo '== WARNING: ~/.rvmrc is missing rvm_install_on_use_flag=1 and I failed to add it'; fi" + - >- + if command -v rvm && ! grep rvm_install_on_use_flag=1 ~/.rvmrc; then + echo rvm_install_on_use_flag=1 >> ~/.rvmrc + || echo '== WARNING: ~/.rvmrc is missing rvm_install_on_use_flag=1 and I failed to add it'; fi - "if command -v rvm; then rvm use \"$MATRIX_RUBY_VERSION\"; else echo \"rvm not detected; skipping 'rvm use'\"; fi" - 'ruby --version || :' - 'gem list sync || :' @@ -76,13 +78,20 @@ variables: # Bundle gems (preferring cached > local > downloaded resources) # * Try to use cached and local resources before downloading dependencies - echo -e "\e[0Ksection_start:`date +%s`:before_script30[collapsed=true]\r\e[0KBundle gems (preferring cached > local > downloaded resources)" - - 'declare GEM_BUNDLER_VER=(-v "~> ${BUNDLER_VERSION:-2.2.6}")' + - 'declare GEM_BUNDLER_VER=(-v "~> ${BUNDLER_VERSION:-2.4.22}")' - 'declare GEM_INSTALL_CMD=(gem install --no-document)' - 'declare BUNDLER_INSTALL_CMD=(bundle install --no-binstubs --jobs $(nproc) "${FLAGS[@]}")' - 'mkdir -p ${GEM_HOME} ${BUNDLER_BIN}' - 'gem list -ie "${GEM_BUNDLER_VER[@]}" --silent bundler || "${GEM_INSTALL_CMD[@]}" --local "${GEM_BUNDLER_VER[@]}" bundler || "${GEM_INSTALL_CMD[@]}" "${GEM_BUNDLER_VER[@]}" bundler' - 'rm -rf pkg/ || :' - - 'bundle check || rm -f Gemfile.lock && ("${BUNDLER_INSTALL_CMD[@]}" --local || "${BUNDLER_INSTALL_CMD[@]}" || bundle pristine || "${BUNDLER_INSTALL_CMD[@]}") || { echo "PIPELINE: Bundler could not install everything (see log output above)" && exit 99 ; }' + - >- + bundle check + || rm -f Gemfile.lock + && ("${BUNDLER_INSTALL_CMD[@]}" --local + || "${BUNDLER_INSTALL_CMD[@]}" + || bundle pristine + || "${BUNDLER_INSTALL_CMD[@]}") + || { echo "PIPELINE: Bundler could not install everything (see log output above)" && exit 99 ; } - echo -e "\e[0Ksection_end:`date +%s`:before_script30\r\e[0K" # Diagnostic bundler, ruby, and gem checks: @@ -179,7 +188,6 @@ variables: when: on_success - # SIMP_MATRIX_LEVEL=1: Intended to run every commit .with_SIMP_ACCEPTANCE_MATRIX_LEVEL_1: &with_SIMP_ACCEPTANCE_MATRIX_LEVEL_1 rules: @@ -230,7 +238,7 @@ variables: # Puppet Versions -#----------------------------------------------------------------------- +# ----------------------------------------------------------------------- .pup_7_x: &pup_7_x image: 'ruby:2.7' @@ -254,9 +262,8 @@ variables: MATRIX_RUBY_VERSION: '3.2' - # Testing Environments -#----------------------------------------------------------------------- +# ----------------------------------------------------------------------- .lint_tests: &lint_tests stage: 'validation' @@ -284,7 +291,6 @@ variables: - !reference [.snippets, before] - .acceptance_base: &acceptance_base stage: 'acceptance' <<: *setup_bundler_env @@ -299,7 +305,7 @@ variables: # Pipeline / testing matrix -#======================================================================= +# ======================================================================= releng_checks: <<: *pup_7_x @@ -317,7 +323,7 @@ releng_checks: # Linting -#----------------------------------------------------------------------- +# ----------------------------------------------------------------------- # NOTE: Don't add more lint checks here. # puppet-lint is a validator, not a parser; it includes its own lexer and @@ -329,7 +335,7 @@ pup-lint: <<: *lint_tests # Unit Tests -#----------------------------------------------------------------------- +# ----------------------------------------------------------------------- pup7.x-unit: <<: *pup_7_x @@ -340,10 +346,9 @@ pup7.pe-unit: <<: *pup_7_pe <<: *unit_tests -# Commenting until Puppet 8 is released -#pup8.x-unit: -# <<: *pup_8_x -# <<: *unit_tests +pup8.x-unit: + <<: *pup_8_x + <<: *unit_tests # ------------------------------------------------------------------------------ # NOTICE: **This file is maintained with puppetsync** diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 223b5ac..e076f23 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + # # ------------------------------------------------------------------------------ # NOTICE: **This file is maintained with puppetsync** @@ -86,7 +87,7 @@ def set_hieradata(hieradata) # If nothing else... c.default_facts = { production: { - #:fqdn => 'production.rspec.test.localdomain', + # :fqdn => 'production.rspec.test.localdomain', path: '/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin', concat_basedir: '/tmp' } @@ -147,9 +148,9 @@ def set_hieradata(hieradata) # sanitize hieradata if defined?(hieradata) - set_hieradata(hieradata.gsub(':', '_')) + set_hieradata(hieradata.tr(':', '_')) elsif defined?(class_name) - set_hieradata(class_name.gsub(':', '_')) + set_hieradata(class_name.tr(':', '_')) end end