Recommit for updates in build 235
This commit is contained in:
127
Jenkinsfile
vendored
127
Jenkinsfile
vendored
@@ -1,127 +0,0 @@
|
|||||||
pipeline {
|
|
||||||
agent {
|
|
||||||
label 'puppet'
|
|
||||||
}
|
|
||||||
|
|
||||||
post {
|
|
||||||
always {
|
|
||||||
deleteDir() /* clean up our workspace */
|
|
||||||
}
|
|
||||||
success {
|
|
||||||
updateGitlabCommitStatus state: 'success'
|
|
||||||
}
|
|
||||||
failure {
|
|
||||||
updateGitlabCommitStatus state: 'failed'
|
|
||||||
step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'support@confdroid.com', sendToIndividuals: true])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
options {
|
|
||||||
gitLabConnection('gitlab.confdroid.com')
|
|
||||||
}
|
|
||||||
|
|
||||||
stages {
|
|
||||||
|
|
||||||
stage('pull master') {
|
|
||||||
steps {
|
|
||||||
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
|
|
||||||
sh '''
|
|
||||||
git config user.name "Jenkins Server"
|
|
||||||
git config user.email jenkins@confdroid.com
|
|
||||||
# Ensure we're on the development branch (triggered by push)
|
|
||||||
git checkout development
|
|
||||||
# Create jenkins branch from development
|
|
||||||
git checkout -b jenkins-build-$BUILD_NUMBER
|
|
||||||
# Optionally merge master into jenkins to ensure compatibility
|
|
||||||
git merge origin/master --no-ff || { echo "Merge conflict detected"; exit 1; }
|
|
||||||
'''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('puppet parser') {
|
|
||||||
steps {
|
|
||||||
sh '''for file in $(find . -iname \'*.pp\'); do
|
|
||||||
/opt/puppetlabs/bin/puppet parser validate --color false --render-as s --modulepath=modules $file || exit 1;
|
|
||||||
done;'''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('check templates') {
|
|
||||||
steps{
|
|
||||||
sh '''for file in $(find . -iname \'*.erb\');
|
|
||||||
do erb -P -x -T "-" $file | ruby -c || exit 1;
|
|
||||||
done;'''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('puppet-lint') {
|
|
||||||
steps {
|
|
||||||
sh '''/usr/local/bin/puppet-lint . \\
|
|
||||||
--no-variable_scope-check \\
|
|
||||||
|| { echo "Puppet lint failed"; exit 1; }
|
|
||||||
'''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('SonarScan') {
|
|
||||||
steps {
|
|
||||||
withCredentials([string(credentialsId: 'sonar-token', variable: 'SONAR_TOKEN')]) {
|
|
||||||
sh '''
|
|
||||||
/opt/sonar-scanner/bin/sonar-scanner \
|
|
||||||
-Dsonar.projectKey=confdroid_nagios \
|
|
||||||
-Dsonar.sources=. \
|
|
||||||
-Dsonar.host.url=https://sonarqube.confdroid.com \
|
|
||||||
-Dsonar.token=$SONAR_TOKEN
|
|
||||||
'''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('create Puppet documentation') {
|
|
||||||
steps {
|
|
||||||
sh '/opt/puppetlabs/bin/puppet strings'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('update repo') {
|
|
||||||
steps {
|
|
||||||
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
|
|
||||||
sh '''
|
|
||||||
git config user.name "Jenkins Server"
|
|
||||||
git config user.email jenkins@confdroid.com
|
|
||||||
git rm -r --cached .vscode || echo "No .vscode to remove from git"
|
|
||||||
git add -A && git commit -am "Recommit for updates in build $BUILD_NUMBER" || echo "No changes to commit"
|
|
||||||
git push origin HEAD:master
|
|
||||||
'''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Mirror to Gitea') {
|
|
||||||
steps {
|
|
||||||
withCredentials([usernamePassword(
|
|
||||||
credentialsId: 'Jenkins-gitea',
|
|
||||||
usernameVariable: 'GITEA_USER',
|
|
||||||
passwordVariable: 'GITEA_TOKEN')]) {
|
|
||||||
script {
|
|
||||||
// Checkout from GitLab (already done implicitly)
|
|
||||||
sh '''
|
|
||||||
git checkout master
|
|
||||||
git pull origin master
|
|
||||||
git branch -D development
|
|
||||||
git branch -D jenkins-build-$BUILD_NUMBER
|
|
||||||
git rm -f Jenkinsfile
|
|
||||||
git rm -r --cached .vscode || echo "No .vscode to remove from git"
|
|
||||||
git commit --amend --no-edit --allow-empty
|
|
||||||
git remote add master https://sourcecode.confdroid.com/confdroid/confdroid_nagios.git
|
|
||||||
git -c credential.helper="!f() { echo username=${GITEA_USER}; echo password=${GITEA_TOKEN}; }; f" \
|
|
||||||
push master --mirror
|
|
||||||
'''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -143,8 +143,6 @@
|
|||||||
<p>if <code>ng_include_nrpe</code>is set to <code>true</code>, the confdroid_nrpe module is automatically applied on clients (<a href="https://sourcecode.confdroid.com/confdroid/confdroid_nrpe">confdroid_nrpe</a> must be in the catalogue then)</p>
|
<p>if <code>ng_include_nrpe</code>is set to <code>true</code>, the confdroid_nrpe module is automatically applied on clients (<a href="https://sourcecode.confdroid.com/confdroid/confdroid_nrpe">confdroid_nrpe</a> must be in the catalogue then)</p>
|
||||||
</li><li>
|
</li><li>
|
||||||
<p>if <code>ng_enable_fail2ban</code>is set to <code>true</code>, a fail2ban jail and filter will be added for the Nagios service (requires confdroid_fail2ban).</p>
|
<p>if <code>ng_enable_fail2ban</code>is set to <code>true</code>, a fail2ban jail and filter will be added for the Nagios service (requires confdroid_fail2ban).</p>
|
||||||
</li><li>
|
|
||||||
<p>manage remoteIP logging if running behind a Loadbalancer like HAproxy: if <code>ng_use_lb</code> is set to <code>true</code>, a configuration file <code>etc/httpd/conf.d/loadbalancer-remoteip.conf</code>is created and configures apache/httpd to use the remote header. This allows proper fail2ban protection even behind the Loadbalancer. Make sure to set <code>ng_trusted_proxy</code>to the proper IP or range for the loadbalancer!</p>
|
|
||||||
</li></ul>
|
</li></ul>
|
||||||
|
|
||||||
<h2 id="label-Repo+Documentation">Repo Documentation</h2>
|
<h2 id="label-Repo+Documentation">Repo Documentation</h2>
|
||||||
|
|||||||
@@ -143,8 +143,6 @@
|
|||||||
<p>if <code>ng_include_nrpe</code>is set to <code>true</code>, the confdroid_nrpe module is automatically applied on clients (<a href="https://sourcecode.confdroid.com/confdroid/confdroid_nrpe">confdroid_nrpe</a> must be in the catalogue then)</p>
|
<p>if <code>ng_include_nrpe</code>is set to <code>true</code>, the confdroid_nrpe module is automatically applied on clients (<a href="https://sourcecode.confdroid.com/confdroid/confdroid_nrpe">confdroid_nrpe</a> must be in the catalogue then)</p>
|
||||||
</li><li>
|
</li><li>
|
||||||
<p>if <code>ng_enable_fail2ban</code>is set to <code>true</code>, a fail2ban jail and filter will be added for the Nagios service (requires confdroid_fail2ban).</p>
|
<p>if <code>ng_enable_fail2ban</code>is set to <code>true</code>, a fail2ban jail and filter will be added for the Nagios service (requires confdroid_fail2ban).</p>
|
||||||
</li><li>
|
|
||||||
<p>manage remoteIP logging if running behind a Loadbalancer like HAproxy: if <code>ng_use_lb</code> is set to <code>true</code>, a configuration file <code>etc/httpd/conf.d/loadbalancer-remoteip.conf</code>is created and configures apache/httpd to use the remote header. This allows proper fail2ban protection even behind the Loadbalancer. Make sure to set <code>ng_trusted_proxy</code>to the proper IP or range for the loadbalancer!</p>
|
|
||||||
</li></ul>
|
</li></ul>
|
||||||
|
|
||||||
<h2 id="label-Repo+Documentation">Repo Documentation</h2>
|
<h2 id="label-Repo+Documentation">Repo Documentation</h2>
|
||||||
|
|||||||
@@ -4075,42 +4075,6 @@ inherited by all classes except defines.
|
|||||||
|
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
|
||||||
|
|
||||||
<span class='name'>ng_use_lb</span>
|
|
||||||
|
|
||||||
|
|
||||||
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
||||||
|
|
||||||
|
|
||||||
<em class="default">(defaults to: <tt>false</tt>)</em>
|
|
||||||
|
|
||||||
|
|
||||||
—
|
|
||||||
<div class='inline'>
|
|
||||||
<p>Whether to use load balancing for the Nagios server. Default is false.</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li>
|
|
||||||
|
|
||||||
<span class='name'>ng_trusted_proxy</span>
|
|
||||||
|
|
||||||
|
|
||||||
<span class='type'>(<tt>String</tt>)</span>
|
|
||||||
|
|
||||||
|
|
||||||
<em class="default">(defaults to: <tt>'10.0.0.10'</tt>)</em>
|
|
||||||
|
|
||||||
|
|
||||||
—
|
|
||||||
<div class='inline'>
|
|
||||||
<p>The IP address of the trusted proxy to access the Nagios server. Default is ‘10.0.0.10’.</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
|
|
||||||
<span class='name'>ng_use_ssl_auth</span>
|
<span class='name'>ng_use_ssl_auth</span>
|
||||||
@@ -4135,6 +4099,10 @@ inherited by all classes except defines.
|
|||||||
<pre class="lines">
|
<pre class="lines">
|
||||||
|
|
||||||
|
|
||||||
|
445
|
||||||
|
446
|
||||||
|
447
|
||||||
|
448
|
||||||
449
|
449
|
||||||
450
|
450
|
||||||
451
|
451
|
||||||
@@ -4475,17 +4443,10 @@ inherited by all classes except defines.
|
|||||||
786
|
786
|
||||||
787
|
787
|
||||||
788
|
788
|
||||||
789
|
789</pre>
|
||||||
790
|
|
||||||
791
|
|
||||||
792
|
|
||||||
793
|
|
||||||
794
|
|
||||||
795
|
|
||||||
796</pre>
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<pre class="code"><span class="info file"># File 'manifests/params.pp', line 449</span>
|
<pre class="code"><span class="info file"># File 'manifests/params.pp', line 445</span>
|
||||||
|
|
||||||
class confdroid_nagios::params (
|
class confdroid_nagios::params (
|
||||||
|
|
||||||
@@ -4503,8 +4464,6 @@ class confdroid_nagios::params (
|
|||||||
String $ng_user = 'nagios',
|
String $ng_user = 'nagios',
|
||||||
Boolean $ng_enable_target = true,
|
Boolean $ng_enable_target = true,
|
||||||
Boolean $ng_purge_target = true,
|
Boolean $ng_purge_target = true,
|
||||||
Boolean $ng_use_lb = false,
|
|
||||||
String $ng_trusted_proxy = '10.0.0.10',
|
|
||||||
|
|
||||||
# contact groups
|
# contact groups
|
||||||
String $ng_contactgroup_name = 'admins',
|
String $ng_contactgroup_name = 'admins',
|
||||||
@@ -4775,7 +4734,6 @@ class confdroid_nagios::params (
|
|||||||
$ng_nagios_cfg_erb = 'confdroid_nagios/nagios/nagios_cfg.erb'
|
$ng_nagios_cfg_erb = 'confdroid_nagios/nagios/nagios_cfg.erb'
|
||||||
$ng_cgi_cfg_file = "${ng_main_dir}/cgi.cfg"
|
$ng_cgi_cfg_file = "${ng_main_dir}/cgi.cfg"
|
||||||
$ng_cgi_cfg_erb = 'confdroid_nagios/nagios/cgi_cfg.erb'
|
$ng_cgi_cfg_erb = 'confdroid_nagios/nagios/cgi_cfg.erb'
|
||||||
$ng_remoteip_file = '/etc/httpd/conf.d/loadbalancer-remoteip.conf'
|
|
||||||
|
|
||||||
# nagios
|
# nagios
|
||||||
$ng_target_templates = "${ng_conf_d_dir}/nagios_templates.cfg"
|
$ng_target_templates = "${ng_conf_d_dir}/nagios_templates.cfg"
|
||||||
|
|||||||
@@ -143,22 +143,7 @@
|
|||||||
45
|
45
|
||||||
46
|
46
|
||||||
47
|
47
|
||||||
48
|
48</pre>
|
||||||
49
|
|
||||||
50
|
|
||||||
51
|
|
||||||
52
|
|
||||||
53
|
|
||||||
54
|
|
||||||
55
|
|
||||||
56
|
|
||||||
57
|
|
||||||
58
|
|
||||||
59
|
|
||||||
60
|
|
||||||
61
|
|
||||||
62
|
|
||||||
63</pre>
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<pre class="code"><span class="info file"># File 'manifests/server/files.pp', line 6</span>
|
<pre class="code"><span class="info file"># File 'manifests/server/files.pp', line 6</span>
|
||||||
@@ -204,21 +189,6 @@ class confdroid_nagios::server::files (
|
|||||||
seltype => nagios_var_run_t,
|
seltype => nagios_var_run_t,
|
||||||
seluser => system_u,
|
seluser => system_u,
|
||||||
}
|
}
|
||||||
|
|
||||||
if $ng_use_lb == true {
|
|
||||||
file { $ng_remoteip_file:
|
|
||||||
ensure => file,
|
|
||||||
owner => 'root',
|
|
||||||
group => 'root',
|
|
||||||
mode => '0644',
|
|
||||||
selrange => s0,
|
|
||||||
selrole => object_r,
|
|
||||||
seltype => httpd_conf_t,
|
|
||||||
seluser => system_u,
|
|
||||||
content => template('confdroid_nagios/loadbalancer/remoteip.conf.erb'),
|
|
||||||
notify => Service['httpd'],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}</pre>
|
}</pre>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user