Showing with 105 additions and 30 deletions.
  1. +0 −2 .fixtures.yml
  2. +60 −15 .github/CONTRIBUTING.md
  3. +1 −1 .msync.yml
  4. +1 −0 .overcommit.yml
  5. +4 −4 .travis.yml
  6. +17 −0 CHANGELOG.md
  7. +5 −4 Gemfile
  8. +8 −0 README.md
  9. +1 −0 manifests/webhook.pp
  10. +3 −3 metadata.json
  11. +5 −1 templates/webhook.bin.erb
2 changes: 0 additions & 2 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,3 @@ fixtures:
portage:
repo: "https://github.com/gentoo/puppet-portage.git"
ref: "2.3.0"
symlinks:
r10k: "#{source_dir}"
75 changes: 60 additions & 15 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@ By participating in this project you agree to abide by its terms.

1. Create a separate branch for your change.

1. Run the tests. We only take pull requests with passing tests, and
documentation.
1. 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.

1. Checkout [our docs](https://voxpupuli.org/docs/#reviewing-a-module-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.

1. 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.

1. Squash your commits down into logical components. Make sure to rebase
against the current master.
against our current master.

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

Expand All @@ -38,7 +43,9 @@ By default the tests use a baseline version of Puppet.
If you have Ruby 2.x or want a specific version of Puppet,
you must set an environment variable such as:

export PUPPET_VERSION="~> 4.2.0"
```sh
export PUPPET_VERSION="~> 5.5.6"
```

You can install all needed gems for spec tests into the modules directory by
running:
Expand All @@ -65,13 +72,17 @@ The test suite will run [Puppet Lint](http://puppet-lint.com/) and
[Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to
check various syntax and style things. You can run these locally with:

bundle exec rake lint
bundle exec rake validate
```sh
bundle exec rake lint
bundle exec rake validate
```

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

bundle exec rake rubocop
```sh
bundle exec rake rubocop
```

## Running the unit tests

Expand All @@ -82,15 +93,21 @@ about how best to test your new feature.

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

bundle exec rake test
```sh
bundle exec rake test
```

To run your all the unit tests

bundle exec rake spec SPEC_OPTS='--format documentation'
```sh
bundle exec rake spec
```

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

bundle exec rake spec SPEC=spec/foo_spec.rb
```sh
bundle exec rake spec SPEC=spec/foo_spec.rb
```

## Integration tests

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

bundle exec rake acceptance
```sh
bundle exec rake acceptance
```

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

BEAKER_set=centos-7-x64 bundle exec rake acceptance
```sh
BEAKER_set=centos-7-x64 bundle exec rake acceptance
```

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

bundle exec rake beaker:centos-7-x64
bundle exec rake beaker:ssh:centos-7-x64
```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:

```
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
```

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

* ubuntu1604
* ubuntu1804
* debian8
* debian9
* centos6
* centos7

The easiest way to debug in a docker container is to open a shell:

docker exec -it -u root ${container_id_or_name} bash
```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)
repository.
2 changes: 1 addition & 1 deletion .msync.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
modulesync_config_version: '1.9.4'
modulesync_config_version: '2.1.0'
1 change: 1 addition & 0 deletions .overcommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ PrePush:
enabled: true
description: 'Run rake targets'
targets:
- 'validate'
- 'test'
- 'rubocop'
command: [ 'bundle', 'exec', 'rake' ]
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ matrix:
env: PUPPET_VERSION="~> 5.0" CHECK=test
- rvm: 2.5.1
bundler_args: --without system_tests development release
env: PUPPET_VERSION="~> 5.0" CHECK=test_with_coveralls
- rvm: 2.4.4
bundler_args: --without system_tests development release
env: PUPPET_VERSION="~> 5.0" CHECK=rubocop
env: PUPPET_VERSION="~> 6.0" CHECK=test_with_coveralls
- rvm: 2.5.1
bundler_args: --without system_tests development release
env: PUPPET_VERSION="~> 6.0" CHECK=rubocop
- rvm: 2.4.4
bundler_args: --without system_tests development release
env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes
branches:
Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ 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.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)

**Implemented enhancements:**

- Allow usage of OS r10k packages [\#453](https://github.com/voxpupuli/puppet-r10k/pull/453) ([tuxmea](https://github.com/tuxmea))

**Fixed bugs:**

- Handle environment name normalized by r10k [\#452](https://github.com/voxpupuli/puppet-r10k/pull/452) ([sapakt](https://github.com/sapakt))

**Merged pull requests:**

- allow puppet 6.x [\#454](https://github.com/voxpupuli/puppet-r10k/pull/454) ([bastelfreak](https://github.com/bastelfreak))
- allow puppetlabs/stdlib 5.x [\#450](https://github.com/voxpupuli/puppet-r10k/pull/450) ([bastelfreak](https://github.com/bastelfreak))

## [v6.6.1](https://github.com/voxpupuli/puppet-r10k/tree/v6.6.1) (2018-07-29)

[Full Changelog](https://github.com/voxpupuli/puppet-r10k/compare/v6.6.0...v6.6.1)
Expand Down
9 changes: 5 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ def location_for(place, fake_version = nil)
end

group :test do
gem 'puppetlabs_spec_helper', '~> 2.6', :require => false
gem 'rspec-puppet', '~> 2.5', :require => false
gem 'puppetlabs_spec_helper', '>= 2.11.0', :require => false
gem 'rspec-puppet-facts', :require => false
gem 'rspec-puppet-utils', :require => false
gem 'puppet-lint-leading_zero-check', :require => false
Expand Down Expand Up @@ -53,15 +52,17 @@ group :system_tests do
end
gem 'serverspec', :require => false
gem 'beaker-hostgenerator', '>= 1.1.10', :require => false
gem 'beaker-docker', :require => false
gem 'beaker-puppet', :require => false
gem 'beaker-puppet_install_helper', :require => false
gem 'beaker-module_install_helper', :require => false
gem 'rbnacl', '~> 4', :require => false if RUBY_VERSION >= '2.2.6'
gem 'rbnacl', '>= 4', :require => false if RUBY_VERSION >= '2.2.6'
gem 'rbnacl-libsodium', :require => false if RUBY_VERSION >= '2.2.6'
gem 'bcrypt_pbkdf', :require => false
end

group :release do
gem 'github_changelog_generator', :require => false, :git => 'https://github.com/skywinder/github-changelog-generator' if RUBY_VERSION >= '2.2.2'
gem 'github_changelog_generator', :require => false, :git => 'https://github.com/github-changelog-generator/github-changelog-generator' if RUBY_VERSION >= '2.2.2'
gem 'puppet-blacksmith', :require => false
gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem'
gem 'puppet-strings', '>= 1.0', :require => false
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,14 @@ class { 'r10k::webhook':
}
```

### Webhook FOSS support using OS Ruby
Some OS bring r10k as OS installation package. In this case you want to be able to set the ruby interpreter explizitly.
```puppet
class { 'r10k::webhook':
ruby_bin => '/usr/bin/ruby',
}
```

### 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').
Expand Down
1 change: 1 addition & 0 deletions manifests/webhook.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
$root_user = $r10k::params::root_user,
$root_group = $r10k::params::root_group,
$manage_packages = true,
$ruby_bin = undef,
) inherits r10k::params {

File {
Expand Down
6 changes: 3 additions & 3 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.6.1",
"version": "6.7.0",
"operatingsystem_support": [
{
"operatingsystem": "RedHat",
Expand Down Expand Up @@ -53,7 +53,7 @@
"dependencies": [
{
"name": "puppetlabs/stdlib",
"version_requirement": ">= 4.19.0 < 5.0.0"
"version_requirement": ">= 4.19.0 < 6.0.0"
},
{
"name": "puppetlabs/ruby",
Expand Down Expand Up @@ -87,7 +87,7 @@
"requirements": [
{
"name": "puppet",
"version_requirement": ">= 4.10.0 < 6.0.0"
"version_requirement": ">= 4.10.0 < 7.0.0"
}
]
}
6 changes: 5 additions & 1 deletion templates/webhook.bin.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
<% if @ruby_bin -%>
#!<%= @ruby_bin %>
<% else -%>
<% if @is_pe == true or @is_pe == 'true' -%>
#!/opt/puppet/bin/ruby
<% elsif Puppet::Util::Package.versioncmp(Puppet.version, '4.2.0') >= 0 -%>
#!/opt/puppetlabs/puppet/bin/ruby
<% else -%>
#!/usr/bin/ruby
<% end -%>
<% end -%>
# This mini-webserver is meant to be run as the peadmin user
# so that it can call mcollective from a puppetmaster
# Authors:
Expand Down Expand Up @@ -263,7 +267,7 @@ class Server < Sinatra::Base

def generate_types(environment)
begin
command = "#{$command_prefix} /opt/puppetlabs/bin/puppet generate types --environment #{environment}"
command = "#{$command_prefix} /opt/puppetlabs/bin/puppet generate types --environment #{environment.gsub(/\W/, '_')}"

message = run_command(command)
$logger.info("message: #{message} environment: #{environment}")
Expand Down