Compare commits
4 Commits
4206ef6c2c
...
bdb7946c22
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bdb7946c22 | ||
|
|
6107af263f | ||
|
|
0b6492808c | ||
| f4d99f7e90 |
138
Jenkinsfile
vendored
138
Jenkinsfile
vendored
@@ -1,138 +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
|
|
||||||
git fetch origin
|
|
||||||
source_branch="${gitlabSourceBranch:-${BRANCH_NAME:-${GIT_LOCAL_BRANCH:-$GIT_BRANCH}}}"
|
|
||||||
source_branch="${source_branch#origin/}"
|
|
||||||
source_branch="${source_branch#refs/heads/}"
|
|
||||||
if [ -z "$source_branch" ]; then
|
|
||||||
source_branch="development"
|
|
||||||
fi
|
|
||||||
echo "Using source branch: $source_branch"
|
|
||||||
# Create an isolated build branch from the triggering branch revision.
|
|
||||||
git checkout -B jenkins-build-$BUILD_NUMBER "origin/$source_branch"
|
|
||||||
# Merge the current master into the build branch before validation.
|
|
||||||
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_jenkins \
|
|
||||||
-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 fetch origin
|
|
||||||
git checkout -B master origin/master
|
|
||||||
git merge --no-ff jenkins-build-$BUILD_NUMBER -m "Merge build $BUILD_NUMBER into master"
|
|
||||||
git push origin master
|
|
||||||
'''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Mirror to Gitea') {
|
|
||||||
steps {
|
|
||||||
withCredentials([usernamePassword(
|
|
||||||
credentialsId: 'Jenkins-gitea',
|
|
||||||
usernameVariable: 'GITEA_USER',
|
|
||||||
passwordVariable: 'GITEA_TOKEN')]) {
|
|
||||||
script {
|
|
||||||
sh '''
|
|
||||||
git fetch origin
|
|
||||||
git checkout -B gitea-mirror-$BUILD_NUMBER origin/master
|
|
||||||
git rm -f Jenkinsfile
|
|
||||||
git commit -m "Remove Jenkinsfile for Gitea mirror" || echo "No changes to commit"
|
|
||||||
git remote get-url master >/dev/null 2>&1 \
|
|
||||||
&& git remote set-url master https://sourcecode.confdroid.com/confdroid/confdroid_jenkins.git \
|
|
||||||
|| git remote add master https://sourcecode.confdroid.com/confdroid/confdroid_jenkins.git
|
|
||||||
git -c credential.helper="!f() { echo username=${GITEA_USER}; echo password=${GITEA_TOKEN}; }; f" \
|
|
||||||
push --force master HEAD:refs/heads/master
|
|
||||||
git ls-remote --heads master | awk '{print $2}' | sed 's#refs/heads/##' | while read branch; do
|
|
||||||
if [ -n "$branch" ] && [ "$branch" != "master" ]; then
|
|
||||||
git -c credential.helper="!f() { echo username=${GITEA_USER}; echo password=${GITEA_TOKEN}; }; f" \
|
|
||||||
push master --delete "$branch"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
'''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
25
README.md
25
README.md
@@ -10,13 +10,13 @@ Puppet 6 repo for managing Jenkins. Internal only due to access details for gitl
|
|||||||
|
|
||||||
## WARNING
|
## WARNING
|
||||||
|
|
||||||
***Attention: Never use this puppet module on systems which have been previously configured manually. It is impossible to predict how and what would have been configured, hence previous configurations outside the scope of this module may be overwritten! Automated configurations require a test environment to verify that the module suits the purpose intended by the user, as well as tune the parameters, before deploying into live production***
|
> **Attention: Never use this puppet module on systems which have been previously configured manually. It is impossible to predict how and what would have been configured, hence previous configurations outside the scope of this module may be overwritten! Automated configurations require a test environment to verify that the module suits the purpose intended by the user, as well as tune the parameters, before deploying into live production**
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
INSTALLATION
|
INSTALLATION
|
||||||
|
|
||||||
* installs required binaries
|
- installs required binaries
|
||||||
|
|
||||||
## Repo Documentation
|
## Repo Documentation
|
||||||
|
|
||||||
@@ -26,11 +26,11 @@ See the full Puppet documentation including parameters in `docs/index.html`
|
|||||||
|
|
||||||
All dependencies must be included in the catalogue.
|
All dependencies must be included in the catalogue.
|
||||||
|
|
||||||
* [java_cd](https://gitlab.confdroid.com/puppet/java_cd) to install java
|
- [java_cd](https://gitlab.confdroid.com/puppet/java_cd) to install java
|
||||||
|
|
||||||
## Deployment
|
## Deployment
|
||||||
|
|
||||||
* native Puppet deployment
|
- native Puppet deployment
|
||||||
|
|
||||||
via site.pp or nodes.pp
|
via site.pp or nodes.pp
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ node 'example.example.net' {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
* through Foreman:
|
- through Foreman:
|
||||||
|
|
||||||
In order to apply parameters through Foreman, the params.pp must be added to the host or host group in question.
|
In order to apply parameters through Foreman, the params.pp must be added to the host or host group in question.
|
||||||
|
|
||||||
@@ -54,19 +54,20 @@ All files and directories are configured with correct selinux context. If selinu
|
|||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|
||||||
* OS: Rocky 9
|
- OS: Rocky 9 (all RHEL-based OS should work but Rocky 9 is tested)
|
||||||
* Puppet 6-8
|
- Puppet 8
|
||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
|
|
||||||
* Puppet Lint
|
- Puppet Lint
|
||||||
* Puppet Parser
|
- Puppet Parser
|
||||||
* ERB Template Parser
|
- ERB Template Parser
|
||||||
* Sonar Quality Gate
|
- Sonar Quality Gate
|
||||||
|
|
||||||
## Contact Us
|
## Contact Us
|
||||||
|
|
||||||
[contact Us](https://confdroid.com/contact/)
|
- [contact Us](https://confdroid.com/contact/)
|
||||||
|
- [Feedback Portal](https://feedback.confdroid.com/)
|
||||||
|
|
||||||
## Disclaimer
|
## Disclaimer
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,9 @@
|
|||||||
|
|
||||||
<h2 id="label-WARNING">WARNING</h2>
|
<h2 id="label-WARNING">WARNING</h2>
|
||||||
|
|
||||||
<p><strong><em>Attention: Never use this puppet module on systems which have been previously configured manually. It is impossible to predict how and what would have been configured, hence previous configurations outside the scope of this module may be overwritten! Automated configurations require a test environment to verify that the module suits the purpose intended by the user, as well as tune the parameters, before deploying into live production</em></strong></p>
|
<blockquote>
|
||||||
|
<p><strong>Attention: Never use this puppet module on systems which have been previously configured manually. It is impossible to predict how and what would have been configured, hence previous configurations outside the scope of this module may be overwritten! Automated configurations require a test environment to verify that the module suits the purpose intended by the user, as well as tune the parameters, before deploying into live production</strong></p>
|
||||||
|
</blockquote>
|
||||||
|
|
||||||
<h2 id="label-Features">Features</h2>
|
<h2 id="label-Features">Features</h2>
|
||||||
|
|
||||||
@@ -117,9 +119,9 @@
|
|||||||
|
|
||||||
<h2 id="label-Support">Support</h2>
|
<h2 id="label-Support">Support</h2>
|
||||||
<ul><li>
|
<ul><li>
|
||||||
<p>OS: Rocky 9</p>
|
<p>OS: Rocky 9 (all RHEL-based OS should work but Rocky 9 is tested)</p>
|
||||||
</li><li>
|
</li><li>
|
||||||
<p>Puppet 6-8</p>
|
<p>Puppet 8</p>
|
||||||
</li></ul>
|
</li></ul>
|
||||||
|
|
||||||
<h2 id="label-Tests">Tests</h2>
|
<h2 id="label-Tests">Tests</h2>
|
||||||
@@ -134,8 +136,11 @@
|
|||||||
</li></ul>
|
</li></ul>
|
||||||
|
|
||||||
<h2 id="label-Contact+Us">Contact Us</h2>
|
<h2 id="label-Contact+Us">Contact Us</h2>
|
||||||
|
<ul><li>
|
||||||
<p><a href="https://confdroid.com/contact/">contact Us</a></p>
|
<p><a href="https://confdroid.com/contact/">contact Us</a></p>
|
||||||
|
</li><li>
|
||||||
|
<p><a href="https://feedback.confdroid.com/">Feedback Portal</a></p>
|
||||||
|
</li></ul>
|
||||||
|
|
||||||
<h2 id="label-Disclaimer">Disclaimer</h2>
|
<h2 id="label-Disclaimer">Disclaimer</h2>
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,9 @@
|
|||||||
|
|
||||||
<h2 id="label-WARNING">WARNING</h2>
|
<h2 id="label-WARNING">WARNING</h2>
|
||||||
|
|
||||||
<p><strong><em>Attention: Never use this puppet module on systems which have been previously configured manually. It is impossible to predict how and what would have been configured, hence previous configurations outside the scope of this module may be overwritten! Automated configurations require a test environment to verify that the module suits the purpose intended by the user, as well as tune the parameters, before deploying into live production</em></strong></p>
|
<blockquote>
|
||||||
|
<p><strong>Attention: Never use this puppet module on systems which have been previously configured manually. It is impossible to predict how and what would have been configured, hence previous configurations outside the scope of this module may be overwritten! Automated configurations require a test environment to verify that the module suits the purpose intended by the user, as well as tune the parameters, before deploying into live production</strong></p>
|
||||||
|
</blockquote>
|
||||||
|
|
||||||
<h2 id="label-Features">Features</h2>
|
<h2 id="label-Features">Features</h2>
|
||||||
|
|
||||||
@@ -117,9 +119,9 @@
|
|||||||
|
|
||||||
<h2 id="label-Support">Support</h2>
|
<h2 id="label-Support">Support</h2>
|
||||||
<ul><li>
|
<ul><li>
|
||||||
<p>OS: Rocky 9</p>
|
<p>OS: Rocky 9 (all RHEL-based OS should work but Rocky 9 is tested)</p>
|
||||||
</li><li>
|
</li><li>
|
||||||
<p>Puppet 6-8</p>
|
<p>Puppet 8</p>
|
||||||
</li></ul>
|
</li></ul>
|
||||||
|
|
||||||
<h2 id="label-Tests">Tests</h2>
|
<h2 id="label-Tests">Tests</h2>
|
||||||
@@ -134,8 +136,11 @@
|
|||||||
</li></ul>
|
</li></ul>
|
||||||
|
|
||||||
<h2 id="label-Contact+Us">Contact Us</h2>
|
<h2 id="label-Contact+Us">Contact Us</h2>
|
||||||
|
<ul><li>
|
||||||
<p><a href="https://confdroid.com/contact/">contact Us</a></p>
|
<p><a href="https://confdroid.com/contact/">contact Us</a></p>
|
||||||
|
</li><li>
|
||||||
|
<p><a href="https://feedback.confdroid.com/">Feedback Portal</a></p>
|
||||||
|
</li></ul>
|
||||||
|
|
||||||
<h2 id="label-Disclaimer">Disclaimer</h2>
|
<h2 id="label-Disclaimer">Disclaimer</h2>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user