Merge pull request #9 from voxpupuli/modulesync

modulesync 4.2.0
This commit is contained in:
Tim Meusel 2021-08-26 12:17:28 +02:00 committed by GitHub
commit 4a6e879d72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 101 additions and 78 deletions

View file

@ -1,6 +1,7 @@
# editorconfig.org # editorconfig.org
# MANAGED BY MODULESYNC # Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
root = true root = true

View file

@ -25,7 +25,7 @@ By participating in this project you agree to abide by its terms.
* Fork the repo. * Fork the repo.
* Create a separate branch for your change. * Create a separate branch for your change.
* We only take pull requests with passing tests, and documentation. [travis-ci](http://travis-ci.org) runs the tests for us. You can also execute them locally. This is explained [in a later section](#the-test-matrix). * We only take pull requests with passing tests, and documentation. [GitHub Actions](https://docs.github.com/en/actions) run the tests for us. You can also execute them locally. This is explained [in a later section](#the-test-matrix).
* Checkout [our docs](https://voxpupuli.org/docs/reviewing_pr/) we use to review a module and the [official styleguide](https://puppet.com/docs/puppet/6.0/style_guide.html). They provide some guidance for new code that might help you before you submit a pull request. * Checkout [our docs](https://voxpupuli.org/docs/reviewing_pr/) we use to review a module and the [official styleguide](https://puppet.com/docs/puppet/6.0/style_guide.html). They provide some guidance for new code that might help you before you submit a pull request.
* Add a test for your change. Only refactoring and documentation changes require no new tests. If you are adding functionality or fixing a bug, please add a test. * Add a test for your change. Only refactoring and documentation changes require no new tests. If you are adding functionality or fixing a bug, please add a test.
* Squash your commits down into logical components. Make sure to rebase against our current master. * Squash your commits down into logical components. Make sure to rebase against our current master.
@ -232,33 +232,7 @@ simple tests against it after applying the module. You can run this
with: with:
```sh ```sh
bundle exec rake beaker BEAKER_setfile=debian10-x64 bundle exec rake beaker
```
This will run the tests on the module's default nodeset. You can override the
nodeset used, e.g.,
```sh
BEAKER_set=centos-7-x64 bundle exec rake beaker
```
There are default rake tasks for the various acceptance test modules, e.g.,
```sh
bundle exec rake beaker:centos-7-x64
bundle exec rake beaker:ssh:centos-7-x64
```
If you don't want to have to recreate the virtual machine every time you can
use `BEAKER_destroy=no` and `BEAKER_provision=no`. On the first run you will at
least need `BEAKER_provision` set to yes (the default). The Vagrantfile for the
created virtual machines will be in `.vagrant/beaker_vagrant_files`.
Beaker also supports docker containers. We also use that in our automated CI
pipeline at [travis-ci](http://travis-ci.org). To use that instead of Vagrant:
```sh
PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian10-64{hypervisor=docker} BEAKER_destroy=yes bundle exec rake beaker
``` ```
You can replace the string `debian10` with any common operating system. You can replace the string `debian10` with any common operating system.
@ -272,11 +246,7 @@ The following strings are known to work:
* centos7 * centos7
* centos8 * centos8
The easiest way to debug in a docker container is to open a shell: For more information and tips & tricks, see [voxpupuli-acceptance's documentation](https://github.com/voxpupuli/voxpupuli-acceptance#running-tests).
```sh
docker exec -it -u root ${container_id_or_name} bash
```
The source of this file is in our [modulesync_config](https://github.com/voxpupuli/modulesync_config/blob/master/moduleroot/.github/CONTRIBUTING.md.erb) The source of this file is in our [modulesync_config](https://github.com/voxpupuli/modulesync_config/blob/master/moduleroot/.github/CONTRIBUTING.md.erb)
repository. repository.

View file

@ -1,3 +1,7 @@
---
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
name: CI name: CI
on: pull_request on: pull_request
@ -6,21 +10,23 @@ jobs:
setup_matrix: setup_matrix:
name: 'Setup Test Matrix' name: 'Setup Test Matrix'
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 40
outputs: outputs:
beaker_setfiles: ${{ steps.get-outputs.outputs.beaker_setfiles }}
puppet_major_versions: ${{ steps.get-outputs.outputs.puppet_major_versions }}
puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }} puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }}
github_action_test_matrix: ${{ steps.get-outputs.outputs.github_action_test_matrix }}
env: env:
BUNDLE_WITHOUT: development:test:release BUNDLE_WITHOUT: development:system_tests:release
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Setup ruby - name: Setup ruby
uses: ruby/setup-ruby@v1 uses: ruby/setup-ruby@v1
with: with:
ruby-version: '2.7' ruby-version: '3.0'
bundler-cache: true bundler-cache: true
- name: Run rake validate - name: Run static validations
run: bundle exec rake validate run: bundle exec rake validate lint check
- name: Run rake rubocop
run: bundle exec rake rubocop
- name: Setup Test Matrix - name: Setup Test Matrix
id: get-outputs id: get-outputs
run: bundle exec metadata2gha --use-fqdn --pidfile-workaround false run: bundle exec metadata2gha --use-fqdn --pidfile-workaround false
@ -28,6 +34,7 @@ jobs:
unit: unit:
needs: setup_matrix needs: setup_matrix
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 40
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -44,7 +51,7 @@ jobs:
ruby-version: ${{ matrix.ruby }} ruby-version: ${{ matrix.ruby }}
bundler-cache: true bundler-cache: true
- name: Run tests - name: Run tests
run: bundle exec rake run: bundle exec rake parallel_spec
acceptance: acceptance:
needs: setup_matrix needs: setup_matrix
@ -54,22 +61,26 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
setfile: ${{fromJson(needs.setup_matrix.outputs.beaker_setfiles)}} include: ${{fromJson(needs.setup_matrix.outputs.github_action_test_matrix)}}
puppet: ${{fromJson(needs.setup_matrix.outputs.puppet_major_versions)}}
name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }} name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }}
steps: steps:
- name: Enable IPv6 on docker
run: |
echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json
sudo service docker restart
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Setup ruby - name: Setup ruby
uses: ruby/setup-ruby@v1 uses: ruby/setup-ruby@v1
with: with:
ruby-version: '2.7' ruby-version: '3.0'
bundler-cache: true bundler-cache: true
- name: Run tests - name: Run tests
run: bundle exec rake beaker run: bundle exec rake beaker
env: env:
BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet.collection }} BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet.collection }}
BEAKER_setfile: ${{ matrix.setfile.value }} BEAKER_setfile: ${{ matrix.setfile.value }}
tests:
needs:
- unit
- acceptance
runs-on: ubuntu-latest
name: Test suite
steps:
- run: echo Test suite completed

