Showing with 313 additions and 526 deletions.
  1. +14 −0 .editorconfig
  2. +0 −2 .fixtures.yml
  3. +15 −0 .github/CONTRIBUTING.md
  4. +1 −1 .msync.yml
  5. +1 −0 .pmtignore
  6. +4 −0 .sync.yml
  7. +48 −0 .travis.yml
  8. +21 −2 CHANGELOG.md
  9. +21 −0 Dockerfile
  10. +5 −4 Gemfile
  11. +1 −7 README.md
  12. +1 −1 files/prefix_command.rb
  13. +0 −2 manifests/init.pp
  14. +0 −11 manifests/install.pp
  15. +0 −16 manifests/install/gem.pp
  16. +9 −5 manifests/params.pp
  17. +1 −0 manifests/webhook/package.pp
  18. +1 −9 metadata.json
  19. +23 −31 spec/acceptance/basic_webhook_spec.rb
  20. +0 −15 spec/acceptance/nodesets/centos-511-x64.yml
  21. +0 −15 spec/acceptance/nodesets/centos-6-x64.yml
  22. +0 −17 spec/acceptance/nodesets/centos-66-x64-pe.yml
  23. +0 −15 spec/acceptance/nodesets/centos-66-x64.yml
  24. +0 −15 spec/acceptance/nodesets/centos-7-x64.yml
  25. +0 −15 spec/acceptance/nodesets/centos-72-x64.yml
  26. +0 −15 spec/acceptance/nodesets/debian-78-x64.yml
  27. +0 −15 spec/acceptance/nodesets/debian-82-x64.yml
  28. +0 −15 spec/acceptance/nodesets/fedora-24-x64.yml
  29. +0 −16 spec/acceptance/nodesets/fedora-25-x64.yml
  30. +0 −16 spec/acceptance/nodesets/fedora-26-x64.yml
  31. +0 −18 spec/acceptance/nodesets/fedora-27-x64.yml
  32. +0 −15 spec/acceptance/nodesets/ubuntu-server-1204-x64.yml
  33. +0 −15 spec/acceptance/nodesets/ubuntu-server-1404-x64.yml
  34. +0 −15 spec/acceptance/nodesets/ubuntu-server-1604-x64.yml
  35. +15 −19 spec/acceptance/prefix_webhook_spec.rb
  36. +10 −16 spec/acceptance/signature_webhook_spec.rb
  37. +0 −4 spec/classes/coverage_spec.rb
  38. +66 −68 spec/classes/install_spec.rb
  39. +2 −2 spec/classes/webhook/package_spec.rb
  40. +24 −43 spec/classes/webhook_spec.rb
  41. +0 −14 spec/default_facts.yml
  42. +15 −12 spec/spec_helper.rb
  43. +14 −25 spec/spec_helper_acceptance.rb
  44. +1 −0 templates/webhook.bin.erb
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# editorconfig.org

# MANAGED BY MODULESYNC

