3
0

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

Auto-merge for build 57

See merge request puppet/puppet_cd!53
This commit is contained in:
2025-10-26 13:24:44 +00:00
19 changed files with 125 additions and 67 deletions

View File

@@ -21,11 +21,13 @@
"refreshonly", "refreshonly",
"repolist", "repolist",
"requestlogging", "requestlogging",
"rubygems",
"springframework", "springframework",
"startswith", "startswith",
"Supress", "Supress",
"trapperkeeper", "trapperkeeper",
"utcnow", "utcnow",
"uvicorn" "uvicorn",
"webrick"
] ]
} }

View File

@@ -73,11 +73,6 @@
</li> </li>
<li>
<span class='object_link'><a href="puppet_classes/puppet_cd_3A_3Afirewall_3A_3Aiptables.html" title="puppet_classes::puppet_cd::firewall::iptables (puppet_class)">puppet_cd::firewall::iptables</a></span>
</li>
<li> <li>
<span class='object_link'><a href="puppet_classes/puppet_cd_3A_3Amain_3A_3Aconfig.html" title="puppet_classes::puppet_cd::main::config (puppet_class)">puppet_cd::main::config</a></span> <span class='object_link'><a href="puppet_classes/puppet_cd_3A_3Amain_3A_3Aconfig.html" title="puppet_classes::puppet_cd::main::config (puppet_class)">puppet_cd::main::config</a></span>
@@ -103,11 +98,6 @@
</li> </li>
<li>
<span class='object_link'><a href="puppet_classes/puppet_cd_3A_3Aparams.html" title="puppet_classes::puppet_cd::params (puppet_class)">puppet_cd::params</a></span>
</li>
<li> <li>
<span class='object_link'><a href="puppet_classes/puppet_cd_3A_3Apuppetdb_3A_3Adirs.html" title="puppet_classes::puppet_cd::puppetdb::dirs (puppet_class)">puppet_cd::puppetdb::dirs</a></span> <span class='object_link'><a href="puppet_classes/puppet_cd_3A_3Apuppetdb_3A_3Adirs.html" title="puppet_classes::puppet_cd::puppetdb::dirs (puppet_class)">puppet_cd::puppetdb::dirs</a></span>

View File

