Recommit for updates in build 128
This commit is contained in:
125
Jenkinsfile
vendored
125
Jenkinsfile
vendored
@@ -1,125 +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
|
||||
# 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=puppet_cd \
|
||||
-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 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 {
|
||||
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 commit --amend --no-edit --allow-empty
|
||||
git remote add master https://gitea.confdroid.com/confdroid/puppet_cd.git
|
||||
git -c credential.helper="!f() { echo username=${GITEA_USER}; echo password=${GITEA_TOKEN}; }; f" \
|
||||
push master --mirror
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -62,8 +62,6 @@
|
||||
|
||||
<p><a href="https://jenkins.confdroid.com/job/puppet_cd/"><img src="https://jenkins.confdroid.com/buildStatus/icon?job=puppet_cd"></a>|</p>
|
||||
|
||||
<p>[[<em>TOC</em>]]</p>
|
||||
|
||||
<h2 id="label-Synopsis">Synopsis</h2>
|
||||
|
||||
<p>This Puppet module configures settings a full Puppet environment, i.e. Puppet master, Puppet agents pointed to the master.</p>
|
||||
|
||||
@@ -62,8 +62,6 @@
|
||||
|
||||
<p><a href="https://jenkins.confdroid.com/job/puppet_cd/"><img src="https://jenkins.confdroid.com/buildStatus/icon?job=puppet_cd"></a>|</p>
|
||||
|
||||
<p>[[<em>TOC</em>]]</p>
|
||||
|
||||
<h2 id="label-Synopsis">Synopsis</h2>
|
||||
|
||||
<p>This Puppet module configures settings a full Puppet environment, i.e. Puppet master, Puppet agents pointed to the master.</p>
|
||||
|
||||
@@ -1100,6 +1100,78 @@
|
||||
—
|
||||
<div class='inline'>
|
||||
<p>IP address to listen on</p>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
||||
<span class='name'>pt_enable_tls</span>
|
||||
|
||||
|
||||
<span class='type'>(<tt>Boolean</tt>)</span>
|
||||
|
||||
|
||||
<em class="default">(defaults to: <tt>false</tt>)</em>
|
||||
|
||||
|
||||
—
|
||||
<div class='inline'>
|
||||
<p>whether to use tls encryption for the backend</p>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
||||
<span class='name'>pt_pptdb_ca_crt</span>
|
||||
|
||||
|
||||
<span class='type'>(<tt>String</tt>)</span>
|
||||
|
||||
|
||||
<em class="default">(defaults to: <tt>'Changeme'</tt>)</em>
|
||||
|
||||
|
||||
—
|
||||
<div class='inline'>
|
||||
<p>placeholder for the ca.crt</p>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
||||
<span class='name'>pt_pptdb_server_crt</span>
|
||||
|
||||
|
||||
<span class='type'>(<tt>String</tt>)</span>
|
||||
|
||||
|
||||
<em class="default">(defaults to: <tt>'Changeme'</tt>)</em>
|
||||
|
||||
|
||||
—
|
||||
<div class='inline'>
|
||||
<p>placeholder for the server.crt</p>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
||||
<span class='name'>pt_pptdb_server_key</span>
|
||||
|
||||
|
||||
<span class='type'>(<tt>String</tt>)</span>
|
||||
|
||||
|
||||
<em class="default">(defaults to: <tt>'Changeme'</tt>)</em>
|
||||
|
||||
|
||||
—
|
||||
<div class='inline'>
|
||||
<p>placeholder for the server.crt</p>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
@@ -1115,10 +1187,6 @@
|
||||
<pre class="lines">
|
||||
|
||||
|
||||
64
|
||||
65
|
||||
66
|
||||
67
|
||||
68
|
||||
69
|
||||
70
|
||||
@@ -1255,10 +1323,26 @@
|
||||
201
|
||||
202
|
||||
203
|
||||
204</pre>
|
||||
204
|
||||
205
|
||||
206
|
||||
207
|
||||
208
|
||||
209
|
||||
210
|
||||
211
|
||||
212
|
||||
213
|
||||
214
|
||||
215
|
||||
216
|
||||
217
|
||||
218
|
||||
219
|
||||
220</pre>
|
||||
</td>
|
||||
<td>
|
||||
<pre class="code"><span class="info file"># File 'manifests/params.pp', line 64</span>
|
||||
<pre class="code"><span class="info file"># File 'manifests/params.pp', line 68</span>
|
||||
|
||||
class puppet_cd::params (
|
||||
|
||||
@@ -1312,6 +1396,11 @@ class puppet_cd::params (
|
||||
String $pt_db_username = 'foobar',
|
||||
String $pt_db_password = 'foobar',
|
||||
String $pt_gc_interval = '60',
|
||||
Boolean $pt_enable_tls = false,
|
||||
String $pt_pptdb_ca_crt = 'Changeme',
|
||||
String $pt_pptdb_server_crt = 'Changeme',
|
||||
String $pt_pptdb_server_key = 'Changeme',
|
||||
|
||||
## jetty
|
||||
String $pt_http_port = '8080',
|
||||
String $pt_https_port = '8081',
|
||||
@@ -1354,6 +1443,7 @@ class puppet_cd::params (
|
||||
## puppetdb
|
||||
$pt_puppetdb_dir = '/etc/puppetlabs/puppetdb'
|
||||
$pt_puppetdb_conf_dir = "${pt_puppetdb_dir}/conf.d"
|
||||
$pt_pptdb_ssldir = "${pt_puppetdb_dir}/ssl"
|
||||
|
||||
# files
|
||||
## puppet
|
||||
@@ -1391,6 +1481,12 @@ class puppet_cd::params (
|
||||
$pt_repl_ini_erb = 'puppet_cd/puppetdb/repl.ini.erb'
|
||||
$pt_service_conf_file = '/usr/lib/systemd/system/puppetdb.service'
|
||||
$pt_service_conf_erb = 'puppet_cd/puppetdb/service.conf.erb'
|
||||
$pt_ca_crt_file = "${pt_pptdb_ssldir}/ca.crt"
|
||||
$pt_ca_crt_erb = 'puppet_cd/puppetdb/ca.crt.erb'
|
||||
$pt_server_crt_file = "${pt_pptdb_ssldir}/server.crt"
|
||||
$pt_server_crt_erb = 'puppet_cd/puppetdb/server.crt.erb'
|
||||
$pt_server_key_file = "${pt_pptdb_ssldir}/server.key"
|
||||
$pt_server_key_erb = 'puppet_cd/puppetdb/server.key.erb'
|
||||
|
||||
# service
|
||||
$pt_server_service = 'puppetserver'
|
||||
|
||||
@@ -226,7 +226,49 @@
|
||||
128
|
||||
129
|
||||
130
|
||||
131</pre>
|
||||
131
|
||||
132
|
||||
133
|
||||
134
|
||||
135
|
||||
136
|
||||
137
|
||||
138
|
||||
139
|
||||
140
|
||||
141
|
||||
142
|
||||
143
|
||||
144
|
||||
145
|
||||
146
|
||||
147
|
||||
148
|
||||
149
|
||||
150
|
||||
151
|
||||
152
|
||||
153
|
||||
154
|
||||
155
|
||||
156
|
||||
157
|
||||
158
|
||||
159
|
||||
160
|
||||
161
|
||||
162
|
||||
163
|
||||
164
|
||||
165
|
||||
166
|
||||
167
|
||||
168
|
||||
169
|
||||
170
|
||||
171
|
||||
172
|
||||
173</pre>
|
||||
</td>
|
||||
<td>
|
||||
<pre class="code"><span class="info file"># File 'manifests/puppetdb/files.pp', line 6</span>
|
||||
@@ -355,6 +397,48 @@ class puppet_cd::puppetdb::files (
|
||||
content => template($pt_repl_ini_erb),
|
||||
notify => Service[$pt_db_service],
|
||||
}
|
||||
if $pt_enable_tls == true {
|
||||
# create tls certs
|
||||
## ca.crt
|
||||
file { $pt_ca_crt_file:
|
||||
ensure => file,
|
||||
owner => 'puppetdb',
|
||||
group => 'puppetdb',
|
||||
mode => '0440',
|
||||
selrange => s0,
|
||||
selrole => object_r,
|
||||
seltype => puppet_etc_t,
|
||||
seluser => system_u,
|
||||
content => template($pt_ca_crt_erb),
|
||||
notify => Service[$pt_db_service],
|
||||
}
|
||||
## server.crt
|
||||
file { $pt_server_crt_file:
|
||||
ensure => file,
|
||||
owner => 'puppetdb',
|
||||
group => 'puppetdb',
|
||||
mode => '0440',
|
||||
selrange => s0,
|
||||
selrole => object_r,
|
||||
seltype => puppet_etc_t,
|
||||
seluser => system_u,
|
||||
content => template($pt_server_crt_erb),
|
||||
notify => Service[$pt_db_service],
|
||||
}
|
||||
## server.key
|
||||
file { $pt_server_key_file:
|
||||
ensure => file,
|
||||
owner => 'puppetdb',
|
||||
group => 'puppetdb',
|
||||
mode => '0440',
|
||||
selrange => s0,
|
||||
selrole => object_r,
|
||||
seltype => puppet_etc_t,
|
||||
seluser => system_u,
|
||||
content => template($pt_server_key_erb),
|
||||
notify => Service[$pt_db_service],
|
||||
}
|
||||
}
|
||||
}
|
||||
}</pre>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user