Showing with 50 additions and 47 deletions.
  1. +2 −0 CHANGELOG
  2. +1 −1 Modulefile
  3. +42 −43 README.md
  4. +4 −2 manifests/webhook.pp
  5. +1 −1 metadata.json
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
2.6.3 - Eli Young
* Ordering issues #134 & #138
2.6.2 - harrytford
* Webhook new installs fix #132
2.6.1 - Gary Larizza
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.2'
version '2.6.3'
source 'https://github.com/acidprime/r10k'
author 'zack'
license 'Apache License, Version 2.0'
Expand Down
85 changes: 42 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,49 +273,6 @@ The webhook must be configured on the respective "control" repository a master t

Currently this is a feature Puppet Enterprise only.

### Webhook Prefix Example

The following is an example of declaring the webhook when r10k [prefixing](#prefixes) are enabled.

#### prefix_command.rb
This script is fed the github/gitlab payload in via stdin. This script is meant to return the prefix as its output.
This is needed as the payload does not contain the r10k prefix. The simplest way to determine the prefix is to
use the remote url in the payload and find the respective key in r10k.yaml. An example prefix command is located in
this repo [here](https://github.com/acidprime/r10k/blob/master/files/prefix_command.rb). Note that you may need to
modify this script depending on your remote configuration to use one of the various remote styles.

```puppet
file {'/usr/local/bin/prefix_command.rb':
ensure => file,
mode => '0755',
owner => 'root',
group => '0',
source => 'puppet:///modules/r10k/prefix_command.rb',
}
class {'r10k::webhook::config':
prefix => true,
prefix_command => '/usr/local/bin/prefix_command.rb',
require => File['/usr/local/bin/prefix_command.rb'],
}
class {'r10k::webhook':
require => Class['r10k::webhook::config'],
}
# Deploy this webhook to your local gitlab server for the puppet/control repo.
# https://github.com/abrader/abrader-gms
git_webhook { 'web_post_receive_webhook' :
ensure => present,
webhook_url => 'https://puppet:puppet@master.of.masters:8088/payload',
token => hiera('gitlab_api_token'),
project_name => 'puppet/control',
server_url => 'http://your.internal.gitlab.com',
provider => 'gitlab',
}
```

### Webhook Non authenticated example
This is an example of using the webhok 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.
Expand Down Expand Up @@ -380,6 +337,48 @@ class {'r10k::webhook':
}
```

### Webhook Prefix Example

The following is an example of declaring the webhook when r10k [prefixing](#prefixes) are enabled.

#### prefix_command.rb
This script is fed the github/gitlab payload in via stdin. This script is meant to return the prefix as its output.
This is needed as the payload does not contain the r10k prefix. The simplest way to determine the prefix is to
use the remote url in the payload and find the respective key in r10k.yaml. An example prefix command is located in
this repo [here](https://github.com/acidprime/r10k/blob/master/files/prefix_command.rb). Note that you may need to
modify this script depending on your remote configuration to use one of the various remote styles.

```puppet
file {'/usr/local/bin/prefix_command.rb':
ensure => file,
mode => '0755',
owner => 'root',
group => '0',
source => 'puppet:///modules/r10k/prefix_command.rb',
}
class {'r10k::webhook::config':
prefix => true,
prefix_command => '/usr/local/bin/prefix_command.rb',
require => File['/usr/local/bin/prefix_command.rb'],
}
class {'r10k::webhook':
require => Class['r10k::webhook::config'],
}
# Deploy this webhook to your local gitlab server for the puppet/control repo.
# https://github.com/abrader/abrader-gms
git_webhook { 'web_post_receive_webhook' :
ensure => present,
webhook_url => 'https://puppet:puppet@master.of.masters:8088/payload',
token => hiera('gitlab_api_token'),
project_name => 'puppet/control',
server_url => 'http://your.internal.gitlab.com',
provider => 'gitlab',
}
```



Expand Down
6 changes: 4 additions & 2 deletions manifests/webhook.pp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
path => '/usr/local/bin/webhook',
notify => Service['webhook'],
}

service { 'webhook':
ensure => 'running',
enable => true,
Expand All @@ -50,6 +50,7 @@
package { 'sinatra':
ensure => installed,
provider => 'pe_gem',
before => Service['webhook'],
}
}

Expand All @@ -58,6 +59,7 @@
package { 'rack':
ensure => installed,
provider => 'pe_gem',
before => Service['webhook'],
}
}
# 3.7 does not place the certificate in peadmin's ~
Expand All @@ -69,7 +71,7 @@
group => 'peadmin',
mode => '0644',
content => file('/etc/puppetlabs/puppet/ssl/certs/pe-internal-peadmin-mcollective-client.pem'),
before => File['webhook_init_script'],
notify => Service['webhook'],
}
}
}
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.2",
"version": "2.6.3",
"dependencies": [
{
"name": "puppetlabs/stdlib",
Expand Down