Compare commits
31 Commits
3ac525b0a0
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e414192ac6 | ||
|
|
625a4e007b | ||
| 4c90791059 | |||
|
|
9c3945e258 | ||
|
|
f39a024707 | ||
| 6e7da3acd0 | |||
|
|
5cfe2e7179 | ||
|
|
eb45c57636 | ||
| f97cb0e247 | |||
|
|
d3fe40389f | ||
|
|
6a0b742242 | ||
| e44f98e361 | |||
|
|
95afab167e | ||
|
|
0f3b5a65a9 | ||
| 40987bc9d4 | |||
|
|
9cdab61f8e | ||
|
|
5a2f349f3b | ||
| 8c0207a92c | |||
|
|
abdefc0c6b | ||
|
|
77cac961f8 | ||
| ba26f7178f | |||
|
|
ee6dced0d0 | ||
|
|
83cf4b89a8 | ||
| 5ceed98867 | |||
|
|
19c190350e | ||
|
|
39be152378 | ||
| 32b36131b0 | |||
|
|
0f2a4af710 | ||
|
|
0b677301ae | ||
| 330418c20a | |||
|
|
83fe21a8d3 |
126
Jenkinsfile
vendored
126
Jenkinsfile
vendored
@@ -1,126 +0,0 @@
|
|||||||
pipeline {
|
|
||||||
agent any
|
|
||||||
|
|
||||||
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_nrpe \
|
|
||||||
-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_nrpe.git
|
|
||||||
git -c credential.helper="!f() { echo username=${GITEA_USER}; echo password=${GITEA_TOKEN}; }; f" \
|
|
||||||
push master --mirror
|
|
||||||
'''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -181,7 +181,37 @@
|
|||||||
77
|
77
|
||||||
78
|
78
|
||||||
79
|
79
|
||||||
80</pre>
|
80
|
||||||
|
81
|
||||||
|
82
|
||||||
|
83
|
||||||
|
84
|
||||||
|
85
|
||||||
|
86
|
||||||
|
87
|
||||||
|
88
|
||||||
|
89
|
||||||
|
90
|
||||||
|
91
|
||||||
|
92
|
||||||
|
93
|
||||||
|
94
|
||||||
|
95
|
||||||
|
96
|
||||||
|
97
|
||||||
|
98
|
||||||
|
99
|
||||||
|
100
|
||||||
|
101
|
||||||
|
102
|
||||||
|
103
|
||||||
|
104
|
||||||
|
105
|
||||||
|
106
|
||||||
|
107
|
||||||
|
108
|
||||||
|
109
|
||||||
|
110</pre>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<pre class="code"><span class="info file"># File 'manifests/commands/definition_rules.pp', line 12</span>
|
<pre class="code"><span class="info file"># File 'manifests/commands/definition_rules.pp', line 12</span>
|
||||||
@@ -251,8 +281,38 @@ class confdroid_nrpe::commands::definition_rules (
|
|||||||
confdroid_nrpe::commands::definitions { 'check_fail2ban':
|
confdroid_nrpe::commands::definitions { 'check_fail2ban':
|
||||||
ne_check_name => 'check_fail2ban',
|
ne_check_name => 'check_fail2ban',
|
||||||
ne_check_cmd => 'check_procs',
|
ne_check_cmd => 'check_procs',
|
||||||
|
ne_cmd_argstring => '-c $ARG1$ -C $ARG2$',
|
||||||
|
}
|
||||||
|
confdroid_nrpe::commands::definitions { 'check_alloy':
|
||||||
|
ne_check_name => 'check_alloy',
|
||||||
|
ne_check_cmd => 'check_procs',
|
||||||
|
ne_cmd_argstring => '-c $ARG1$ -C $ARG2$',
|
||||||
|
}
|
||||||
|
confdroid_nrpe::commands::definitions { 'check_haproxy':
|
||||||
|
ne_check_name => 'check_haproxy',
|
||||||
|
ne_check_cmd => 'check_procs',
|
||||||
|
ne_cmd_argstring => '-c $ARG1$ -C $ARG2$',
|
||||||
|
}
|
||||||
|
confdroid_nrpe::commands::definitions { 'check_puppet':
|
||||||
|
ne_check_name => 'check_puppet',
|
||||||
|
ne_check_cmd => 'check_procs',
|
||||||
|
ne_cmd_argstring => '-c $ARG1$ -C $ARG2$',
|
||||||
|
}
|
||||||
|
confdroid_nrpe::commands::definitions { 'check_puppet_server':
|
||||||
|
ne_check_name => 'check_puppet_server',
|
||||||
|
ne_check_cmd => 'check_procs',
|
||||||
ne_cmd_argstring => '-c $ARG1$ -a $ARG2$',
|
ne_cmd_argstring => '-c $ARG1$ -a $ARG2$',
|
||||||
}
|
}
|
||||||
|
confdroid_nrpe::commands::definitions { 'check_puppetdb':
|
||||||
|
ne_check_name => 'check_puppetdb',
|
||||||
|
ne_check_cmd => 'check_procs',
|
||||||
|
ne_cmd_argstring => '-c $ARG1$ -a $ARG2$',
|
||||||
|
}
|
||||||
|
confdroid_nrpe::commands::definitions { 'check_sshd':
|
||||||
|
ne_check_name => 'check_sshd',
|
||||||
|
ne_check_cmd => 'check_procs',
|
||||||
|
ne_cmd_argstring => '-c $ARG1$ -C $ARG2$',
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}</pre>
|
}</pre>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -74,12 +74,37 @@ class confdroid_nrpe::commands::definition_rules (
|
|||||||
confdroid_nrpe::commands::definitions { 'check_fail2ban':
|
confdroid_nrpe::commands::definitions { 'check_fail2ban':
|
||||||
ne_check_name => 'check_fail2ban',
|
ne_check_name => 'check_fail2ban',
|
||||||
ne_check_cmd => 'check_procs',
|
ne_check_cmd => 'check_procs',
|
||||||
ne_cmd_argstring => '-c $ARG1$ -a $ARG2$',
|
ne_cmd_argstring => '-c $ARG1$ -C $ARG2$',
|
||||||
}
|
}
|
||||||
confdroid_nrpe::commands::definitions { 'check_alloy':
|
confdroid_nrpe::commands::definitions { 'check_alloy':
|
||||||
ne_check_name => 'check_alloy',
|
ne_check_name => 'check_alloy',
|
||||||
ne_check_cmd => 'check_procs',
|
ne_check_cmd => 'check_procs',
|
||||||
|
ne_cmd_argstring => '-c $ARG1$ -C $ARG2$',
|
||||||
|
}
|
||||||
|
confdroid_nrpe::commands::definitions { 'check_haproxy':
|
||||||
|
ne_check_name => 'check_haproxy',
|
||||||
|
ne_check_cmd => 'check_procs',
|
||||||
|
ne_cmd_argstring => '-c $ARG1$ -C $ARG2$',
|
||||||
|
}
|
||||||
|
confdroid_nrpe::commands::definitions { 'check_puppet':
|
||||||
|
ne_check_name => 'check_puppet',
|
||||||
|
ne_check_cmd => 'check_procs',
|
||||||
|
ne_cmd_argstring => '-c $ARG1$ -C $ARG2$',
|
||||||
|
}
|
||||||
|
confdroid_nrpe::commands::definitions { 'check_puppet_server':
|
||||||
|
ne_check_name => 'check_puppet_server',
|
||||||
|
ne_check_cmd => 'check_procs',
|
||||||
ne_cmd_argstring => '-c $ARG1$ -a $ARG2$',
|
ne_cmd_argstring => '-c $ARG1$ -a $ARG2$',
|
||||||
}
|
}
|
||||||
|
confdroid_nrpe::commands::definitions { 'check_puppetdb':
|
||||||
|
ne_check_name => 'check_puppetdb',
|
||||||
|
ne_check_cmd => 'check_procs',
|
||||||
|
ne_cmd_argstring => '-c $ARG1$ -a $ARG2$',
|
||||||
|
}
|
||||||
|
confdroid_nrpe::commands::definitions { 'check_sshd':
|
||||||
|
ne_check_name => 'check_sshd',
|
||||||
|
ne_check_cmd => 'check_procs',
|
||||||
|
ne_cmd_argstring => '-c $ARG1$ -C $ARG2$',
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user