Compare commits

...

4 Commits

Author SHA1 Message Date
Jenkins Server
aca4caf164 Recommit for updates in build 15 2026-09-07 14:04:57 +02:00
Jenkins Server
e2b61dea14 Merge remote-tracking branch 'origin/master' into jenkins-build-15 2026-09-07 14:03:56 +02:00
5db2481d76 OP#672 edit target to include correct variables 2026-09-07 13:52:13 +02:00
Jenkins Server
ab99ef1c20 Recommit for updates in build 13 2026-09-07 13:48:15 +02:00
5 changed files with 33 additions and 132 deletions

127
Jenkinsfile vendored
View File

@@ -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_alloy \
-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 {
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
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_alloy.git
git -c credential.helper="!f() { echo username=${GITEA_USER}; echo password=${GITEA_TOKEN}; }; f" \
push master --mirror
'''
}
}
}
}
}
}
}

View File

@@ -128,7 +128,7 @@ class confdroid_alloy::monitoring::target (
) inherits confdroid_alloy::params {
if $ay_manage_nagios == true {
@@nagios_service { "check_alloy_${fqdn}":
check_command => "check_nrpe!check_alloy!${fn_procs_allowed}!alloy-server",
check_command => "check_nrpe!check_alloy!${ay_procs_allowed}!alloy",
use => 'generic-service',
host_name => $fqdn,
notification_period => '24x7',

View File

@@ -412,6 +412,24 @@
—
<div class='inline'>
<p>the contacts for nagios service exports</p>
</div>
</li>
<li>
<span class='name'>ay_procs_allowed</span>
<span class='type'>(<tt>String</tt>)</span>
<em class="default">(defaults to: <tt>&#39;1:1&#39;</tt>)</em>
&mdash;
<div class='inline'>
<p>the allowed number of processes for nagios service exports</p>
</div>
</li>
@@ -427,7 +445,6 @@
<pre class="lines">
25
26
27
28
@@ -465,10 +482,15 @@
60
61
62
63</pre>
63
64
65
66
67
68</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'manifests/params.pp', line 25</span>
<pre class="code"><span class="info file"># File 'manifests/params.pp', line 26</span>
class confdroid_alloy::params (
@@ -495,8 +517,12 @@ class confdroid_alloy::params (
Boolean $ay_manage_nagios = false,
String $ay_target_service = &#39;/etc/nagios/conf.d/alloy_service.cfg&#39;,
Array $ay_target_contacts = [&#39;nagiosadmin&#39;],
String $ay_procs_allowed = &#39;1:1&#39;
) {
# defaults
$fqdn = $facts[&#39;networking&#39;][&#39;fqdn&#39;]
# service
$ay_service = &#39;alloy&#39;

View File

@@ -8,7 +8,7 @@ class confdroid_alloy::monitoring::target (
) inherits confdroid_alloy::params {
if $ay_manage_nagios == true {
@@nagios_service { "check_alloy_${fqdn}":
check_command => "check_nrpe!check_alloy!${fn_procs_allowed}!alloy-server",
check_command => "check_nrpe!check_alloy!${ay_procs_allowed}!alloy",
use => 'generic-service',
host_name => $fqdn,
notification_period => '24x7',

View File

@@ -20,6 +20,7 @@
# @param [Boolean] ay_manage_nagios whether to manage nagios service exports
# @param [String] ay_target_service the target file for nagios service exports
# @param [Array] ay_target_contacts the contacts for nagios service exports
# @param [String] ay_procs_allowed the allowed number of processes for nagios service exports
# @summary Class contains all parameters for the confdroid_alloy module.
##############################################################################
class confdroid_alloy::params (
@@ -47,6 +48,7 @@ class confdroid_alloy::params (
Boolean $ay_manage_nagios = false,
String $ay_target_service = '/etc/nagios/conf.d/alloy_service.cfg',
Array $ay_target_contacts = ['nagiosadmin'],
String $ay_procs_allowed = '1:1'
) {
# defaults