From 8572c51f59a3de6457ae95d2899d4b44addc1ad3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Tue, 18 Jun 2024 08:58:34 -1000 Subject: [PATCH] Sync with Vox Pupuli --- .github/workflows/main.yml | 45 +++++++++++++++++--- config_defaults.yml | 16 +++---- moduleroot/.github/labeler.yml.erb | 3 ++ moduleroot/.github/workflows/ci.yml.erb | 36 +++++++--------- moduleroot/.github/workflows/labeler.yml | 14 ++++++ moduleroot/.github/workflows/release.yml.erb | 13 +++++- moduleroot/.gitignore.erb | 4 +- moduleroot/.pmtignore.erb | 1 + moduleroot/spec/spec_helper.rb.erb | 14 +++--- modulesync.yml | 4 ++ 10 files changed, 106 insertions(+), 44 deletions(-) create mode 100644 moduleroot/.github/labeler.yml.erb create mode 100644 moduleroot/.github/workflows/labeler.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1e36425..b77ac82 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,23 +1,58 @@ name: noop run on: + workflow_dispatch: {} + pull_request: {} push: branches: - master - pull_request: - branches: - - master jobs: unit: runs-on: ubuntu-latest name: Run msync --noop against all modules steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Setup ruby uses: ruby/setup-ruby@v1 with: ruby-version: 2.7 bundler-cache: true - name: Run msync --noop - run: bundle exec msync update --noop --git-base=https://github.com/ + run: bundle exec msync update --noop --git-base=https://github.com/ --branch foobranch + metadata_json_deps: + runs-on: ubuntu-latest + name: Run metadata_json_deps on all modules + steps: + - uses: actions/checkout@v4 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7 + bundler-cache: true + - name: Run msync --noop + run: bundle exec msync clone --git-base=https://github.com/ + - run: bundle exec rake metadata_deps + outdated_module_summary: + runs-on: ubuntu-latest + name: Prints a list of all modules with outdated modulesync_config version + steps: + - uses: actions/checkout@v4 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7 + bundler-cache: true + - name: Run msync --noop + run: bundle exec msync clone --git-base=https://github.com/ + - name: Generate summary + run: bundle exec bin/outdated_modules_and_their_version + + tests: + needs: + - unit + - metadata_json_deps + runs-on: ubuntu-latest + name: Test suite + steps: + - run: echo Test suite completed diff --git a/config_defaults.yml b/config_defaults.yml index a4e0b83..0e4ac8b 100644 --- a/config_defaults.yml +++ b/config_defaults.yml @@ -3,9 +3,8 @@ extra_owners: [] .github/workflows/ci.yml: excludes: [] - pidfile_workaround: false - additional_packages: '' acceptance_tests: true + main_branches: ['main'] # PDK creates this .github/workflows/puppet-lint.yml: delete: true @@ -18,25 +17,21 @@ Gemfile: required: ':test': - gem: voxpupuli-test - version: '~> 7.0' + version: '~> 8.0' - gem: coveralls - gem: simplecov-console - gem: puppet_metadata - version: '~> 3.0' + version: '~> 4.0' ':development': - gem: guard-rake - gem: overcommit version: '>= 0.39.1' ':system_tests': - gem: voxpupuli-acceptance - version: '~> 2.0' + version: '~> 3.0' ':release': - - gem: github_changelog_generator - version: '>= 1.16.1' - gem: voxpupuli-release version: '~> 3.0' - - gem: faraday-retry - version: '~> 2.1' Rakefile: config.user: opus-codium # config.project: PROJECT @@ -64,6 +59,8 @@ spec/acceptance/nodesets/centos-66-x64-pe.yml: delete: true spec/acceptance/nodesets/centos-7-x64.yml: delete: true +spec/acceptance/nodesets/centos-7.yml: + delete: true spec/acceptance/nodesets/centos-72-x64.yml: delete: true spec/acceptance/nodesets/debian-78-x64.yml: @@ -116,6 +113,7 @@ spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml: delete: true spec/spec_helper.rb: add_mocked_facts: true + facterdb_string_keys: false mock_with: false spec/spec_helper_acceptance.rb: unmanaged: true diff --git a/moduleroot/.github/labeler.yml.erb b/moduleroot/.github/labeler.yml.erb new file mode 100644 index 0000000..7899de8 --- /dev/null +++ b/moduleroot/.github/labeler.yml.erb @@ -0,0 +1,3 @@ +--- +skip-changelog: + - head-branch: ['^release-*', 'release'] diff --git a/moduleroot/.github/workflows/ci.yml.erb b/moduleroot/.github/workflows/ci.yml.erb index 766ca52..d9c1580 100644 --- a/moduleroot/.github/workflows/ci.yml.erb +++ b/moduleroot/.github/workflows/ci.yml.erb @@ -4,7 +4,13 @@ name: CI -on: pull_request +on: + pull_request: {} + push: + branches: +<%- @configs['main_branches'].each do |main_branch| -%> + - <%= main_branch %> +<%- end -%> concurrency: group: ${{ github.ref_name }} @@ -14,27 +20,17 @@ jobs: puppet: name: Puppet <%- if @configs['acceptance_tests'] && Dir[File.join(@metadata[:workdir], 'spec', 'acceptance', '**', '*_spec.rb')].any? -%> - uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v1 - with: - pidfile_workaround: '<%= @configs['pidfile_workaround'] %>' -<%- if @configs['unit_runs_on'] -%> - unit_runs_on: '<%= @configs['unit_runs_on'] %>' -<%- end -%> -<%- if @configs['acceptance_runs_on'] -%> - acceptance_runs_on: '<%= @configs['acceptance_runs_on'] %>' -<%- end -%> + uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v2 <%- else -%> - uses: voxpupuli/gha-puppet/.github/workflows/basic.yml@v1 -<%- if @configs.key?('rubocop') || !@configs['additional_packages'].empty? || @configs.key?('unit_runs_on') -%> - with: -<%- end -%> + uses: voxpupuli/gha-puppet/.github/workflows/basic.yml@v2 <%- end -%> -<%- unless @configs['additional_packages'].empty? -%> - additional_packages: '<%= @configs['additional_packages'] %>' +<%- if @configs['with'] -%> + with: +<%- @configs['with'].each do |k,v| -%> +<%- if v.is_a?(String) -%> + <%= k %>: '<%= v %>' +<%- else -%> + <%= k %>: <%= v %> <%- end -%> -<%- if @configs.key?('rubocop') -%> - rubocop: <%= @configs['rubocop'] %> <%- end -%> -<%- if Dir[File.join(@metadata[:workdir], 'spec', 'acceptance', '**', '*_spec.rb')].none? && @configs['unit_runs_on'] -%> - unit_runs_on: '<%= @configs['unit_runs_on'] %>' <%- end -%> diff --git a/moduleroot/.github/workflows/labeler.yml b/moduleroot/.github/workflows/labeler.yml new file mode 100644 index 0000000..c708d34 --- /dev/null +++ b/moduleroot/.github/workflows/labeler.yml @@ -0,0 +1,14 @@ +--- +name: "Pull Request Labeler" + +on: + pull_request_target: {} + +jobs: + labeler: + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v5 diff --git a/moduleroot/.github/workflows/release.yml.erb b/moduleroot/.github/workflows/release.yml.erb index 464edae..4e2efb9 100644 --- a/moduleroot/.github/workflows/release.yml.erb +++ b/moduleroot/.github/workflows/release.yml.erb @@ -12,9 +12,20 @@ on: jobs: release: name: Release - uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v1 + uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v2 with: +<%- if @configs['with'] -%> +<%- @configs['with'].each do |k,v| -%> +<%- if v.is_a?(String) -%> + <%= k %>: '<%= v %>' +<%- else -%> + <%= k %>: <%= v %> +<%- end -%> +<%- end -%> +<%- end -%> +<%- unless @configs['with']&.has_key?('allowed_owner') -%> allowed_owner: '<%= @configs[:namespace] %>' +<%- end -%> secrets: # Configure secrets here: # https://docs.github.com/en/actions/security-guides/encrypted-secrets diff --git a/moduleroot/.gitignore.erb b/moduleroot/.gitignore.erb index df67d1d..0d953ba 100644 --- a/moduleroot/.gitignore.erb +++ b/moduleroot/.gitignore.erb @@ -21,7 +21,9 @@ .*.sw? /.yardoc/ /Guardfile -<% if ! @configs['paths'].nil? -%> +bolt-debug.log +.rerun.json +<% unless @configs['paths'].nil? -%> <% @configs['paths'].each do |path| -%> <%= path %> <% end -%> diff --git a/moduleroot/.pmtignore.erb b/moduleroot/.pmtignore.erb index 71feddc..ed53778 100644 --- a/moduleroot/.pmtignore.erb +++ b/moduleroot/.pmtignore.erb @@ -35,6 +35,7 @@ /.yardoc/ /.yardopts /Dockerfile +/HISTORY.md <% if ! @configs['paths'].nil? -%> <% @configs['paths'].each do |path| -%> <%= path %> diff --git a/moduleroot/spec/spec_helper.rb.erb b/moduleroot/spec/spec_helper.rb.erb index 0068314..bd16fe9 100644 --- a/moduleroot/spec/spec_helper.rb.erb +++ b/moduleroot/spec/spec_helper.rb.erb @@ -2,24 +2,22 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -<%- if @configs['mock_with'] -%> - -RSpec.configure do |c| - c.mock_with <%= @configs['mock_with'] %> -end -<%- end -%> # puppetlabs_spec_helper will set up coverage if the env variable is set. # We want to do this if lib exists and it hasn't been explicitly set. ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../lib', __dir__)) require 'voxpupuli/test/spec_helper' -<%- if @configs['hiera_config'] -%> RSpec.configure do |c| + c.facterdb_string_keys = <%= @configs['facterdb_string_keys'] %> +<%- if @configs['hiera_config'] -%> c.hiera_config = <%= @configs['hiera_config'] %> -end <%- end -%> +<%- if @configs['mock_with'] -%> + c.mock_with = <%= @configs['mock_with'] %> +<%- end -%> +end <%- if @configs['add_mocked_facts'] -%> add_mocked_facts! diff --git a/modulesync.yml b/modulesync.yml index 8032697..7c8f020 100644 --- a/modulesync.yml +++ b/modulesync.yml @@ -1,3 +1,7 @@ --- +git_base: 'git@github.com:' namespace: opus-codium branch: modulesync +message: "Update from Opus-Codium modulesync_config" +... +# vim: syntax=yaml