View file

@ -1,3 +1,7 @@
---
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
name: Release name: Release
on: on:
@ -12,6 +16,7 @@ jobs:
deploy: deploy:
name: 'deploy to forge' name: 'deploy to forge'
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.repository_owner == 'voxpupuli'
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 uses: actions/checkout@v2

3
.gitignore vendored
View file

@ -1,3 +1,6 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
pkg/ pkg/
Gemfile.lock Gemfile.lock
Gemfile.local Gemfile.local

View file

@ -1,2 +1,5 @@
--- ---
modulesync_config_version: '4.0.0' # Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
modulesync_config_version: '4.2.0'

View file

@ -1,4 +1,5 @@
# Managed by https://github.com/voxpupuli/modulesync_configs # Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
# #
# Hooks are only enabled if you take action. # Hooks are only enabled if you take action.
# #

View file

@ -1,3 +1,6 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
docs/ docs/
pkg/ pkg/
Gemfile Gemfile

3
.rspec
View file

@ -1,2 +1,5 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
--format documentation --format documentation
--color --color

View file

@ -1 +1,4 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
--format progress --format progress

View file

@ -1,3 +1,6 @@
--- ---
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
inherit_gem: inherit_gem:
voxpupuli-test: rubocop.yml voxpupuli-test: rubocop.yml

5
.sync.yml Normal file
View file

@ -0,0 +1,5 @@
---
Gemfile:
optional:
':test':
- gem: puppet-lint-param-docs

View file

@ -1,2 +0,0 @@
--markup markdown
--output-dir docs/

View file

@ -1,4 +1,7 @@
FROM ruby:2.5.3 # MANAGED BY MODULESYNC
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
FROM ruby:2.7
WORKDIR /opt/puppet WORKDIR /opt/puppet

18
Gemfile
View file

