3
0

Merge branch 'jenkins-build-34' into 'master'

Auto-merge for build 34

See merge request puppet/puppet_cd!30
This commit is contained in:
2025-10-23 20:16:54 +00:00
6 changed files with 34 additions and 19 deletions

View File

@@ -1502,6 +1502,24 @@
— —
<div class='inline'> <div class='inline'>
<p>whether to manage the puppet user</p> <p>whether to manage the puppet user</p>
</div>
</li>
<li>
<span class='name'>pt_webhook_secret</span>
<span class='type'>(<tt>String</tt>)</span>
<em class="default">(defaults to: <tt>&#39;&#39;</tt>)</em>
&mdash;
<div class='inline'>
<p>the secret for the webhook</p>
</div> </div>
</li> </li>
@@ -1517,7 +1535,6 @@
<pre class="lines"> <pre class="lines">
88
89 89
90 90
91 91
@@ -1678,10 +1695,12 @@
246 246
247 247
248 248
249</pre> 249
250
251</pre>
</td> </td>
<td> <td>
<pre class="code"><span class="info file"># File 'manifests/params.pp', line 88</span> <pre class="code"><span class="info file"># File 'manifests/params.pp', line 89</span>
class puppet_cd::params ( class puppet_cd::params (
@@ -1773,6 +1792,7 @@ class puppet_cd::params (
String $pt_r10k_remote = &#39;git@gitlab.example.net/repo.git&#39;, String $pt_r10k_remote = &#39;git@gitlab.example.net/repo.git&#39;,
Boolean $pt_r10k_prefix = false, Boolean $pt_r10k_prefix = false,
String $pt_r10k_basedir = &#39;/etc/puppetlabs/code/environments&#39;, String $pt_r10k_basedir = &#39;/etc/puppetlabs/code/environments&#39;,
String $pt_webhook_secret = &#39;&#39;,
) { ) {
# facts # facts

View File

@@ -163,7 +163,8 @@
65 65
66 66
67 67
68</pre> 68
69</pre>
</td> </td>
<td> <td>
<pre class="code"><span class="info file"># File 'manifests/r10k/webhook.pp', line 6</span> <pre class="code"><span class="info file"># File 'manifests/r10k/webhook.pp', line 6</span>
@@ -207,6 +208,7 @@ class puppet_cd::r10k::webhook (
seltype =&gt; etc_t, seltype =&gt; etc_t,
seluser =&gt; system_u, seluser =&gt; system_u,
content =&gt; template($pt_r10k_hook_config_erb), content =&gt; template($pt_r10k_hook_config_erb),
notify =&gt; Service[&#39;webhook&#39;],
} }
# create service config # create service config
@@ -219,15 +221,15 @@ class puppet_cd::r10k::webhook (
seltype =&gt; systemd_unit_file_t, seltype =&gt; systemd_unit_file_t,
seluser =&gt; system_u, seluser =&gt; system_u,
content =&gt; template($pt_r10k_hook_service_erb), content =&gt; template($pt_r10k_hook_service_erb),
notify =&gt; Service[&#39;webhook&#39;],
} }
# manage service # manage service
service { &#39;r10k-webhook&#39;: service { &#39;webhook&#39;:
ensure =&gt; &#39;running&#39;, ensure =&gt; &#39;running&#39;,
hasstatus =&gt; true, hasstatus =&gt; true,
hasrestart =&gt; true, hasrestart =&gt; true,
enable =&gt; true, enable =&gt; true,
subscribe =&gt; File[$pt_r10k_hook_service_file],
} }
} }
}</pre> }</pre>

View File

@@ -84,6 +84,7 @@
# @param [String] pt_r10k_basedir the base directory for r10k.yaml # @param [String] pt_r10k_basedir the base directory for r10k.yaml
# @param [String] pt_r10k_webhook_pkg the packages for the r10k webhook # @param [String] pt_r10k_webhook_pkg the packages for the r10k webhook
# @param [Boolean] pt_manage_user whether to manage the puppet user # @param [Boolean] pt_manage_user whether to manage the puppet user
# @param [String] pt_webhook_secret the secret for the webhook
############################################################################### ###############################################################################
class puppet_cd::params ( class puppet_cd::params (
@@ -175,6 +176,7 @@ class puppet_cd::params (
String $pt_r10k_remote = 'git@gitlab.example.net/repo.git', String $pt_r10k_remote = 'git@gitlab.example.net/repo.git',
Boolean $pt_r10k_prefix = false, Boolean $pt_r10k_prefix = false,
String $pt_r10k_basedir = '/etc/puppetlabs/code/environments', String $pt_r10k_basedir = '/etc/puppetlabs/code/environments',
String $pt_webhook_secret = '',
) { ) {
# facts # facts

View File

@@ -42,6 +42,7 @@ class puppet_cd::r10k::webhook (
seltype => etc_t, seltype => etc_t,
seluser => system_u, seluser => system_u,
content => template($pt_r10k_hook_config_erb), content => template($pt_r10k_hook_config_erb),
notify => Service['webhook'],
} }
# create service config # create service config
@@ -54,15 +55,15 @@ class puppet_cd::r10k::webhook (
seltype => systemd_unit_file_t, seltype => systemd_unit_file_t,
seluser => system_u, seluser => system_u,
content => template($pt_r10k_hook_service_erb), content => template($pt_r10k_hook_service_erb),
notify => Service['webhook'],
} }
# manage service # manage service
service { 'r10k-webhook': service { 'webhook':
ensure => 'running', ensure => 'running',
hasstatus => true, hasstatus => true,
hasrestart => true, hasrestart => true,
enable => true, enable => true,
subscribe => File[$pt_r10k_hook_service_file],
} }
} }
} }

View File

@@ -11,7 +11,7 @@
"trigger-rule": { "trigger-rule": {
"match": { "match": {
"type": "payload-hash-sha1", "type": "payload-hash-sha1",
"secret": "your_webhook_secret" "secret": "<%= @pt_webhook_secret %>"
} }
} }
} }

View File

@@ -1,10 +0,0 @@
{
"host": "<%= @pt_pm_fqdn %>",
"port": "8088",
"flush_env_cache": false,
"branch_to_env_map": {
"master": "production",
"^env_(.*)$": "\g<1>"
},
"allowed_branches": "^(env_[\w]+|master)$"
}