@@ -43,55 +43,41 @@
</li> </li>
<li id="object_puppet_classes::puppet_cd::firewall::iptables" class="even"> <li id="object_puppet_classes::puppet_cd::main::config" class="even">
<div class="item">
<span class='object_link'><a href="puppet_classes/puppet_cd_3A_3Afirewall_3A_3Aiptables.html" title="puppet_classes::puppet_cd::firewall::iptables (puppet_class)">puppet_cd::firewall::iptables</a></span>
</div>
</li>
<li id="object_puppet_classes::puppet_cd::main::config" class="odd">
<div class="item"> <div class="item">
<span class='object_link'><a href="puppet_classes/puppet_cd_3A_3Amain_3A_3Aconfig.html" title="puppet_classes::puppet_cd::main::config (puppet_class)">puppet_cd::main::config</a></span> <span class='object_link'><a href="puppet_classes/puppet_cd_3A_3Amain_3A_3Aconfig.html" title="puppet_classes::puppet_cd::main::config (puppet_class)">puppet_cd::main::config</a></span>
</div> </div>
</li> </li>
<li id="object_puppet_classes::puppet_cd::main::dirs" class="even"> <li id="object_puppet_classes::puppet_cd::main::dirs" class="odd">
<div class="item"> <div class="item">
<span class='object_link'><a href="puppet_classes/puppet_cd_3A_3Amain_3A_3Adirs.html" title="puppet_classes::puppet_cd::main::dirs (puppet_class)">puppet_cd::main::dirs</a></span> <span class='object_link'><a href="puppet_classes/puppet_cd_3A_3Amain_3A_3Adirs.html" title="puppet_classes::puppet_cd::main::dirs (puppet_class)">puppet_cd::main::dirs</a></span>
</div> </div>
</li> </li>
<li id="object_puppet_classes::puppet_cd::main::files" class="odd"> <li id="object_puppet_classes::puppet_cd::main::files" class="even">
<div class="item"> <div class="item">
<span class='object_link'><a href="puppet_classes/puppet_cd_3A_3Amain_3A_3Afiles.html" title="puppet_classes::puppet_cd::main::files (puppet_class)">puppet_cd::main::files</a></span> <span class='object_link'><a href="puppet_classes/puppet_cd_3A_3Amain_3A_3Afiles.html" title="puppet_classes::puppet_cd::main::files (puppet_class)">puppet_cd::main::files</a></span>
</div> </div>
</li> </li>
<li id="object_puppet_classes::puppet_cd::main::install" class="even"> <li id="object_puppet_classes::puppet_cd::main::install" class="odd">
<div class="item"> <div class="item">
<span class='object_link'><a href="puppet_classes/puppet_cd_3A_3Amain_3A_3Ainstall.html" title="puppet_classes::puppet_cd::main::install (puppet_class)">puppet_cd::main::install</a></span> <span class='object_link'><a href="puppet_classes/puppet_cd_3A_3Amain_3A_3Ainstall.html" title="puppet_classes::puppet_cd::main::install (puppet_class)">puppet_cd::main::install</a></span>
</div> </div>
</li> </li>
<li id="object_puppet_classes::puppet_cd::main::user" class="odd"> <li id="object_puppet_classes::puppet_cd::main::user" class="even">
<div class="item"> <div class="item">
<span class='object_link'><a href="puppet_classes/puppet_cd_3A_3Amain_3A_3Auser.html" title="puppet_classes::puppet_cd::main::user (puppet_class)">puppet_cd::main::user</a></span> <span class='object_link'><a href="puppet_classes/puppet_cd_3A_3Amain_3A_3Auser.html" title="puppet_classes::puppet_cd::main::user (puppet_class)">puppet_cd::main::user</a></span>
</div> </div>
</li> </li>
<li id="object_puppet_classes::puppet_cd::params" class="even">
<div class="item">
<span class='object_link'><a href="puppet_classes/puppet_cd_3A_3Aparams.html" title="puppet_classes::puppet_cd::params (puppet_class)">puppet_cd::params</a></span>
</div>
</li>
<li id="object_puppet_classes::puppet_cd::puppetdb::dirs" class="odd"> <li id="object_puppet_classes::puppet_cd::puppetdb::dirs" class="odd">
<div class="item"> <div class="item">
<span class='object_link'><a href="puppet_classes/puppet_cd_3A_3Apuppetdb_3A_3Adirs.html" title="puppet_classes::puppet_cd::puppetdb::dirs (puppet_class)">puppet_cd::puppetdb::dirs</a></span> <span class='object_link'><a href="puppet_classes/puppet_cd_3A_3Apuppetdb_3A_3Adirs.html" title="puppet_classes::puppet_cd::puppetdb::dirs (puppet_class)">puppet_cd::puppetdb::dirs</a></span>

View File

@@ -64,7 +64,7 @@
<dl> <dl>
<dt>Inherits:</dt> <dt>Inherits:</dt>
<dd><span class='object_link'><a href="puppet_cd_3A_3Aparams.html" title="puppet_classes::puppet_cd::params (puppet_class)">puppet_cd::params</a></span></dd> <dd>puppet_cd::params</dd>
</dl> </dl>

View File

@@ -64,7 +64,7 @@
<dl> <dl>
<dt>Inherits:</dt> <dt>Inherits:</dt>
<dd><span class='object_link'><a href="puppet_cd_3A_3Aparams.html" title="puppet_classes::puppet_cd::params (puppet_class)">puppet_cd::params</a></span></dd> <dd>puppet_cd::params</dd>
</dl> </dl>

View File

@@ -64,7 +64,7 @@
<dl> <dl>
<dt>Inherits:</dt> <dt>Inherits:</dt>
<dd><span class='object_link'><a href="puppet_cd_3A_3Aparams.html" title="puppet_classes::puppet_cd::params (puppet_class)">puppet_cd::params</a></span></dd> <dd>puppet_cd::params</dd>
</dl> </dl>

View File

