Skip to content

Commit

Permalink
Merge pull request #196 from jcpunk/modulesync
Browse files Browse the repository at this point in the history
modulesync 5.3.0
  • Loading branch information
ekohl authored Jul 6, 2022
2 parents 7716664 + 6cd4136 commit 53f422e
Show file tree
Hide file tree
Showing 17 changed files with 104 additions and 166 deletions.
7 changes: 3 additions & 4 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ If you have Ruby 2.x or want a specific version of Puppet,
you must set an environment variable such as:

```sh
export PUPPET_VERSION="~> 5.5.6"
export PUPPET_GEM_VERSION="~> 6.1.0"
```

You can install all needed gems for spec tests into the modules directory by
Expand Down Expand Up @@ -232,17 +232,16 @@ simple tests against it after applying the module. You can run this
with:

```sh
BEAKER_setfile=debian10-x64 bundle exec rake beaker
BEAKER_setfile=debian11-64 bundle exec rake beaker
```

You can replace the string `debian10` with any common operating system.
The following strings are known to work:

* ubuntu1604
* ubuntu1804
* ubuntu2004
* debian9
* debian10
* debian11
* centos7
* centos8

Expand Down
84 changes: 6 additions & 78 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,84 +7,12 @@ name: CI
on: pull_request

concurrency:
group: ${{ github.head_ref }}
group: ${{ github.ref_name }}
cancel-in-progress: true

jobs:
setup_matrix:
name: 'Setup Test Matrix'
runs-on: ubuntu-latest
timeout-minutes: 40
outputs:
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:
BUNDLE_WITHOUT: development:system_tests:release
steps:
- uses: actions/checkout@v2
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
- name: Run static validations
run: bundle exec rake validate lint check
- name: Run rake rubocop
run: bundle exec rake rubocop
- name: Setup Test Matrix
id: get-outputs
run: bundle exec metadata2gha --use-fqdn --pidfile-workaround false

unit:
needs: setup_matrix
runs-on: ubuntu-latest
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
include: ${{fromJson(needs.setup_matrix.outputs.puppet_unit_test_matrix)}}
env:
BUNDLE_WITHOUT: development:system_tests:release
PUPPET_VERSION: "~> ${{ matrix.puppet }}.0"
name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }})
steps:
- uses: actions/checkout@v2
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run tests
run: bundle exec rake parallel_spec

acceptance:
needs: setup_matrix
runs-on: ubuntu-latest
env:
BUNDLE_WITHOUT: development:test:release
strategy:
fail-fast: false
matrix:
include: ${{fromJson(needs.setup_matrix.outputs.github_action_test_matrix)}}
name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }}
steps:
- uses: actions/checkout@v2
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
- name: Run tests
run: bundle exec rake beaker
env:
BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet.collection }}
BEAKER_setfile: ${{ matrix.setfile.value }}

tests:
needs:
- unit
- acceptance
runs-on: ubuntu-latest
name: Test suite
steps:
- run: echo Test suite completed
puppet:
name: Puppet
uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v1
with:
pidfile_workaround: 'false'
32 changes: 10 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,14 @@ on:
tags:
- '*'

env:
BUNDLE_WITHOUT: development:test:system_tests

jobs:
deploy:
name: 'deploy to forge'
runs-on: ubuntu-latest
if: github.repository_owner == 'voxpupuli'
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
bundler-cache: true
- name: Build and Deploy
env:
# Configure secrets here:
# https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets
BLACKSMITH_FORGE_USERNAME: '${{ secrets.PUPPET_FORGE_USERNAME }}'
BLACKSMITH_FORGE_API_KEY: '${{ secrets.PUPPET_FORGE_API_KEY }}'
run: bundle exec rake module:push
release:
name: Release
uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v1
with:
allowed_owner: 'voxpupuli'
secrets:
# Configure secrets here:
# https://docs.github.com/en/actions/security-guides/encrypted-secrets
username: ${{ secrets.PUPPET_FORGE_USERNAME }}
api_key: ${{ secrets.PUPPET_FORGE_API_KEY }}
2 changes: 1 addition & 1 deletion .msync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

modulesync_config_version: '4.2.0'
modulesync_config_version: '5.3.0'
3 changes: 3 additions & 0 deletions .puppet-lint.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--fail-on-warnings
--no-parameter_documentation-check
--no-parameter_types-check
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ WORKDIR /opt/puppet
# https://github.com/puppetlabs/puppet/blob/06ad255754a38f22fb3a22c7c4f1e2ce453d01cb/lib/puppet/provider/service/runit.rb#L39
RUN mkdir -p /etc/sv

ARG PUPPET_VERSION="~> 6.0"
ARG PUPPET_GEM_VERSION="~> 6.0"
ARG PARALLEL_TEST_PROCESSORS=4

