Skip to content
This repository was archived by the owner on May 5, 2023. It is now read-only.

Commit 55a20ba

Browse files
committed
modulesync 2.9.0
1 parent 4d95464 commit 55a20ba

File tree

7 files changed

+146
-34
lines changed

7 files changed

+146
-34
lines changed

.github/CONTRIBUTING.md

+108-28
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# Contribution guidelines
2+
3+
## Table of contents
4+
5+
* [Contributing](#contributing)
6+
* [Writing proper commits - short version](#writing-proper-commits-short-version)
7+
* [Writing proper commits - long version](#writing-proper-commits-long-version)
8+
* [Dependencies](#dependencies)
9+
* [Note for OS X users](#note-for-os-x-users)
10+
* [The test matrix](#the-test-matrix)
11+
* [Syntax and style](#syntax-and-style)
12+
* [Running the unit tests](#running-the-unit-tests)
13+
* [Unit tests in docker](#unit-tests-in-docker)
14+
* [Integration tests](#integration-tests)
15+
116
This module has grown over time based on a range of contributions from
217
people using it. If you follow these contributing guidelines your patch
318
will likely make it into a release a little more quickly.
@@ -8,29 +23,92 @@ Please note that this project is released with a Contributor Code of Conduct.
823
By participating in this project you agree to abide by its terms.
924
[Contributor Code of Conduct](https://voxpupuli.org/coc/).
1025

11-
1. Fork the repo.
12-
13-
1. Create a separate branch for your change.
14-
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.
22-
23-
1. Add a test for your change. Only refactoring and documentation
24-
changes require no new tests. If you are adding functionality
25-
or fixing a bug, please add a test.
26-
27-
1. Squash your commits down into logical components. Make sure to rebase
28-
against our current master.
29-
30-
1. Push the branch to your fork and submit a pull request.
31-
32-
Please be prepared to repeat some of these steps as our contributors review
33-
your code.
26+
* Fork the repo.
27+
* Create a separate branch for your change.
28+
* 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).
29+
* 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.
30+
* 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.
31+
* Squash your commits down into logical components. Make sure to rebase against our current master.
32+
* Push the branch to your fork and submit a pull request.
33+
34+
Please be prepared to repeat some of these steps as our contributors review your code.
35+
36+
## Writing proper commits - short version
37+
38+
* Make commits of logical units.
39+
* Check for unnecessary whitespace with "git diff --check" before committing.
40+
* Commit using Unix line endings (check the settings around "crlf" in git-config(1)).
41+
* Do not check in commented out code or unneeded files.
42+
* The first line of the commit message should be a short description (50 characters is the soft limit, excluding ticket number(s)), and should skip the full stop.
43+
* Associate the issue in the message. The first line should include the issue number in the form "(#XXXX) Rest of message".
44+
* The body should provide a meaningful commit message, which:
45+
*uses the imperative, present tense: `change`, not `changed` or `changes`.
46+
* includes motivation for the change, and contrasts its implementation with the previous behavior.
47+
* Make sure that you have tests for the bug you are fixing, or feature you are adding.
48+
* Make sure the test suites passes after your commit:
49+
* When introducing a new feature, make sure it is properly documented in the README.md
50+
51+
## Writing proper commits - long version
52+
53+
1. Make separate commits for logically separate changes.
54+
55+
Please break your commits down into logically consistent units
56+
which include new or changed tests relevant to the rest of the
57+
change. The goal of doing this is to make the diff easier to
58+
read for whoever is reviewing your code. In general, the easier
59+
your diff is to read, the more likely someone will be happy to
60+
review it and get it into the code base.
61+
62+
If you are going to refactor a piece of code, please do so as a
63+
separate commit from your feature or bug fix changes.
64+
65+
We also really appreciate changes that include tests to make
66+
sure the bug is not re-introduced, and that the feature is not
67+
accidentally broken.
68+
69+
Describe the technical detail of the change(s). If your
70+
description starts to get too long, that is a good sign that you
71+
probably need to split up your commit into more finely grained
72+
pieces.
73+
74+
Commits which plainly describe the things which help
75+
reviewers check the patch and future developers understand the
76+
code are much more likely to be merged in with a minimum of
77+
bike-shedding or requested changes. Ideally, the commit message
78+
would include information, and be in a form suitable for
79+
inclusion in the release notes for the version of Puppet that
80+
includes them.
81+
82+
Please also check that you are not introducing any trailing
83+
whitespace or other "whitespace errors". You can do this by
84+
running "git diff --check" on your changes before you commit.
85+
86+
2. Sending your patches
87+
88+
To submit your changes via a GitHub pull request, we _highly_
89+
recommend that you have them on a topic branch, instead of
90+
directly on `master`.
91+
It makes things much easier to keep track of, especially if
92+
you decide to work on another thing before your first change
93+
is merged in.
94+
95+
GitHub has some pretty good
96+
[general documentation](http://help.github.com/) on using
97+
their site. They also have documentation on
98+
[creating pull requests](http://help.github.com/send-pull-requests/).
99+
100+
In general, after pushing your topic branch up to your
101+
repository on GitHub, you can switch to the branch in the
102+
GitHub UI and click "Pull Request" towards the top of the page
103+
in order to open a pull request.
104+
105+
106+
3. Update the related GitHub issue.
107+
108+
If there is a GitHub issue associated with the change you
109+
submitted, then you should update the ticket to include the
110+
location of your branch, along with any other commentary you
111+
may wish to make.
34112

35113
## Dependencies
36114

@@ -75,13 +153,15 @@ BUNDLE_JOBS="$(nproc)"
75153

76154
### Note for OS X users
77155

78-
`nproc` isn't a valid command unter OS x. As an alternative, you can do:
156+
`nproc` isn't a valid command under OS x. As an alternative, you can do:
79157

80158
```sh
81159
--jobs "$(sysctl -n hw.ncpu)"
82160
```
83161

84-
## Syntax and style
162+
## The test matrix
163+
164+
### Syntax and style
85165

86166
The test suite will run [Puppet Lint](http://puppet-lint.com/) and
87167
[Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to
@@ -99,7 +179,7 @@ against it. You can run those locally ahead of time with:
99179
bundle exec rake rubocop
100180
```
101181

102-
## Running the unit tests
182+
### Running the unit tests
103183

104184
The unit test suite covers most of the code, as mentioned above please
105185
add tests if you're adding new functionality. If you've not used
@@ -124,7 +204,7 @@ To run a specific spec test set the `SPEC` variable:
124204
bundle exec rake spec SPEC=spec/foo_spec.rb
125205
```
126206

127-
### Unit tests in docker
207+
#### Unit tests in docker
128208

129209
Some people don't want to run the dependencies locally or don't want to install
130210
ruby. We ship a Dockerfile that enables you to run all unit tests and linting.
@@ -139,7 +219,7 @@ permission to talk to it. You can specify a remote docker host by setting the
139219
`DOCKER_HOST` environment variable. it will copy the content of the module into
140220
the docker image. So it will not work if a Gemfile.lock exists.
141221

142-
## Integration tests
222+
### Integration tests
143223

144224
The unit tests just check the code runs, not that it does exactly what
145225
we want on a real machine. For that we're using

.msync.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
modulesync_config_version: '2.8.0'
1+
modulesync_config_version: '2.9.0'

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
dist: xenial
2+
dist: bionic
33
language: ruby
44
cache: bundler
55
before_install:

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ RUN bundle install --without system_tests development release --path=${BUNDLE_PA
1515
COPY . .
1616

1717
RUN bundle install
18-
RUN bundle exec release_checks
18+
RUN bundle exec rake release_checks
1919

2020
# Container should not saved
2121
RUN exit 1

Gemfile

+5-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ end
1212

1313
group :test do
1414
gem 'puppetlabs_spec_helper', '>= 2.14.0', :require => false
15-
gem 'rspec-puppet-facts', '>= 1.8.0', :require => false
15+
gem 'rspec-puppet-facts', '>= 1.9.5', :require => false
1616
gem 'rspec-puppet-utils', :require => false
1717
gem 'puppet-lint-leading_zero-check', :require => false
1818
gem 'puppet-lint-trailing_comma-check', :require => false
@@ -22,6 +22,8 @@ group :test do
2222
gem 'puppet-lint-variable_contains_upcase', :require => false
2323
gem 'puppet-lint-absolute_classname-check', :require => false
2424
gem 'puppet-lint-topscope-variable-check', :require => false
25+
gem 'puppet-lint-legacy_facts-check', :require => false
26+
gem 'puppet-lint-anchor-check', :require => false
2527
gem 'metadata-json-lint', :require => false
2628
gem 'redcarpet', :require => false
2729
gem 'rubocop', '~> 0.49.1', :require => false
@@ -63,9 +65,9 @@ group :system_tests do
6365
end
6466

6567
group :release do
66-
gem 'github_changelog_generator', :require => false, :git => 'https://github.com/github-changelog-generator/github-changelog-generator'
68+
gem 'github_changelog_generator', :require => false, :git => 'https://github.com/voxpupuli/github-changelog-generator', :branch => 'voxpupuli_essential_fixes'
6769
gem 'puppet-blacksmith', :require => false
68-
gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem'
70+
gem 'voxpupuli-release', :require => false
6971
gem 'puppet-strings', '>= 2.2', :require => false
7072
end
7173

Rakefile

+13
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,19 @@ begin
7777
metadata = JSON.load(File.read(metadata_json))
7878
config.project = metadata['name']
7979
end
80+
81+
# Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715
82+
require 'rbconfig'
83+
if RbConfig::CONFIG['host_os'] =~ /linux/
84+
task :changelog do
85+
puts 'Fixing line endings...'
86+
changelog_file = File.join(__dir__, 'CHANGELOG.md')
87+
changelog_txt = File.read(changelog_file)
88+
new_contents = changelog_txt.gsub(%r{\r\n}, "\n")
89+
File.open(changelog_file, "w") {|file| file.puts new_contents }
90+
end
91+
end
92+
8093
rescue LoadError
8194
end
8295
# vim: syntax=ruby

spec/spec_helper.rb

+17
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
require 'bundler'
1111
include RspecPuppetFacts
1212

13+
if ENV['DEBUG']
14+
Puppet::Util::Log.level = :debug
15+
Puppet::Util::Log.newdestination(:console)
16+
end
17+
1318
if File.exist?(File.join(__dir__, 'default_module_facts.yml'))
1419
facts = YAML.load(File.read(File.join(__dir__, 'default_module_facts.yml')))
1520
if facts
@@ -37,6 +42,18 @@
3742
end
3843

3944
RSpec.configure do |c|
45+
# getting the correct facter version is tricky. We use facterdb as a source to mock facts
46+
# see https://github.com/camptocamp/facterdb
47+
# people might provide a specific facter version. In that case we use it.
48+
# Otherwise we need to match the correct facter version to the used puppet version.
49+
# as of 2019-10-31, puppet 5 ships facter 3.11 and puppet 6 ships facter 3.14
50+
# https://puppet.com/docs/puppet/5.5/about_agent.html
51+
c.default_facter_version = if ENV['FACTERDB_FACTS_VERSION']
52+
ENV['FACTERDB_FACTS_VERSION']
53+
else
54+
Gem::Dependency.new('', ENV['PUPPET_VERSION']).match?('', '5') ? '3.11.0' : '3.14.0'
55+
end
56+
4057
# Coverage generation
4158
c.after(:suite) do
4259
RSpec::Puppet::Coverage.report!

0 commit comments

Comments
 (0)