@@ -64,7 +64,7 @@
<dl> <dl>
<dt>Inherits:</dt> <dt>Inherits:</dt>
<dd><span class='object_link'><a href="puppet_cd_3A_3Aparams.html" title="puppet_classes::puppet_cd::params (puppet_class)">puppet_cd::params</a></span></dd> <dd>puppet_cd::params</dd>
</dl> </dl>

View File

@@ -64,7 +64,7 @@
<dl> <dl>
<dt>Inherits:</dt> <dt>Inherits:</dt>
<dd><span class='object_link'><a href="puppet_cd_3A_3Aparams.html" title="puppet_classes::puppet_cd::params (puppet_class)">puppet_cd::params</a></span></dd> <dd>puppet_cd::params</dd>
</dl> </dl>

View File

@@ -64,7 +64,7 @@
<dl> <dl>
<dt>Inherits:</dt> <dt>Inherits:</dt>
<dd><span class='object_link'><a href="puppet_cd_3A_3Aparams.html" title="puppet_classes::puppet_cd::params (puppet_class)">puppet_cd::params</a></span></dd> <dd>puppet_cd::params</dd>
</dl> </dl>

View File

@@ -64,7 +64,7 @@
<dl> <dl>
<dt>Inherits:</dt> <dt>Inherits:</dt>
<dd><span class='object_link'><a href="puppet_cd_3A_3Aparams.html" title="puppet_classes::puppet_cd::params (puppet_class)">puppet_cd::params</a></span></dd> <dd>puppet_cd::params</dd>
</dl> </dl>

View File

@@ -64,7 +64,7 @@
<dl> <dl>
<dt>Inherits:</dt> <dt>Inherits:</dt>
<dd><span class='object_link'><a href="puppet_cd_3A_3Aparams.html" title="puppet_classes::puppet_cd::params (puppet_class)">puppet_cd::params</a></span></dd> <dd>puppet_cd::params</dd>
</dl> </dl>

View File

@@ -64,7 +64,7 @@
<dl> <dl>
<dt>Inherits:</dt> <dt>Inherits:</dt>
<dd><span class='object_link'><a href="puppet_cd_3A_3Aparams.html" title="puppet_classes::puppet_cd::params (puppet_class)">puppet_cd::params</a></span></dd> <dd>puppet_cd::params</dd>
</dl> </dl>
@@ -164,7 +164,29 @@
66 66
67 67
68 68
69</pre> 69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91</pre>
</td> </td>
<td> <td>
<pre class="code"><span class="info file"># File 'manifests/r10k/install.pp', line 6</span> <pre class="code"><span class="info file"># File 'manifests/r10k/install.pp', line 6</span>
@@ -191,6 +213,7 @@ class puppet_cd::r10k::install (
package { &#39;r10k&#39;: package { &#39;r10k&#39;:
ensure =&gt; $pt_pkg_ensure, ensure =&gt; $pt_pkg_ensure,
provider =&gt; gem, provider =&gt; gem,
require =&gt; Package[$pt_r10k_pkg],
} }
# create r10k dir # create r10k dir
@@ -219,16 +242,37 @@ class puppet_cd::r10k::install (
require =&gt; File[&#39;r10k_dir&#39;], require =&gt; File[&#39;r10k_dir&#39;],
content =&gt; template($pt_r10k_erb), content =&gt; template($pt_r10k_erb),
} }
if $pt_use_r10k_webhook == true { if $pt_use_r10k_webhook == true {
file { $pt_r10k_webhook_pkg: package { $pt_r10k_webhook_pkg:
ensure =&gt; file, ensure =&gt; present,
source =&gt; &#39;puppet:///modules/puppet_cd/webhook-go.rpm&#39; provider =&gt; gem,
require =&gt; Package[$pt_r10k_pkg],
} }
exec { &#39;install rpm&#39;: exec { &#39;create symlink&#39;:
command =&gt; &quot;yum install -y ${pt_r10k_webhook_pkg}&quot;, command =&gt; $pt_webhook_link,
unless =&gt; &#39;rpm -qa | grep webhook-go&#39;, creates =&gt; &#39;/usr/bin/r10k_gitlab_webhook&#39;,
require =&gt; File[$pt_r10k_webhook_pkg], path =&gt; [&#39;/bin&#39;, &#39;/usr/bin&#39;],
require =&gt; Package[$pt_r10k_webhook_pkg],
}
file { $pt_webhook_service_file:
ensure =&gt; file,
owner =&gt; &#39;root&#39;,
group =&gt; &#39;root&#39;,
mode =&gt; &#39;0664&#39;,
selrange =&gt; s0,
selrole =&gt; object_r,
seltype =&gt; puppet_etc_t,
seluser =&gt; unconfined_u,
content =&gt; template($pt_webhook_service_erb),
notify =&gt; [Service[$pt_r10k_webhook_service],Exec[&#39;systemctl-daemon-reload&#39;]],
}
exec { &#39;systemctl-daemon-reload&#39;:
command =&gt; &#39;/bin/systemctl daemon-reload&#39;,
refreshonly =&gt; true,
} }
} }
} }

