Compare commits
5 Commits
bdb7946c22
...
14cabee202
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14cabee202 | ||
|
|
41f52c7277 | ||
|
|
5a6eb3ae0e | ||
|
|
fc6128e6f3 | ||
| 39b79517b1 |
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
|
|
||||||
'''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
30
README.md
30
README.md
@@ -1,8 +1,23 @@
|
|||||||
# Readme
|
# Readme
|
||||||
|
|
||||||
[](https://jenkins.confdroid.com/job/confdroid_jenkins/)|
|
[](https://jenkins.confdroid.com/job/confdroid_jenkins/)
|
||||||
|
[](https://sonarqube.confdroid.com/dashboard?id=confdroid_jenkins)
|
||||||
|
|
||||||
[[_TOC_]]
|
- [Readme](#readme)
|
||||||
|
- [Synopsis](#synopsis)
|
||||||
|
- [WARNING](#warning)
|
||||||
|
- [Features](#features)
|
||||||
|
- [Core](#core)
|
||||||
|
- [Optional](#optional)
|
||||||
|
- [Repo Documentation](#repo-documentation)
|
||||||
|
- [Dependencies](#dependencies)
|
||||||
|
- [Deployment](#deployment)
|
||||||
|
- [SELINUX](#selinux)
|
||||||
|
- [Known Problems](#known-problems)
|
||||||
|
- [Support](#support)
|
||||||
|
- [Tests](#tests)
|
||||||
|
- [Contact Us](#contact-us)
|
||||||
|
- [Disclaimer](#disclaimer)
|
||||||
|
|
||||||
## Synopsis
|
## Synopsis
|
||||||
|
|
||||||
@@ -14,9 +29,15 @@ Puppet 6 repo for managing Jenkins. Internal only due to access details for gitl
|
|||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
INSTALLATION
|
### Core
|
||||||
|
|
||||||
- installs required binaries
|
- installs required binaries
|
||||||
|
- manage service
|
||||||
|
|
||||||
|
### Optional
|
||||||
|
|
||||||
|
- create a sudoers file for the Jenkins user to allow passwordless sudo, via `js_use_sudo`. Defaults to `false`
|
||||||
|
- manage firewall ports via `js_enable_fw`. Defaults to `true`. requires `puppetlabs-firewall`.
|
||||||
|
|
||||||
## Repo Documentation
|
## Repo Documentation
|
||||||
|
|
||||||
@@ -26,7 +47,8 @@ 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
|
- [confdroid_java](https://sourcecode.confdroid.com/confdroid/confdroid_java) to install java
|
||||||
|
- puppetlabs-firewall via r10k
|
||||||
|
|
||||||
## Deployment
|
## Deployment
|
||||||
|
|
||||||
|
|||||||
@@ -60,9 +60,39 @@
|
|||||||
<div id="content"><div id='filecontents'>
|
<div id="content"><div id='filecontents'>
|
||||||
<h1 id="label-Readme">Readme</h1>
|
<h1 id="label-Readme">Readme</h1>
|
||||||
|
|
||||||
<p><a href="https://jenkins.confdroid.com/job/confdroid_jenkins/"><img src="https://jenkins.confdroid.com/buildStatus/icon?job=confdroid_jenkins"></a>|</p>
|
<p><a href="https://jenkins.confdroid.com/job/confdroid_jenkins/"><img src="https://jenkins.confdroid.com/buildStatus/icon?job=confdroid_jenkins&style=plastic"></a> <a href="https://sonarqube.confdroid.com/dashboard?id=confdroid_jenkins"><img src="https://sonarqube.confdroid.com/api/project_badges/measure?project=confdroid_jenkins&metric=security_hotspots&token=sqb_ab7299f9502c7e498c19b03bb06497fa15bdd70c"></a></p>
|
||||||
|
<ul><li>
|
||||||
<p>[[<em>TOC</em>]]</p>
|
<p><a href="#readme">Readme</a></p>
|
||||||
|
</li><li>
|
||||||
|
<p><a href="#synopsis">Synopsis</a></p>
|
||||||
|
</li><li>
|
||||||
|
<p><a href="#warning">WARNING</a></p>
|
||||||
|
</li><li>
|
||||||
|
<p><a href="#features">Features</a></p>
|
||||||
|
<ul><li>
|
||||||
|
<p><a href="#core">Core</a></p>
|
||||||
|
</li><li>
|
||||||
|
<p><a href="#optional">Optional</a></p>
|
||||||
|
</li></ul>
|
||||||
|
</li><li>
|
||||||
|
<p><a href="#repo-documentation">Repo Documentation</a></p>
|
||||||
|
</li><li>
|
||||||
|
<p><a href="#dependencies">Dependencies</a></p>
|
||||||
|
</li><li>
|
||||||
|
<p><a href="#deployment">Deployment</a></p>
|
||||||
|
</li><li>
|
||||||
|
<p><a href="#selinux">SELINUX</a></p>
|
||||||
|
</li><li>
|
||||||
|
<p><a href="#known-problems">Known Problems</a></p>
|
||||||
|
</li><li>
|
||||||
|
<p><a href="#support">Support</a></p>
|
||||||
|
</li><li>
|
||||||
|
<p><a href="#tests">Tests</a></p>
|
||||||
|
</li><li>
|
||||||
|
<p><a href="#contact-us">Contact Us</a></p>
|
||||||
|
</li><li>
|
||||||
|
<p><a href="#disclaimer">Disclaimer</a></p>
|
||||||
|
</li></ul>
|
||||||
|
|
||||||
<h2 id="label-Synopsis">Synopsis</h2>
|
<h2 id="label-Synopsis">Synopsis</h2>
|
||||||
|
|
||||||
@@ -76,9 +106,18 @@
|
|||||||
|
|
||||||
<h2 id="label-Features">Features</h2>
|
<h2 id="label-Features">Features</h2>
|
||||||
|
|
||||||
<p>INSTALLATION</p>
|
<h3 id="label-Core">Core</h3>
|
||||||
<ul><li>
|
<ul><li>
|
||||||
<p>installs required binaries</p>
|
<p>installs required binaries</p>
|
||||||
|
</li><li>
|
||||||
|
<p>manage service</p>
|
||||||
|
</li></ul>
|
||||||
|
|
||||||
|
<h3 id="label-Optional">Optional</h3>
|
||||||
|
<ul><li>
|
||||||
|
<p>create a sudoers file for the Jenkins user to allow passwordless sudo, via <code>js_use_sudo</code>. Defaults to <code>false</code></p>
|
||||||
|
</li><li>
|
||||||
|
<p>manage firewall ports via <code>js_enable_fw</code>. Defaults to <code>true</code>. requires <code>puppetlabs-firewall</code>.</p>
|
||||||
</li></ul>
|
</li></ul>
|
||||||
|
|
||||||
<h2 id="label-Repo+Documentation">Repo Documentation</h2>
|
<h2 id="label-Repo+Documentation">Repo Documentation</h2>
|
||||||
@@ -89,7 +128,9 @@
|
|||||||
|
|
||||||
<p>All dependencies must be included in the catalogue.</p>
|
<p>All dependencies must be included in the catalogue.</p>
|
||||||
<ul><li>
|
<ul><li>
|
||||||
<p><a href="https://gitlab.confdroid.com/puppet/java_cd">java_cd</a> to install java</p>
|
<p><a href="https://sourcecode.confdroid.com/confdroid/confdroid_java">confdroid_java</a> to install java</p>
|
||||||
|
</li><li>
|
||||||
|
<p>puppetlabs-firewall via r10k</p>
|
||||||
</li></ul>
|
</li></ul>
|
||||||
|
|
||||||
<h2 id="label-Deployment">Deployment</h2>
|
<h2 id="label-Deployment">Deployment</h2>
|
||||||
|
|||||||
@@ -60,9 +60,39 @@
|
|||||||
<div id="content"><div id='filecontents'>
|
<div id="content"><div id='filecontents'>
|
||||||
<h1 id="label-Readme">Readme</h1>
|
<h1 id="label-Readme">Readme</h1>
|
||||||
|
|
||||||
<p><a href="https://jenkins.confdroid.com/job/confdroid_jenkins/"><img src="https://jenkins.confdroid.com/buildStatus/icon?job=confdroid_jenkins"></a>|</p>
|
<p><a href="https://jenkins.confdroid.com/job/confdroid_jenkins/"><img src="https://jenkins.confdroid.com/buildStatus/icon?job=confdroid_jenkins&style=plastic"></a> <a href="https://sonarqube.confdroid.com/dashboard?id=confdroid_jenkins"><img src="https://sonarqube.confdroid.com/api/project_badges/measure?project=confdroid_jenkins&metric=security_hotspots&token=sqb_ab7299f9502c7e498c19b03bb06497fa15bdd70c"></a></p>
|
||||||
|
<ul><li>
|
||||||
<p>[[<em>TOC</em>]]</p>
|
<p><a href="#readme">Readme</a></p>
|
||||||
|
</li><li>
|
||||||
|
<p><a href="#synopsis">Synopsis</a></p>
|
||||||
|
</li><li>
|
||||||
|
<p><a href="#warning">WARNING</a></p>
|
||||||
|
</li><li>
|
||||||
|
<p><a href="#features">Features</a></p>
|
||||||
|
<ul><li>
|
||||||
|
<p><a href="#core">Core</a></p>
|
||||||
|
</li><li>
|
||||||
|
<p><a href="#optional">Optional</a></p>
|
||||||
|
</li></ul>
|
||||||
|
</li><li>
|
||||||
|
<p><a href="#repo-documentation">Repo Documentation</a></p>
|
||||||
|
</li><li>
|
||||||
|
<p><a href="#dependencies">Dependencies</a></p>
|
||||||
|
</li><li>
|
||||||
|
<p><a href="#deployment">Deployment</a></p>
|
||||||
|
</li><li>
|
||||||
|
<p><a href="#selinux">SELINUX</a></p>
|
||||||
|
</li><li>
|
||||||
|
<p><a href="#known-problems">Known Problems</a></p>
|
||||||
|
</li><li>
|
||||||
|
<p><a href="#support">Support</a></p>
|
||||||
|
</li><li>
|
||||||
|
<p><a href="#tests">Tests</a></p>
|
||||||
|
</li><li>
|
||||||
|
<p><a href="#contact-us">Contact Us</a></p>
|
||||||
|
</li><li>
|
||||||
|
<p><a href="#disclaimer">Disclaimer</a></p>
|
||||||
|
</li></ul>
|
||||||
|
|
||||||
<h2 id="label-Synopsis">Synopsis</h2>
|
<h2 id="label-Synopsis">Synopsis</h2>
|
||||||
|
|
||||||
@@ -76,9 +106,18 @@
|
|||||||
|
|
||||||
<h2 id="label-Features">Features</h2>
|
<h2 id="label-Features">Features</h2>
|
||||||
|
|
||||||
<p>INSTALLATION</p>
|
<h3 id="label-Core">Core</h3>
|
||||||
<ul><li>
|
<ul><li>
|
||||||
<p>installs required binaries</p>
|
<p>installs required binaries</p>
|
||||||
|
</li><li>
|
||||||
|
<p>manage service</p>
|
||||||
|
</li></ul>
|
||||||
|
|
||||||
|
<h3 id="label-Optional">Optional</h3>
|
||||||
|
<ul><li>
|
||||||
|
<p>create a sudoers file for the Jenkins user to allow passwordless sudo, via <code>js_use_sudo</code>. Defaults to <code>false</code></p>
|
||||||
|
</li><li>
|
||||||
|
<p>manage firewall ports via <code>js_enable_fw</code>. Defaults to <code>true</code>. requires <code>puppetlabs-firewall</code>.</p>
|
||||||
</li></ul>
|
</li></ul>
|
||||||
|
|
||||||
<h2 id="label-Repo+Documentation">Repo Documentation</h2>
|
<h2 id="label-Repo+Documentation">Repo Documentation</h2>
|
||||||
@@ -89,7 +128,9 @@
|
|||||||
|
|
||||||
<p>All dependencies must be included in the catalogue.</p>
|
<p>All dependencies must be included in the catalogue.</p>
|
||||||
<ul><li>
|
<ul><li>
|
||||||
<p><a href="https://gitlab.confdroid.com/puppet/java_cd">java_cd</a> to install java</p>
|
<p><a href="https://sourcecode.confdroid.com/confdroid/confdroid_java">confdroid_java</a> to install java</p>
|
||||||
|
</li><li>
|
||||||
|
<p>puppetlabs-firewall via r10k</p>
|
||||||
</li></ul>
|
</li></ul>
|
||||||
|
|
||||||
<h2 id="label-Deployment">Deployment</h2>
|
<h2 id="label-Deployment">Deployment</h2>
|
||||||
|
|||||||
Reference in New Issue
Block a user