fix build info and jenkins pipeline

This commit is contained in:
Arne Teuke
2025-05-21 12:02:34 +02:00
parent 41d7d89675
commit 078c57e7ba
2 changed files with 38 additions and 27 deletions

25
Jenkinsfile vendored
View File

@@ -25,10 +25,16 @@ pipeline {
stage('pull master') {
steps {
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
sh '''git config user.name "Jenkins Server"
sh '''
git config user.name "Jenkins Server"
git config user.email jenkins@confdroid.com
git pull origin master
git checkout -b jenkins '''
# 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; }
'''
}
}
}
@@ -53,21 +59,24 @@ pipeline {
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=cd_nagios \
-Dsonar.sources=. \
-Dsonar.host.url=https://sonarqube.confdroid.com \
-Dsonar.token=sqa_aca21cc41336d0f31987ed196ccfb9be55ded774
-Dsonar.token=$SONAR_TOKEN
'''
}
}
}
stage('create Puppet documentation') {
steps {
@@ -78,10 +87,12 @@ pipeline {
stage('update repo') {
steps {
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
sh '''git config user.name "Jenkins Server"
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"`
git push origin HEAD:master'''
git add -A && git commit -am "Recommit for updates in build $BUILD_NUMBER" || echo "No changes to commit"
git push origin HEAD:master
'''
}
}
}

View File

@@ -1,6 +1,6 @@
# Readme
[![Build Status](https://pipelines.confdroid.com/buildStatus/icon?job=cd_nagios)](https://pipelines.confdroid.com/job/cd_nagios/)
[![Build Status](https://jenkins.confdroid.com/buildStatus/icon?job=cd_nagios)](https://jenkins.confdroid.com/job/cd_nagios/)
[[_TOC_]]
@@ -72,14 +72,14 @@ See the full Puppet documentation including parameters in `docs/index.html`
All dependencies must be included in the catalogue.
* [cd_resources](https://sourcecode.confdroid.com/12WW1160/cd_resources) for Yum repos.
* [cd_apache](https://sourcecode.confdroid.com/12WW1160/cd_apache) for installing httpd
* [cd_firewall](https://sourcecode.confdroid.com/12WW1160/cd_firewall) or [puppetlabs firewall](https://github.com/puppetlabs/puppetlabs-firewall) (optional)
* [cd_selinux](https://sourcecode.confdroid.com/12WW1160/cd_selinux) for selinux policy adjustments
* [cd_certbot](https://sourcecode.confdroid.com/12WW1160/cd_certbot) to auto-manage TLS certificates (optional)
* [cd_nrpe](https://sourcecode.confdroid.com/12WW1160/cd_nrpe) to manage NRPE (optional)
* [cd_stdlib](https://sourcecode.confdroid.com/12WW1160/cd_stdlib) or [puppetlabs stdlib](https://github.com/puppetlabs/puppetlabs-stdlib) to facilitate concat
* [cd_concat](https://sourcecode.confdroid.com/12WW1160/cd_stdlib) or [puppetlabs concat](https://github.com/puppetlabs/puppetlabs-concat) to concatenate configuration files from different sources.
* [cd_resources](https://gitlab.confdroid.com/puppet/cd_resources) for Yum repos.
* [cd_apache](https://gitlab.confdroid.com/puppet/cd_apache) for installing httpd
* [cd_firewall](https://gitlab.confdroid.com/puppet/cd_firewall) or [puppetlabs firewall](https://github.com/puppetlabs/puppetlabs-firewall) (optional)
* [cd_selinux](https://gitlab.confdroid.com/puppet/cd_selinux) for selinux policy adjustments
* [cd_certbot](https://gitlab.confdroid.com/puppet/cd_certbot) to auto-manage TLS certificates (optional)
* [cd_nrpe](https://gitlab.confdroid.com/puppet/cd_nrpe) to manage NRPE (optional)
* [cd_stdlib](https://gitlab.confdroid.com/puppet/cd_stdlib) or [puppetlabs stdlib](https://github.com/puppetlabs/puppetlabs-stdlib) to facilitate concat
* [cd_concat](https://gitlab.confdroid.com/puppet/cd_stdlib) or [puppetlabs concat](https://github.com/puppetlabs/puppetlabs-concat) to concatenate configuration files from different sources.
## Deployment
@@ -101,7 +101,7 @@ See [more details about class deployment on Confdroid.com](https://confdroid.com
## PuppetDB
A working instance of PuppetDB connected to the Puppet master is required for this to work. Installation and configuration of PuppetDB is out of scope for this module, however [cd_puppetdb](https://sourcecode.confdroid.com/12WW1160/cd_puppetdb) is available to automate this task for you as well within a few minutes.
A working instance of PuppetDB connected to the Puppet master is required for this to work. Installation and configuration of PuppetDB is out of scope for this module, however [cd_puppetdb](https://gitlab.confdroid.com/puppet/cd_puppetdb) is available to automate this task for you as well within a few minutes.
## SELINUX