root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
tab_width = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
2 changes: 0 additions & 2 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ fixtures:
repositories:
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
ruby: "https://github.com/puppetlabs/puppetlabs-ruby.git"
gcc: "https://github.com/puppetlabs/puppetlabs-gcc.git"
pe_gem: "https://github.com/puppetlabs/puppetlabs-pe_gem.git"
make: "https://github.com/voxpupuli/puppet-make.git"
inifile: "https://github.com/puppetlabs/puppetlabs-inifile.git"
vcsrepo: "https://github.com/puppetlabs/puppetlabs-vcsrepo.git"
git: "https://github.com/puppetlabs/puppetlabs-git.git"
Expand Down
15 changes: 15 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,21 @@ To run a specific spec test set the `SPEC` variable:
bundle exec rake spec SPEC=spec/foo_spec.rb
```

### Unit tests in docker

Some people don't want to run the dependencies locally or don't want to install
ruby. We ship a Dockerfile that enables you to run all unit tests and linting.
You only need to run:

```sh
docker build .
```

Please ensure that a docker daemon is running and that your user has the
permission to talk to it. You can specify a remote docker host by setting the
`DOCKER_HOST` environment variable. it will copy the content of the module into
the docker image. So it will not work if a Gemfile.lock exists.

## Integration tests

The unit tests just check the code runs, not that it does exactly what
Expand Down
2 changes: 1 addition & 1 deletion .msync.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
modulesync_config_version: '2.1.0'
modulesync_config_version: '2.3.1'
1 change: 1 addition & 0 deletions .pmtignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ Puppetfile.lock
*.iml
.*.sw?
.yardoc/
Dockerfile
4 changes: 4 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
.travis.yml:
docker_sets:
- set: ubuntu1404-64
- set: centos7-64
- set: centos6-64
secure: "WcBaQ0iem0kLmgOHvOEYOsgAk6eFZcSJ/6AisPhS4Ty9gxaEcytE8if2d9ThOItRRua5XGAPk7WbYmTa/cy/EsH0LYwSDdP2eagI95CnmryGya5TShKwUMv1ETUOBFucRYxtcOo7URnTMe2d6IpxEazuZ87cwGLUV5taBRkEvkw="
48 changes: 48 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,54 @@ matrix:
- rvm: 2.4.4
bundler_args: --without system_tests development release
env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes
- rvm: 2.5.1
bundler_args: --without development release
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64 BEAKER_HYPERVISOR=docker CHECK=beaker
services: docker
sudo: required
- rvm: 2.5.1
bundler_args: --without development release
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64 BEAKER_HYPERVISOR=docker CHECK=beaker
services: docker
sudo: required
- rvm: 2.5.1
bundler_args: --without development release
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1404-64 BEAKER_HYPERVISOR=docker CHECK=beaker
services: docker
sudo: required
- rvm: 2.5.1
bundler_args: --without development release
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker
services: docker
sudo: required
- rvm: 2.5.1
bundler_args: --without development release
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker
services: docker
sudo: required
- rvm: 2.5.1
bundler_args: --without development release
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=centos7-64 BEAKER_HYPERVISOR=docker CHECK=beaker
services: docker
sudo: required
- rvm: 2.5.1
bundler_args: --without development release
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos6-64 BEAKER_HYPERVISOR=docker CHECK=beaker
services: docker
sudo: required
- rvm: 2.5.1
bundler_args: --without development release
dist: trusty
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos6-64 BEAKER_HYPERVISOR=docker CHECK=beaker
services: docker
sudo: required
branches:
only:
- master
Expand Down
23 changes: 21 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@ All notable changes to this project will be documented in this file.
Each new release typically also includes the latest modulesync defaults.
These should not affect the functionality of the module.

## [v6.8.0](https://github.com/voxpupuli/puppet-r10k/tree/v6.8.0) (2018-12-23)

[Full Changelog](https://github.com/voxpupuli/puppet-r10k/compare/v6.7.0...v6.8.0)

**Implemented enhancements:**

- Update r10k path in example `prefix\_command.rb` [\#467](https://github.com/voxpupuli/puppet-r10k/pull/467) ([alexjfisher](https://github.com/alexjfisher))
- Identify branch name from BitBucket server native webhook payload [\#462](https://github.com/voxpupuli/puppet-r10k/pull/462) ([venushka](https://github.com/venushka))

**Closed issues:**

- don't pin sinatra and webrick gems anymore [\#471](https://github.com/voxpupuli/puppet-r10k/issues/471)

**Merged pull requests:**

- set webrick and sinatra versions to 'installed' [\#475](https://github.com/voxpupuli/puppet-r10k/pull/475) ([kenyon](https://github.com/kenyon))
- enable acceptance tests [\#469](https://github.com/voxpupuli/puppet-r10k/pull/469) ([Dan33l](https://github.com/Dan33l))
- Remove gcc and make dependencies [\#465](https://github.com/voxpupuli/puppet-r10k/pull/465) ([Rudikza](https://github.com/Rudikza))

## [v6.7.0](https://github.com/voxpupuli/puppet-r10k/tree/v6.7.0) (2018-10-13)

[Full Changelog](https://github.com/voxpupuli/puppet-r10k/compare/v6.6.1...v6.7.0)
Expand Down Expand Up @@ -311,9 +330,9 @@ These should not affect the functionality of the module.

- Rename CHANGELOG.md [\#301](https://github.com/voxpupuli/puppet-r10k/pull/301) ([rnelson0](https://github.com/rnelson0))
- Fixes Puppet 4 path for webhook [\#295](https://github.com/voxpupuli/puppet-r10k/pull/295) ([andrewwippler](https://github.com/andrewwippler))
- Update config\_version.sh [\#291](https://github.com/voxpupuli/puppet-r10k/pull/291) ([seanscottking](https://github.com/seanscottking))
- Update config\_version.sh [\#291](https://github.com/voxpupuli/puppet-r10k/pull/291) ([solsglasses](https://github.com/solsglasses))
- Fix testing [\#288](https://github.com/voxpupuli/puppet-r10k/pull/288) ([ghoneycutt](https://github.com/ghoneycutt))
- Duplicate certpath key [\#287](https://github.com/voxpupuli/puppet-r10k/pull/287) ([seanscottking](https://github.com/seanscottking))
- Duplicate certpath key [\#287](https://github.com/voxpupuli/puppet-r10k/pull/287) ([solsglasses](https://github.com/solsglasses))
- unbreak on OS where root group != 'root' [\#279](https://github.com/voxpupuli/puppet-r10k/pull/279) ([buzzdeee](https://github.com/buzzdeee))
- Add support for custom permissions and ownership of webhooks.yaml [\#278](https://github.com/voxpupuli/puppet-r10k/pull/278) ([elconas](https://github.com/elconas))
- add curl example to readme [\#274](https://github.com/voxpupuli/puppet-r10k/pull/274) ([jessereynolds](https://github.com/jessereynolds))
Expand Down
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM ruby:2.5.1

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 PARALLEL_TEST_PROCESSORS=4

# Cache gems
COPY Gemfile .
RUN bundle install --without system_tests development release --path=${BUNDLE_PATH:-vendor/bundle}

COPY . .

RUN bundle install
RUN bundle exec release_checks

# Container should not saved
RUN exit 1
9 changes: 5 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ end

group :test do
gem 'puppetlabs_spec_helper', '>= 2.11.0', :require => false
gem 'rspec-puppet-facts', :require => false
gem 'rspec-puppet-facts', '>= 1.8.0', :require => false
gem 'rspec-puppet-utils', :require => false
gem 'puppet-lint-leading_zero-check', :require => false
gem 'puppet-lint-trailing_comma-check', :require => false
Expand All @@ -28,7 +28,8 @@ group :test do
gem 'coveralls', :require => false
gem 'simplecov-console', :require => false
gem 'rack', '~> 1.0', :require => false if RUBY_VERSION < '2.2.2'
gem 'parallel_tests', :require => false
gem 'parallel_tests', '2.24.0', :require => false if RUBY_VERSION < '2.2.0'
gem 'parallel_tests', :require => false if RUBY_VERSION >= '2.2.0'
end

group :development do
Expand All @@ -43,15 +44,15 @@ group :system_tests do
if beaker_version = ENV['BEAKER_VERSION']
gem 'beaker', *location_for(beaker_version)
else
gem 'beaker', '>= 3.9.0', :require => false
gem 'beaker', '>= 4.2.0', :require => false
end
if beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION']
gem 'beaker-rspec', *location_for(beaker_rspec_version)
else
gem 'beaker-rspec', :require => false
end
gem 'serverspec', :require => false
gem 'beaker-hostgenerator', '>= 1.1.10', :require => false
gem 'beaker-hostgenerator', '>= 1.1.22', :require => false
gem 'beaker-docker', :require => false
gem 'beaker-puppet', :require => false
gem 'beaker-puppet_install_helper', :require => false
Expand Down
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -530,15 +530,9 @@ class { 'r10k::webhook':

### Webhook sinatra gem installation

By default, the `r10k::webhook::package` class uses the `puppet_gem` provider to install the latest ruby 2.1 compatible version of sinatra ('~> 1.0').
By default, the `r10k::webhook::package` class uses the `puppet_gem` provider to install the latest version of sinatra.
If you are overriding `r10k::webhook::package::provider`, you will also need to override `r10k::webhook::package::sinatra_version`.

### Webhook webrick gem installation

By default, the `r10k::webhook::package` class uses the `puppet_gem` provider to install the webrick gem (version 1.3.1)
This version is compatible with all ruby version (webrick version 1.4.1 require Ruby version >=2.3.0)
If you are overriding `r10k::webhook::package::provider`, you may also override `r10k::webhook::package::webrick_version`.

### Webhook Slack notifications

You can enable Slack notifications for the webhook. You will need a
Expand Down
2 changes: 1 addition & 1 deletion files/prefix_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
if STDIN.tty?
puts 'This command is meant be launched by webhook'
else
prefixes = YAML.load_file('/etc/r10k.yaml')
prefixes = YAML.load_file('/etc/puppetlabs/r10k/r10k.yaml')

json_data = JSON.parse(STDIN.read)
url = json_data['repository']['url']
Expand Down
2 changes: 0 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
$postrun = undef,
Boolean $include_prerun_command = false,
Boolean $include_postrun_command = false,
Boolean $install_gcc = false,
) inherits r10k::params {

# Check if user is declaring both classes
Expand All @@ -52,7 +51,6 @@
provider => $provider,
version => $version,
puppet_master => $puppet_master,
install_gcc => $install_gcc,
}

class { '::r10k::config':
Expand Down
11 changes: 0 additions & 11 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,8 @@
$manage_ruby_dependency,
$puppet_master = true,
$is_pe_server = $r10k::params::is_pe_server,
$install_gcc = false,
) inherits r10k::params {

# There are currently bugs in r10k 1.x which make using 0.x desireable in
# certain circumstances. However, 0.x requires make and gcc. Conditionally
# include those classes if necessary due to 0.x r10k version usage. When
# 1.x is just as good or better than 0.x, we can stop supporting 0.x and
# remove this block.
if versioncmp('1.0.0', $version) > 0 or $install_gcc {
require ::gcc
require ::make
}

if $package_name == '' {
case $provider {
'openbsd': {
Expand Down
16 changes: 0 additions & 16 deletions manifests/install/gem.pp
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,4 @@
#do nothing
}
}

# Explicit dependency chaining to make sure the system is ready to compile
# native extentions for dependent rubygems by the time r10k installation
# begins
if versioncmp('1.0.0', $version) > 0 {
# I am not sure all of this is required as I assumed the
# ruby::dev class would have taken care of some of it
include ::make
include ::gcc

Anchor['r10k::ruby_done']
-> Class['gcc']
-> Class['make']
-> Package['r10k']
}

}
14 changes: 9 additions & 5 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
$is_pe_server = false
}

if getvar('::pe_server_version') {
if fact('pe_server_version') {
# PE 4 or greater specific settings
# r10k configuration

Expand All @@ -82,7 +82,7 @@
$root_user = 'root'
$root_group = 'root'
}
elsif versioncmp("${::puppetversion}", '4.0.0') >= 0 { #lint:ignore:only_variable_string
elsif versioncmp($facts['puppetversion'], '4.0.0') >= 0 {
#FOSS 4 or greater specific settings
# r10k configuration

Expand All @@ -105,7 +105,7 @@
$root_group = 'root'
}
else {
fail("Puppet version ${::puppetversion} is no longer supported. Please use an earlier version of puppet/r10k.")
fail("Puppet version ${facts['puppetversion']} is no longer supported. Please use an earlier version of puppet/r10k.")
}

# prerun_command in puppet.conf
Expand Down Expand Up @@ -157,8 +157,12 @@
$webhook_configfile_mode = '0644'
$webhook_ignore_environments = []
$webhook_mco_arguments = undef
$webhook_sinatra_version = '~> 1.0' # Sinatra 2 requires rack 2 which in turn requires ruby 2.2. Puppet 4 AIO ships with ruby 2.1
$webhook_webrick_version = '1.3.1' # Webrick 1.4 requires ruby >= 2.3
if $facts['pe_server_version'] == '2016.4.2' {
$webhook_sinatra_version = '~> 1.0'
} else {
$webhook_sinatra_version = 'installed'
}
$webhook_webrick_version = 'installed'
$webhook_generate_types = false

# Service Settings for SystemD in EL7
Expand Down
1 change: 1 addition & 0 deletions manifests/webhook/package.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
notify => Service['webhook'],
}
}

if (! $is_pe_server) {
if !defined(Package['webrick']) {
package { 'webrick':
Expand Down
10 changes: 1 addition & 9 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "Vox Pupuli",
"license": "Apache-2.0",
"name": "puppet-r10k",
"version": "6.7.0",
"version": "6.8.0",
"operatingsystem_support": [
{
"operatingsystem": "RedHat",
Expand Down Expand Up @@ -59,14 +59,6 @@
"name": "puppetlabs/ruby",
"version_requirement": ">= 0.6.0 < 2.0.0"
},
{
"name": "puppetlabs/gcc",
"version_requirement": ">= 0.3.0 < 2.0.0"
},
{
"name": "puppet/make",
"version_requirement": ">= 1.0.0 < 3.0.0"
},
{
"name": "puppetlabs/inifile",
"version_requirement": ">= 1.4.1 < 3.0.0"
Expand Down
Loading