Skip to content

Commit 22d8728

Browse files
bastelfreakalexjfisher
authored andcommitted
modulesync 2.7.0 (#242)
* modulesync 2.7.0 * puppet-lint: fix relative_classname_inclusion * add augeas_core to fixtures.yml * Fix test failures on Ruby 2.5+ Tests stopped working on ruby 2.5 due to https://blog.bigbinary.com/2017/10/18/ruby-2.5-has-removed-top-level-constant-lookup.html
1 parent f992867 commit 22d8728

29 files changed

+222
-309
lines changed

.editorconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# editorconfig.org
2+
3+
# MANAGED BY MODULESYNC
4+
5+
root = true
6+
7+
[*]
8+
charset = utf-8
9+
end_of_line = lf
10+
indent_size = 2
11+
tab_width = 2
12+
indent_style = space
13+
insert_final_newline = true
14+
trim_trailing_whitespace = true

.fixtures.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ fixtures:
55
stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib'
66
boolean: 'https://github.com/voxpupuli/puppet-boolean'
77
filemapper: 'https://github.com/voxpupuli/puppet-filemapper'
8-
symlinks:
9-
network: "#{source_dir}"
10-
8+
augeas_core:
9+
repo: https://github.com/puppetlabs/puppetlabs-augeas_core.git
10+
puppet_version: ">= 6.0.0"

.github/CONTRIBUTING.md

Lines changed: 92 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,20 @@ By participating in this project you agree to abide by its terms.
1212

1313
1. Create a separate branch for your change.
1414

15-
1. Run the tests. We only take pull requests with passing tests, and
16-
documentation.
15+
1. We only take pull requests with passing tests, and documentation. [travis-ci](http://travis-ci.org)
16+
runs the tests for us. You can also execute them locally. This is explained
17+
in a later section.
18+
19+
1. Checkout [our docs](https://voxpupuli.org/docs/#reviewing-a-module-pr) we
20+
use to review a module and the [official styleguide](https://puppet.com/docs/puppet/6.0/style_guide.html).
21+
They provide some guidance for new code that might help you before you submit a pull request.
1722

1823
1. Add a test for your change. Only refactoring and documentation
1924
changes require no new tests. If you are adding functionality
2025
or fixing a bug, please add a test.
2126

2227
1. Squash your commits down into logical components. Make sure to rebase
23-
against the current master.
28+
against our current master.
2429

2530
1. Push the branch to your fork and submit a pull request.
2631

@@ -38,25 +43,46 @@ By default the tests use a baseline version of Puppet.
3843
If you have Ruby 2.x or want a specific version of Puppet,
3944
you must set an environment variable such as:
4045

41-
export PUPPET_VERSION="~> 4.2.0"
46+
```sh
47+
export PUPPET_VERSION="~> 5.5.6"
48+
```
49+
50+
You can install all needed gems for spec tests into the modules directory by
51+
running:
52+
53+
```sh
54+
bundle install --path .vendor/ --without development system_tests release
55+
```
56+
57+
If you also want to run acceptance tests:
4258

43-
Install the dependencies like so...
59+
```sh
60+
bundle install --path .vendor/ --with system_tests --without development release
61+
```
4462

45-
bundle install
63+
Our all in one solution if you don't know if you need to install or update gems:
64+
65+
```sh
66+
bundle install --path .vendor/ --with system_tests --without development release; bundle update; bundle clean
67+
```
4668

4769
## Syntax and style
4870

4971
The test suite will run [Puppet Lint](http://puppet-lint.com/) and
5072
[Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to
5173
check various syntax and style things. You can run these locally with:
5274

53-
bundle exec rake lint
54-
bundle exec rake validate
75+
```sh
76+
bundle exec rake lint
77+
bundle exec rake validate
78+
```
5579

5680
It will also run some [Rubocop](http://batsov.com/rubocop/) tests
5781
against it. You can run those locally ahead of time with:
5882

59-
bundle exec rake rubocop
83+
```sh
84+
bundle exec rake rubocop
85+
```
6086

6187
## Running the unit tests
6288

@@ -67,15 +93,36 @@ about how best to test your new feature.
6793

6894
To run the linter, the syntax checker and the unit tests:
6995

70-
bundle exec rake test
96+
```sh
97+
bundle exec rake test
98+
```
7199

72100
To run your all the unit tests
73101

74-
bundle exec rake spec SPEC_OPTS='--format documentation'
102+
```sh
103+
bundle exec rake spec
104+
```
75105

76106
To run a specific spec test set the `SPEC` variable:
77107

78-
bundle exec rake spec SPEC=spec/foo_spec.rb
108+
```sh
109+
bundle exec rake spec SPEC=spec/foo_spec.rb
110+
```
111+
112+
### Unit tests in docker
113+
114+
Some people don't want to run the dependencies locally or don't want to install
115+
ruby. We ship a Dockerfile that enables you to run all unit tests and linting.
116+
You only need to run:
117+
118+
```sh
119+
docker build .
120+
```
121+
122+
Please ensure that a docker daemon is running and that your user has the
123+
permission to talk to it. You can specify a remote docker host by setting the
124+
`DOCKER_HOST` environment variable. it will copy the content of the module into
125+
the docker image. So it will not work if a Gemfile.lock exists.
79126

80127
## Integration tests
81128

@@ -87,23 +134,51 @@ This fires up a new virtual machine (using vagrant) and runs a series of
87134
simple tests against it after applying the module. You can run this
88135
with:
89136

90-
bundle exec rake acceptance
137+
```sh
138+
bundle exec rake acceptance
139+
```
91140

92141
This will run the tests on the module's default nodeset. You can override the
93142
nodeset used, e.g.,
94143

95-
BEAKER_set=centos-7-x64 bundle exec rake acceptance
144+
```sh
145+
BEAKER_set=centos-7-x64 bundle exec rake acceptance
146+
```
96147

97148
There are default rake tasks for the various acceptance test modules, e.g.,
98149

99-
bundle exec rake beaker:centos-7-x64
100-
bundle exec rake beaker:ssh:centos-7-x64
150+
```sh
151+
bundle exec rake beaker:centos-7-x64
152+
bundle exec rake beaker:ssh:centos-7-x64
153+
```
101154

102155
If you don't want to have to recreate the virtual machine every time you can
103156
use `BEAKER_destroy=no` and `BEAKER_provision=no`. On the first run you will at
104157
least need `BEAKER_provision` set to yes (the default). The Vagrantfile for the
105158
created virtual machines will be in `.vagrant/beaker_vagrant_files`.
106159

160+
Beaker also supports docker containers. We also use that in our automated CI
161+
pipeline at [travis-ci](http://travis-ci.org). To use that instead of Vagrant:
162+
163+
```
164+
PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} BEAKER_destroy=yes bundle exec rake beaker
165+
```
166+
167+
You can replace the string `debian9` with any common operating system.
168+
The following strings are known to work:
169+
170+
* ubuntu1604
171+
* ubuntu1804
172+
* debian8
173+
* debian9
174+
* centos6
175+
* centos7
176+
107177
The easiest way to debug in a docker container is to open a shell:
108178

109-
docker exec -it -u root ${container_id_or_name} bash
179+
```sh
180+
docker exec -it -u root ${container_id_or_name} bash
181+
```
182+
183+
The source of this file is in our [modulesync_config](https://github.com/voxpupuli/modulesync_config/blob/master/moduleroot/.github/CONTRIBUTING.md.erb)
184+
repository.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,15 @@ Thank you for contributing to this project!
66
- Our vulnerabilities reporting process is at https://voxpupuli.org/security/
77
88
-->
9+
#### Pull Request (PR) description
10+
<!--
11+
Replace this comment with a description of your pull request.
12+
-->
13+
14+
#### This Pull Request (PR) fixes the following issues
15+
<!--
16+
Replace this comment with the list of issues or n/a.
17+
Use format:
18+
Fixes #123
19+
Fixes #124
20+
-->

.msync.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
modulesync_config_version: '1.6.0'
1+
modulesync_config_version: '2.7.0'

.overcommit.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ PrePush:
5858
enabled: true
5959
description: 'Run rake targets'
6060
targets:
61+
- 'validate'
6162
- 'test'
6263
- 'rubocop'
6364
command: [ 'bundle', 'exec', 'rake' ]

.pmtignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ Puppetfile.lock
1818
*.iml
1919
.*.sw?
2020
.yardoc/
21+
Dockerfile

.travis.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
---
2-
sudo: false
3-
dist: trusty
2+
dist: xenial
43
language: ruby
54
cache: bundler
65
before_install:
7-
- rm -f Gemfile.lock
6+
- gem update --system
7+
- gem update bundler
8+
- bundle --version
89
script:
910
- 'bundle exec rake $CHECK'
1011
matrix:
1112
fast_finish: true
1213
include:
13-
- rvm: 2.1.9
14+
- rvm: 2.4.4
1415
bundler_args: --without system_tests development release
15-
env: PUPPET_VERSION="~> 4.0" CHECK=test PARALLEL_TEST_PROCESSORS=16
16-
- rvm: 2.4.2
16+
env: PUPPET_VERSION="~> 5.0" CHECK=test
17+
- rvm: 2.5.3
1718
bundler_args: --without system_tests development release
18-
env: PUPPET_VERSION="~> 5.0" CHECK=test_with_coveralls
19-
- rvm: 2.4.2
19+
env: PUPPET_VERSION="~> 6.0" CHECK=test_with_coveralls
20+
- rvm: 2.5.3
2021
bundler_args: --without system_tests development release
21-
env: PUPPET_VERSION="~> 5.0" CHECK=rubocop
22-
- rvm: 2.4.2
22+
env: PUPPET_VERSION="~> 6.0" CHECK=rubocop
23+
- rvm: 2.4.4
2324
bundler_args: --without system_tests development release
2425
env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes
2526
branches:

Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM ruby:2.5.3
2+
3+
WORKDIR /opt/puppet
4+
5+
# https://github.com/puppetlabs/puppet/blob/06ad255754a38f22fb3a22c7c4f1e2ce453d01cb/lib/puppet/provider/service/runit.rb#L39
6+
RUN mkdir -p /etc/sv
7+
8+
ARG PUPPET_VERSION="~> 6.0"
9+
ARG PARALLEL_TEST_PROCESSORS=4
10+
11+
# Cache gems
12+
COPY Gemfile .
13+
RUN bundle install --without system_tests development release --path=${BUNDLE_PATH:-vendor/bundle}
14+
15+
COPY . .
16+
17+
RUN bundle install
18+
RUN bundle exec release_checks
19+
20+
# Container should not saved
21+
RUN exit 1

Gemfile

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,23 @@ def location_for(place, fake_version = nil)
1111
end
1212

1313
group :test do
14-
gem 'puppetlabs_spec_helper', '~> 2.5.0', :require => false
15-
gem 'rspec-puppet', '~> 2.5', :require => false
16-
gem 'rspec-puppet-facts', :require => false
14+
gem 'puppetlabs_spec_helper', '>= 2.14.0', :require => false
15+
gem 'rspec-puppet-facts', '>= 1.8.0', :require => false
1716
gem 'rspec-puppet-utils', :require => false
1817
gem 'puppet-lint-leading_zero-check', :require => false
1918
gem 'puppet-lint-trailing_comma-check', :require => false
2019
gem 'puppet-lint-version_comparison-check', :require => false
2120
gem 'puppet-lint-classes_and_types_beginning_with_digits-check', :require => false
2221
gem 'puppet-lint-unquoted_string-check', :require => false
2322
gem 'puppet-lint-variable_contains_upcase', :require => false
23+
gem 'puppet-lint-absolute_classname-check', :require => false
2424
gem 'metadata-json-lint', :require => false
2525
gem 'redcarpet', :require => false
26-
gem 'rubocop', '~> 0.49.1', :require => false if RUBY_VERSION >= '2.3.0'
27-
gem 'rubocop-rspec', '~> 1.15.0', :require => false if RUBY_VERSION >= '2.3.0'
28-
gem 'mocha', '>= 1.2.1', :require => false
26+
gem 'rubocop', '~> 0.49.1', :require => false
27+
gem 'rubocop-rspec', '~> 1.15.0', :require => false
28+
gem 'mocha', '~> 1.4.0', :require => false
2929
gem 'coveralls', :require => false
3030
gem 'simplecov-console', :require => false
31-
gem 'rack', '~> 1.0', :require => false if RUBY_VERSION < '2.2.2'
3231
gem 'parallel_tests', :require => false
3332
gem 'ipaddress', :require => false
3433
gem 'rspec-its', :require => false
@@ -42,27 +41,33 @@ group :development do
4241
end
4342

4443
group :system_tests do
45-
gem 'winrm', :require => false
44+
gem 'winrm', :require => false
4645
if beaker_version = ENV['BEAKER_VERSION']
4746
gem 'beaker', *location_for(beaker_version)
4847
else
49-
gem 'beaker', '>= 3.9.0', :require => false
48+
gem 'beaker', '>= 4.2.0', :require => false
5049
end
5150
if beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION']
5251
gem 'beaker-rspec', *location_for(beaker_rspec_version)
5352
else
5453
gem 'beaker-rspec', :require => false
5554
end
56-
gem 'serverspec', :require => false
57-
gem 'beaker-puppet_install_helper', :require => false
58-
gem 'beaker-module_install_helper', :require => false
55+
gem 'serverspec', :require => false
56+
gem 'beaker-hostgenerator', '>= 1.1.22', :require => false
57+
gem 'beaker-docker', :require => false
58+
gem 'beaker-puppet', :require => false
59+
gem 'beaker-puppet_install_helper', :require => false
60+
gem 'beaker-module_install_helper', :require => false
61+
gem 'rbnacl', '>= 4', :require => false
62+
gem 'rbnacl-libsodium', :require => false
63+
gem 'bcrypt_pbkdf', :require => false
5964
end
6065

6166
group :release do
62-
gem 'github_changelog_generator', :require => false if RUBY_VERSION >= '2.2.2'
67+
gem 'github_changelog_generator', :require => false, :git => 'https://github.com/github-changelog-generator/github-changelog-generator'
6368
gem 'puppet-blacksmith', :require => false
6469
gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem'
65-
gem 'puppet-strings', '~> 1.0', :require => false
70+
gem 'puppet-strings', '>= 2.2', :require => false
6671
end
6772

6873

@@ -73,7 +78,7 @@ else
7378
gem 'facter', :require => false, :groups => [:test]
7479
end
7580

76-
ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 5.0' : puppetversion = ENV['PUPPET_VERSION'].to_s
81+
ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 6.0' : puppetversion = ENV['PUPPET_VERSION'].to_s
7782
gem 'puppet', puppetversion, :require => false, :groups => [:test]
7883

7984
# vim: syntax=ruby

0 commit comments

Comments
 (0)