@ -1,9 +1,14 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
source ENV['GEM_SOURCE'] || "https://rubygems.org" source ENV['GEM_SOURCE'] || "https://rubygems.org"
group :test do group :test do
gem 'voxpupuli-test', '~> 2.1', :require => false gem 'voxpupuli-test', '~> 2.5', :require => false
gem 'coveralls', :require => false gem 'coveralls', :require => false
gem 'simplecov-console', :require => false gem 'simplecov-console', :require => false
gem 'puppet_metadata', '~> 1.0', :require => false
gem 'puppet-lint-param-docs', :require => false
end end
group :development do group :development do
@ -12,22 +17,19 @@ group :development do
end end
group :system_tests do group :system_tests do
gem 'puppet_metadata', '~> 0.3.0', :require => false gem 'voxpupuli-acceptance', '~> 1.0', :require => false
gem 'voxpupuli-acceptance', :require => false
end end
group :release do group :release do
gem 'github_changelog_generator', :require => false, :git => 'https://github.com/voxpupuli/github-changelog-generator', :branch => 'voxpupuli_essential_fixes' gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5'
gem 'puppet-blacksmith', :require => false gem 'voxpupuli-release', '>= 1.0.2', :require => false
gem 'voxpupuli-release', :require => false
gem 'puppet-strings', '>= 2.2', :require => false gem 'puppet-strings', '>= 2.2', :require => false
end end
gem 'puppetlabs_spec_helper', '~> 2.0', :require => false
gem 'rake', :require => false gem 'rake', :require => false
gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test]
puppetversion = ENV['PUPPET_VERSION'] || '~> 6.0' puppetversion = ENV['PUPPET_VERSION'] || '>= 6.0'
gem 'puppet', puppetversion, :require => false, :groups => [:test] gem 'puppet', puppetversion, :require => false, :groups => [:test]
# vim: syntax=ruby # vim: syntax=ruby

View file

@ -1,9 +1,22 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
# Attempt to load voxupuli-test (which pulls in puppetlabs_spec_helper), # Attempt to load voxupuli-test (which pulls in puppetlabs_spec_helper),
# otherwise attempt to load it directly. # otherwise attempt to load it directly.
begin begin
require 'voxpupuli/test/rake' require 'voxpupuli/test/rake'
rescue LoadError rescue LoadError
begin
require 'puppetlabs_spec_helper/rake_tasks' require 'puppetlabs_spec_helper/rake_tasks'
rescue LoadError
end
end
# load optional tasks for acceptance
# only available if gem group releases is installed
begin
require 'voxpupuli/acceptance/rake'
rescue LoadError
end end
# load optional tasks for releases # load optional tasks for releases
@ -34,14 +47,12 @@ begin
require 'github_changelog_generator/task' require 'github_changelog_generator/task'
require 'puppet_blacksmith' require 'puppet_blacksmith'
GitHubChangelogGenerator::RakeTask.new :changelog do |config| GitHubChangelogGenerator::RakeTask.new :changelog do |config|
version = (Blacksmith::Modulefile.new).version metadata = Blacksmith::Modulefile.new
config.future_release = "v#{version}" if version =~ /^\d+\.\d+.\d+$/ config.future_release = "v#{metadata.version}" if metadata.version =~ /^\d+\.\d+.\d+$/
config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module." config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module."
config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog} config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog}
config.user = 'voxpupuli' config.user = 'voxpupuli'
metadata_json = File.join(File.dirname(__FILE__), 'metadata.json') config.project = metadata.metadata['name']
metadata = JSON.load(File.read(metadata_json))
config.project = metadata['name']
end end
# Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715 # Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715

View file

@ -1,10 +1,9 @@
require 'spec_helper_acceptance' require 'spec_helper_acceptance'
describe 'hashi_stack::repo class' do describe 'hashi_stack::repo class' do
context 'default parameters' do context 'default parameters' do
# Using puppet_apply as a helper # Using puppet_apply as a helper
it 'should work with no errors based on the example' do it 'works with no errors based on the example' do
pp = <<-EOS pp = <<-EOS
include hashi_stack::repo include hashi_stack::repo
package { 'packer': package { 'packer':

View file

@ -11,10 +11,10 @@ describe 'hashi_stack::repo' do
when 'RedHat' when 'RedHat'
it { it {
is_expected.to contain_yumrepo('HashiCorp').with( is_expected.to contain_yumrepo('HashiCorp').with(
baseurl: 'https://rpm.releases.hashicorp.com/RHEL/$releasever/$basearch/stable', baseurl: 'https://rpm.releases.hashicorp.com/RHEL/$releasever/$basearch/stable'
) )
} }
context "with custom Yum base url" do context 'with custom Yum base url' do
let(:params) do let(:params) do
{ {
rpm_base: 'https://somewhere.else' rpm_base: 'https://somewhere.else'
@ -23,7 +23,7 @@ describe 'hashi_stack::repo' do
it { it {
is_expected.to contain_yumrepo('HashiCorp').with( is_expected.to contain_yumrepo('HashiCorp').with(
baseurl: 'https://somewhere.else/RHEL/$releasever/$basearch/stable', baseurl: 'https://somewhere.else/RHEL/$releasever/$basearch/stable'
) )
} }
end end

View file

@ -1,6 +1,5 @@
# This file is managed via modulesync # Managed by modulesync - DO NOT EDIT
# https://github.com/voxpupuli/modulesync # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
# https://github.com/voxpupuli/modulesync_config
# puppetlabs_spec_helper will set up coverage if the env variable is set. # 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. # We want to do this if lib exists and it hasn't been explicitly set.