Files
confdroid_nagios/Jenkinsfile

114 lines
3.1 KiB
Plaintext
Raw Permalink Normal View History

pipeline {
agent {
label 'puppet'
}
2020-12-02 18:39:56 +01:00
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])
}
}
2020-12-08 18:12:28 +01:00
options {
gitLabConnection('sourcecode.confdroid.com')
}
stages {
2021-12-29 15:22:34 +01:00
stage('pull master') {
steps {
2018-04-12 12:13:28 +02:00
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
sh '''git config user.name "Jenkins Server"
git config user.email jenkins@confdroid.com
git pull origin master
git checkout -b jenkins '''
}
}
}
2020-12-02 18:39:56 +01:00
stage('puppet parser') {
steps {
sh '''for file in $(find . -iname \'*.pp\'); do
2018-10-19 18:14:32 +02:00
/opt/puppetlabs/bin/puppet parser validate --color false --render-as s --modulepath=modules $file || exit 1;
done;'''
}
}
2020-12-02 18:39:56 +01:00
stage('check templates') {
steps{
sh '''for file in $(find . -iname \'*.erb\');
do erb -P -x -T "-" $file | ruby -c || exit 1;
done;'''
}
}
2020-12-04 15:18:53 +01:00
stage('puppet-lint') {
steps {
2021-12-29 15:22:34 +01:00
sh '''find . -iname *.pp -exec /usr/local/rvm/gems/ruby-2.5.0/wrappers/puppet-lint \\
2020-12-04 15:18:53 +01:00
--no-class_inherits_from_params_class-check \\
--no-variable_scope-check \\
--no-80chars-check \\
--no-arrow_alignment-check \\
--no-autoloader_layout-check \\
--no-140chars-check \\
--log-format "%{path}:%{line}:%{check}:%{KIND}:%{message}" {} \\;
'''
recordIssues aggregatingResults: true, tool: puppetLint()
}
}
2021-09-13 13:51:42 +02:00
stage('markdown-lint') {
steps {
2021-09-13 13:51:42 +02:00
sh '''
source /opt/rh/rh-ruby27/enable
mdl README.md
'''
}
}
2021-09-13 13:51:42 +02:00
stage('spell check') {
steps {
sh '''
mdspell -r -n -a "**/*.md"
'''
}
}
stage('SonarScan') {
steps {
sh '''
/opt/sonar-scanner/bin/sonar-scanner \
-Dsonar.projectKey=cd_nagios \
-Dsonar.sources=. \
-Dsonar.host.url=http://sonarqube.confdroid.com \
-Dsonar.login=f4d68d1f43370b34439eee7fbf5e2b6182cf449c
'''
}
}
2018-12-07 18:16:36 +01:00
stage('create Puppet documention') {
steps {
sh '/opt/puppetlabs/bin/puppet strings'
}
}
2020-12-02 18:39:56 +01:00
stage('update repo') {
steps {
2018-04-12 12:13:28 +02:00
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
sh '''git config user.name "Jenkins Server"
git config user.email jenkins@confdroid.com
echo `git add -A && git commit -am "recommit for updates in build $BUILD_NUMBER"`
2018-04-27 19:37:52 +02:00
git push origin HEAD:master'''
}
}
}
2020-12-02 18:39:56 +01:00
}
}