Showing with 71 additions and 11 deletions.
  1. +2 −0 CHANGELOG
  2. +1 −1 Modulefile
  3. +56 −6 README.md
  4. +1 −1 files/pre-commit
  5. +1 −1 manifests/webhook.pp
  6. +1 −1 metadata.json
  7. +9 −1 spec/classes/webhook.rb
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
2.6.4 - Zack Smith & Corey Osman
* Fix conditional for pe 3.7 cert upgrade hack
2.6.3 - Eli Young
* Ordering issues #134 & #138
2.6.2 - harrytford
Expand Down
2 changes: 1 addition & 1 deletion Modulefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name 'zack-r10k'
version '2.6.3'
version '2.6.4'
source 'https://github.com/acidprime/r10k'
author 'zack'
license 'Apache License, Version 2.0'
Expand Down
62 changes: 56 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ class { 'r10k':
An mcollective agent is included in this module which can be used to do
on demand synchronization. This mcollective application and agent can be
installed on all masters using the following class

_Note: You must have mcollective already configured for this tool to work,
Puppet Enterprise users will automatically have mcollective configured._
```puppet
include r10k::mcollective
```
Expand Down Expand Up @@ -273,13 +274,13 @@ The webhook must be configured on the respective "control" repository a master t

Currently this is a feature Puppet Enterprise only.

### Webhook Non authenticated example
This is an example of using the webhok without authentication
### Webhook Github Enterprise - Non Authenticated
This is an example of using the webhook without authentication
The `git_webhook` type will using the [api token](https://help.github.com/articles/creating-an-access-token-for-command-line-use/) to add the webhook to the "control" repo that contains your puppetfile. This is typically useful when you want all automate the addtion of the webhook to the repo.

```puppet
# Internal webhooks often don't need authentication and ssl
# # Change the url below if this is changed
# Change the url below if this is changed
class {'r10k::webhook::config':
enable_ssl => false,
protected => false,
Expand All @@ -296,12 +297,12 @@ git_webhook { 'web_post_receive_webhook' :
webhook_url => 'http://master.of.masters:8088/payload',
token => hiera('github_api_token'),
project_name => 'organization/control',
server_url => 'https://api.github.com',
server_url => 'https://your.github.enterprise.com',
provider => 'github',
}
# Add webhook to module repo if we are tacking branch in Puppetfile i.e.
# Add webhook to module repo if we are tracking branch in Puppetfile i.e.
# mod 'module_name',
# :git => 'http://github.com/organization/puppet-module_name',
# :branch => 'master'
Expand All @@ -312,10 +313,59 @@ git_webhook { 'web_post_receive_webhook_for_module' :
webhook_url => 'http://master.of.masters:8088/module',
token => hiera('github_api_token'),
project_name => 'organization/puppet-module_name',
server_url => 'https://your.github.enterprise.com',
provider => 'github',
}
```

### Webhook Github Example - Authenticated
This is an example of using the webhook with authentication
The `git_webhook` type will using the [api token](https://help.github.com/articles/creating-an-access-token-for-command-line-use/) to add the webhook to the "control" repo that contains your puppetfile. This is typically useful when you want all automate the addtion of the webhook to the repo.

```puppet
# External webhooks often need authentication and ssl and authentication
# Change the url below if this is changed
class {'r10k::webhook::config':
enable_ssl => true,
protected => true,
notify => Service['webhook'],
}
class {'r10k::webhook':
require => Class['r10k::webhook::config'],
}
# https://github.com/abrader/abrader-gms
# Add webhook to control repository ( the repo where the Puppetfile lives )
# Requires gms 0.0.6+ for disable_ssl_verify param
git_webhook { 'web_post_receive_webhook' :
ensure => present,
webhook_url => 'https://puppet:puppet@hole.in.firewall:8088/payload',
token => hiera('github_api_token'),
project_name => 'organization/control',
server_url => 'https://api.github.com',
disable_ssl_verify => true,
provider => 'github',
}
# Add webhook to module repo if we are tracking branch in Puppetfile i.e.
# mod 'module_name',
# :git => 'http://github.com/organization/puppet-module_name',
# :branch => 'master'
# The module name is determined from the repo name , i.e. <puppet-><module_name>
# All characters with left and including any hyphen are removed i.e. <puppet->
git_webhook { 'web_post_receive_webhook_for_module' :
ensure => present,
webhook_url => 'https://puppet:puppet@hole.in.firewall:8088/module',
token => hiera('github_api_token'),
project_name => 'organization/puppet-module_name',
server_url => 'https://api.github.com',
disable_ssl_verify => true,
provider => 'github',
}
```

### Running without mcollective
If you have only a single master, you may want to have the webhook run r10k directly rather then
as peadmin via mcollective. This requires you to run as the user that can perform `r10k` commands
Expand Down
2 changes: 1 addition & 1 deletion files/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def bash_check(file)
end

def puppet_lint(file)
system('puppet-lint ' + file)
system('puppet-lint ' + File.absolute_path(file))
end

def puppet_erb_check(file)
Expand Down
2 changes: 1 addition & 1 deletion manifests/webhook.pp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
}
}

if versioncmp($::pe_version, '3.7.0') > 0 {
if versioncmp($::pe_version, '3.7.0') >= 0{
if !defined(Package['rack']) {
package { 'rack':
ensure => installed,
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"source": "https://github.com/acidprime/r10k",
"summary": "Module for setting up dynamic environments using r10k",
"tags": ["git", "pe", "environment", "mcollective"],
"version": "2.6.3",
"version": "2.6.4",
"dependencies": [
{
"name": "puppetlabs/stdlib",
Expand Down
10 changes: 9 additions & 1 deletion spec/classes/webhook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
'ensure' => 'present',
)
}
it { should contain_file("peadmin-cert.pem").with(
'path' => '/var/lib/peadmin/.mcollective.d/peadmin-cert.pem',
'ensure' => 'file',
'owner' => 'peadmin',
'group' => 'peadmin',
'mode' => '0644',
)
}
end
context "Puppet Enterprise 3.7.x on a RedHat 5 installing webhook" do
let :facts do
Expand All @@ -29,7 +37,7 @@
'ensure' => 'present',
)
}
it { should contain_file("rack").with(
it { should contain_file("peadmin-cert.pem").with(
'path' => '/var/lib/peadmin/.mcollective.d/peadmin-cert.pem',
'ensure' => 'file',
'owner' => 'peadmin',
Expand Down