webhook_proxy
: Proxy external webhook endpoints to internal hosts
webhook_proxy::endpoint
: An external webhook endpoint
Proxy external webhook endpoints to internal hosts
class { 'webhook_proxy':
cert_fqdn => 'webhook.example.com',
jenkins_fqdns => [ 'jenkins.internal.example.com' ],
endpoints => [
'https://pe-prod.internal.example.com:8170/code-manager/v1/webhook',
'http://cd4pe-prod.internal.example.com:8000/github/push',
],
}
class profile::webhook::proxy (
String[1] $canonical_fqdn = $facts['networking']['fqdn'],
) {
include profile::nginx
profile::nginx::redirect { 'default':
destination => "https://${canonical_fqdn}",
default => true,
ssl => true,
}
class { 'webhook_proxy':
cert_fqdn => 'webhook.example.com',
jenkins_fqdns => [
'jenkins-prod.internal.example.com',
'jenkins-test.internal.example.com',
],
endpoints => [
'https://pe-prod.internal.example.com:8170/code-manager/v1/webhook',
'http://cd4pe-prod.internal.example.com:8000/github/push',
],
canonical_fqdn => $canonical_fqdn,
format_log => 'logstash_json',
server_cfg_append => {
error_page => '502 503 504 /private-maintenance.html',
proxy_intercept_errors => 'on',
},
ssl_name => 'webhook.example.com',
}
nginx::resource::location { 'webhook __maintenance':
server => 'webhook',
ssl => true,
ssl_only => true,
location => '= /private-maintenance.html',
internal => true,
www_root => '/var/nginx/maintenance',
}
}
The following parameters are available in the webhook_proxy
class:
Data type: Stdlib::Fqdn
The FQDN of the certificate to be used by the proxy
Data type: Array[Stdlib::Fqdn]
An array of FQDN's of Jenkins instances that need to receive webhooks from GitHub
Default value: []
Data type: Array[Stdlib::Httpurl]
An array of url's that webhook will be able to be delivered to
Default value: []
Data type: String[1]
The FQDN to be used by Nginx as the server name.
Default value: $facts['networking']['fqdn']
Data type: String[1]
The FQDN of the associated cert. Genrally this is the same as
$cert_fqdn
but may also be something like wildcard.example.com
when you are using a wildcard cert to cover webhooks.example.com
.
Default value: $cert_fqdn
Data type: Optional[String[1]]
The log format to be passed through to nginx::resource::server
Default value: undef
Data type: Optional[Hash]
Any additional configuration you wish to passed through to
nginx::resource::server
Default value: undef
If name is set to the internal webhook endpoint, this will automatically
generate a path in the form /$hostname/$url
. For example, the name
'https://foo.internal.example.com/github-webhook/'
will result in
an external endpoint path of /foo.internal.example.com/github-webhook/
.
webhook_proxy::endpoint { 'https://pe-prod.internal.example.com:8170/code-manager/v1/webhook': }
The following parameters are available in the webhook_proxy::endpoint
defined type:
Data type: Pattern[/^\//]
The location, or path under this proxy's fqdn, that will have data sent to it for the given target
Default value: ('/*$', '/')
Data type: Pattern[/^https?:\/\/\w.+\//]
The internal destination for the traffic
Default value: $name