View File

@@ -64,7 +64,7 @@
<dl> <dl>
<dt>Inherits:</dt> <dt>Inherits:</dt>
<dd><span class='object_link'><a href="puppet_cd_3A_3Aparams.html" title="puppet_classes::puppet_cd::params (puppet_class)">puppet_cd::params</a></span></dd> <dd>puppet_cd::params</dd>
</dl> </dl>
@@ -149,8 +149,7 @@
51 51
52 52
53 53
54 54</pre>
55</pre>
</td> </td>
<td> <td>
<pre class="code"><span class="info file"># File 'manifests/server/service.pp', line 6</span> <pre class="code"><span class="info file"># File 'manifests/server/service.pp', line 6</span>
@@ -196,8 +195,7 @@ class puppet_cd::server::service (
# manage webhook service # manage webhook service
if $pt_use_r10k_webhook == true { if $pt_use_r10k_webhook == true {
require puppet_cd::r10k::install require puppet_cd::r10k::install
service { $pt_r10k_webhook_service:
service { $pt_webhook_service:
ensure =&gt; running, ensure =&gt; running,
hasstatus =&gt; true, hasstatus =&gt; true,
hasrestart =&gt; true, hasrestart =&gt; true,

Binary file not shown.

View File

@@ -18,9 +18,9 @@ class puppet_cd::firewall::iptables (
jump => 'accept', jump => 'accept',
} }
if $pt_use_r10k_webhook == true { if $pt_use_r10k_webhook == true {
firewall { '34000 open port 4000': firewall { "3${pt_r10k_webhook_port} open port ${pt_r10k_webhook_port}":
proto => 'tcp', proto => 'tcp',
dport => '4000', dport => $pt_r10k_webhook_port
jump => 'accept', jump => 'accept',
} }
} }

View File

@@ -82,8 +82,9 @@
# @param [String] pt_r10k_remote the remote url for the r10k control repo # @param [String] pt_r10k_remote the remote url for the r10k control repo
# @param [Boolean] pt_r10k_prefix the r10k prefix. defaults to false # @param [Boolean] pt_r10k_prefix the r10k prefix. defaults to false
# @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 [Array] 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_r10k_webhook_port the port for the webhook listener
############################################################################### ###############################################################################
class puppet_cd::params ( class puppet_cd::params (
@@ -96,8 +97,8 @@ class puppet_cd::params (
String $pt_agent_pkg = 'puppet-agent', String $pt_agent_pkg = 'puppet-agent',
String $pt_server_pkg = 'puppetserver', String $pt_server_pkg = 'puppetserver',
Array $pt_db_pkg = ['puppetdb','puppetdb-termini'], Array $pt_db_pkg = ['puppetdb','puppetdb-termini'],
Array $pt_r10k_pkg = ['ruby','ruby-devel','gcc','make','redhat-rpm-config','rpm-build'], Array $pt_r10k_pkg = ['ruby','ruby-devel','rubygems','gcc','make'],
String $pt_r10k_webhook_pkg = '/tmp/webhook-go.rpm', Array $pt_r10k_webhook_pkg = ['webrick', 'r10k_gitlab_webhook'],
# user settings # user settings
## puppet user ## puppet user
@@ -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_r10k_webhook_port = '8080'.
) { ) {
# facts # facts
@@ -232,12 +234,15 @@ class puppet_cd::params (
## r10k ## r10k
$pt_r10k_file = "${pt_r10k_dir}/r10k.yaml" $pt_r10k_file = "${pt_r10k_dir}/r10k.yaml"
$pt_r10k_erb = 'puppet_cd/r10k/r10k.yaml.erb' $pt_r10k_erb = 'puppet_cd/r10k/r10k.yaml.erb'
$pt_webhook_link = 'ln -sf /usr/local/share/gems/gems/r10k_gitlab_webhook-0.1.3/bin/r10k_gitlab_webhook /usr/bin/'
$pt_webhook_service_file = '/etc/systemd/system/r10k_gitlab_webhook.service'
$pt_webhook_service_erb = 'puppet_cd/r10k/r10k_webhook_service.erb'
# service # service
$pt_server_service = 'puppetserver' $pt_server_service = 'puppetserver'
$pt_agent_service = 'puppet' $pt_agent_service = 'puppet'
$pt_db_service = 'puppetdb' $pt_db_service = 'puppetdb'
$pt_webhook_service = 'webhook-go.service' $pt_r10k_webhook_service = 'r10k_gitlab_webhook'
# #
# includes must be last # includes must be last

View File

@@ -25,6 +25,7 @@ class puppet_cd::r10k::install (
package { 'r10k': package { 'r10k':
ensure => $pt_pkg_ensure, ensure => $pt_pkg_ensure,
provider => gem, provider => gem,
require => Package[$pt_r10k_pkg],
} }
# create r10k dir # create r10k dir
@@ -53,16 +54,37 @@ class puppet_cd::r10k::install (
require => File['r10k_dir'], require => File['r10k_dir'],
content => template($pt_r10k_erb), content => template($pt_r10k_erb),
} }
if $pt_use_r10k_webhook == true { if $pt_use_r10k_webhook == true {
file { $pt_r10k_webhook_pkg: package { $pt_r10k_webhook_pkg:
ensure => file, ensure => present,
source => 'puppet:///modules/puppet_cd/webhook-go.rpm' provider => gem,
require => Package[$pt_r10k_pkg],
} }
exec { 'install rpm': exec { 'create symlink':
command => "yum install -y ${pt_r10k_webhook_pkg}", command => $pt_webhook_link,
unless => 'rpm -qa | grep webhook-go', creates => '/usr/bin/r10k_gitlab_webhook',
require => File[$pt_r10k_webhook_pkg], path => ['/bin', '/usr/bin'],
require => Package[$pt_r10k_webhook_pkg],
}
file { $pt_webhook_service_file:
ensure => file,
owner => 'root',
group => 'root',
mode => '0664',
selrange => s0,
selrole => object_r,
seltype => puppet_etc_t,
seluser => unconfined_u,
content => template($pt_webhook_service_erb),
notify => [Service[$pt_r10k_webhook_service],Exec['systemctl-daemon-reload']],
}
exec { 'systemctl-daemon-reload':
command => '/bin/systemctl daemon-reload',
refreshonly => true,
} }
} }
} }

View File

@@ -44,8 +44,7 @@ class puppet_cd::server::service (
# manage webhook service # manage webhook service
if $pt_use_r10k_webhook == true { if $pt_use_r10k_webhook == true {
require puppet_cd::r10k::install require puppet_cd::r10k::install
service { $pt_r10k_webhook_service:
service { $pt_webhook_service:
ensure => running, ensure => running,
hasstatus => true, hasstatus => true,
hasrestart => true, hasrestart => true,

View File

@@ -0,0 +1,12 @@
[Unit]
Description=r10k GitLab Webhook
After=network.target
[Service]
ExecStart=/usr/bin/r10k_gitlab_webhook -p <%= @pt_r10k_webhook_port %>
Restart=always
User=root
WorkingDirectory=/etc/puppetlabs/code
[Install]
WantedBy=multi-user.target