# Cache gems
Expand Down
8 changes: 4 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# 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
gem 'voxpupuli-test', '~> 2.5', :require => false
gem 'voxpupuli-test', '~> 5.4', :require => false
gem 'coveralls', :require => false
gem 'simplecov-console', :require => false
gem 'puppet_metadata', '~> 1.0', :require => false
Expand All @@ -21,14 +21,14 @@ end

group :release do
gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5'
gem 'voxpupuli-release', '>= 1.0.2', :require => false
gem 'voxpupuli-release', '>= 1.2.0', :require => false
gem 'puppet-strings', '>= 2.2', :require => false
end

gem 'rake', :require => false
gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test]

puppetversion = ENV['PUPPET_VERSION'] || '>= 6.0'
puppetversion = ENV['PUPPET_GEM_VERSION'] || '>= 6.0'
gem 'puppet', puppetversion, :require => false, :groups => [:test]

# vim: syntax=ruby
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# 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 voxpupuli-test (which pulls in puppetlabs_spec_helper),
# otherwise attempt to load it directly.
begin
require 'voxpupuli/test/rake'
Expand Down
2 changes: 2 additions & 0 deletions spec/acceptance/class_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'spec_helper_acceptance'

describe 'logrotate class' do
Expand Down
22 changes: 10 additions & 12 deletions spec/classes/defaults_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'logrotate' do
Expand All @@ -10,6 +12,7 @@
is_expected.to contain_logrotate__conf('/etc/logrotate.conf')
}
end

on_supported_os.each do |os, facts|
context os, if: facts[:osfamily] == 'Debian' do
let(:facts) { facts }
Expand Down Expand Up @@ -39,6 +42,7 @@
'missingok' => true
)
}

it {
is_expected.to contain_logrotate__rule('btmp').with(
'rotate_every' => 'monthly',
Expand All @@ -51,12 +55,14 @@
)
}
end

context os, if: facts[:osfamily] == 'RedHat' do
let(:facts) { facts }

it {
is_expected.to contain_logrotate__conf('/etc/logrotate.conf')
}

it {
is_expected.to contain_logrotate__rule('wtmp').with(
'path' => '/var/log/wtmp',
Expand All @@ -70,6 +76,7 @@
'rotate_every' => 'monthly'
)
}

it {
is_expected.to contain_logrotate__rule('btmp').with(
'path' => '/var/log/btmp',
Expand All @@ -83,10 +90,12 @@
)
}
end

context os, if: facts[:osfamily] == 'Suse' do
it {
is_expected.to contain_logrotate__conf('/etc/logrotate.conf')
}

it {
is_expected.to contain_logrotate__rule('wtmp').with(
'path' => '/var/log/wtmp',
Expand All @@ -103,25 +112,14 @@
)
}
end
context os, if: facts[:osfamily] == 'FreeBSD' do
let(:facts) { facts }

it {
is_expected.to contain_logrotate__conf('/usr/local/etc/logrotate.conf')
}
it {
is_expected.to contain_logrotate__conf('/usr/local/etc/logrotate.conf').with(
'su_user' => 'root',
'su_group' => 'wheel'
)
}
end
context os, if: facts[:osfamily] == 'FreeBSD' do
let(:facts) { facts }

it {
is_expected.to contain_logrotate__conf('/usr/local/etc/logrotate.conf')
}

it {
is_expected.to contain_logrotate__conf('/usr/local/etc/logrotate.conf').with(
'su_user' => 'root',
Expand Down
21 changes: 12 additions & 9 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'logrotate' do
Expand All @@ -11,6 +13,7 @@
context 'logrotate class without any parameters' do
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('logrotate') }

%w[install config params rules].each do |classs|
it { is_expected.to contain_class("logrotate::#{classs}") }
end
Expand All @@ -30,9 +33,9 @@
is_expected.to contain_package('logrotate').with_ensure('present')

is_expected.to contain_file('/usr/local/etc/logrotate.d').with('ensure' => 'directory',
'owner' => 'root',
'group' => 'wheel',
'mode' => '0755')
'owner' => 'root',
'group' => 'wheel',
'mode' => '0755')

is_expected.to contain_class('logrotate::defaults')
end
Expand All @@ -59,14 +62,14 @@
is_expected.to contain_package('logrotate').with_ensure('present')

is_expected.to contain_file('/etc/logrotate.d').with('ensure' => 'directory',
'owner' => 'root',
'group' => 'root',
'mode' => '0755')
'owner' => 'root',
'group' => 'root',
'mode' => '0755')

is_expected.to contain_file('/etc/cron.daily/logrotate').with('ensure' => 'present',
'owner' => 'root',
'group' => 'root',
'mode' => '0700')
'owner' => 'root',
'group' => 'root',
'mode' => '0700')

is_expected.to contain_class('logrotate::defaults')
end
Expand Down
Loading

0 comments on commit 53f422e

Please sign in to comment.