Compare commits

...

4 Commits

Author SHA1 Message Date
Jenkins Server
a6fa3c098b Recommit for updates in build 9 2026-09-01 11:36:11 +02:00
Jenkins Server
8f394b726b Merge remote-tracking branch 'origin/master' into jenkins-build-9 2026-09-01 11:35:20 +02:00
eab95a5b54 OP#662 add flags for queue_config 2026-09-01 11:34:57 +02:00
Jenkins Server
677b311a64 Recommit for updates in build 8 2026-09-01 11:07:24 +02:00
6 changed files with 124 additions and 168 deletions

127
Jenkinsfile vendored
View File

@@ -1,127 +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=confdroid_alloy \
-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 push origin HEAD:master
'''
}
}
}
stage('Mirror to Gitea') {
steps {
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
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 rm -r --cached .vscode || echo "No .vscode to remove from git"
git commit --amend --no-edit --allow-empty
git remote add master https://sourcecode.confdroid.com/confdroid/confdroid_alloy.git
git -c credential.helper="!f() { echo username=${GITEA_USER}; echo password=${GITEA_TOKEN}; }; f" \
push master --mirror
'''
}
}
}
}
}
}
}

View File

@@ -108,8 +108,6 @@
<p>INSTALLATION</p>
<ul><li>
<p>installs alloy binaries</p>
</li><li>
<p>installs node exporter (optional, set <code>ay_manage_ne</code>to <code>true</code>)</p>
</li></ul>
<p>CONFIGURATION</p>

View File

@@ -108,8 +108,6 @@
<p>INSTALLATION</p>
<ul><li>
<p>installs alloy binaries</p>
</li><li>
<p>installs node exporter (optional, set <code>ay_manage_ne</code>to <code>true</code>)</p>
</li></ul>
<p>CONFIGURATION</p>

View File

@@ -234,24 +234,6 @@
</li>
<li>
<span class='name'>ay_manage_ne</span>
<span class='type'>(<tt>Boolean</tt>)</span>
<em class="default">(defaults to: <tt>false</tt>)</em>
&mdash;
<div class='inline'>
<p>whether to manage metric forwarding for the node exporter (external)</p>
</div>
</li>
<li>
<span class='name'>ay_prom_url</span>
@@ -284,6 +266,96 @@
&mdash;
<div class='inline'>
<p>the logging targets</p>
</div>
</li>
<li>
<span class='name'>ay_prom_honor_timestamps</span>
<span class='type'>(<tt>Boolean</tt>)</span>
<em class="default">(defaults to: <tt>true</tt>)</em>
&mdash;
<div class='inline'>
<p>whether to honor timestamps in prometheus metrics</p>
</div>
</li>
<li>
<span class='name'>ay_prom_track_timestamps_staleness</span>
<span class='type'>(<tt>Boolean</tt>)</span>
<em class="default">(defaults to: <tt>true</tt>)</em>
&mdash;
<div class='inline'>
<p>whether to track timestamps staleness in prometheus metrics</p>
</div>
</li>
<li>
<span class='name'>ay_prom_max_shards</span>
<span class='type'>(<tt>String</tt>)</span>
<em class="default">(defaults to: <tt>&#39;10&#39;</tt>)</em>
&mdash;
<div class='inline'>
<p>the maximum number of shards to use for prometheus metrics</p>
</div>
</li>
<li>
<span class='name'>ay_prom_max_samples_per_send</span>
<span class='type'>(<tt>String</tt>)</span>
<em class="default">(defaults to: <tt>&#39;2000&#39;</tt>)</em>
&mdash;
<div class='inline'>
<p>the maximum number of samples to send</p>
</div>
</li>
<li>
<span class='name'>ay_prom_batch_send_deadline</span>
<span class='type'>(<tt>String</tt>)</span>
<em class="default">(defaults to: <tt>&#39;5s&#39;</tt>)</em>
&mdash;
<div class='inline'>
<p>the maximum time to wait before sending</p>
</div>
</li>
@@ -299,11 +371,6 @@
<pre class="lines">
17
18
19
20
21
22
23
24
@@ -330,29 +397,38 @@
45
46
47
48</pre>
48
49
50
51
52
53
54
55</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'manifests/params.pp', line 17</span>
<pre class="code"><span class="info file"># File 'manifests/params.pp', line 22</span>
class confdroid_alloy::params (
String $ay_reqpackages = &#39;alloy&#39;,
String $ay_pkg_ensure = &#39;latest&#39;,
String $ay_reqpackages = &#39;alloy&#39;,
String $ay_pkg_ensure = &#39;latest&#39;,
# loki
Boolean $ay_manage_loki = true,
String $ay_loki_url = &#39;https://loki.example.net/loki/api/v1/push&#39;,
String $ay_loki_username = &#39;loki_user&#39;,
String $ay_loki_userpass = &#39;loki_pass&#39;,
Array $ay_log_targets = [&#39;/var/log/messages&#39;,&#39;/var/log/secure&#39;,],
Boolean $ay_manage_loki = true,
String $ay_loki_url = &#39;https://loki.example.net/loki/api/v1/push&#39;,
String $ay_loki_username = &#39;loki_user&#39;,
String $ay_loki_userpass = &#39;loki_pass&#39;,
Array $ay_log_targets = [&#39;/var/log/messages&#39;,&#39;/var/log/secure&#39;,],
# prometheus
Boolean $ay_manage_prom = true,
String $ay_prom_url = &#39;https://prometheus.example.net/api/v1/write&#39;,
# node exporter (external)
Boolean $ay_manage_ne = false,
Boolean $ay_manage_prom = true,
String $ay_prom_url = &#39;https://prometheus.example.net/api/v1/write&#39;,
Boolean $ay_prom_honor_timestamps = true,
Boolean $ay_prom_track_timestamps_staleness = true,
String $ay_prom_max_shards = &#39;10&#39;,
String $ay_prom_max_samples_per_send = &#39;2000&#39;,
String $ay_prom_batch_send_deadline = &#39;5s&#39;,
) {
# service

View File

@@ -14,6 +14,9 @@
# timestamps in prometheus metrics
# @param [Boolean] ay_prom_track_timestamps_staleness whether to track timestamps
# staleness in prometheus metrics
# @param [String] ay_prom_max_shards the maximum number of shards to use for prometheus metrics
# @param [String] ay_prom_max_samples_per_send the maximum number of samples to send
# @param [String] ay_prom_batch_send_deadline the maximum time to wait before sending
# @summary Class contains all parameters for the confdroid_alloy module.
##############################################################################
class confdroid_alloy::params (
@@ -33,6 +36,9 @@ class confdroid_alloy::params (
String $ay_prom_url = 'https://prometheus.example.net/api/v1/write',
Boolean $ay_prom_honor_timestamps = true,
Boolean $ay_prom_track_timestamps_staleness = true,
String $ay_prom_max_shards = '10',
String $ay_prom_max_samples_per_send = '2000',
String $ay_prom_batch_send_deadline = '5s',
) {
# service

View File

@@ -94,6 +94,11 @@ prometheus.remote_write "prometheus" {
username = "<%= @ay_loki_username %>"
password = "<%= @ay_loki_userpass %>"
}
queue_config {
max_shards = <%= @ay_prom_max_shards %>
max_samples_per_send = <%= @ay_prom_max_samples_per_send %>
batch_send_deadline = <%= @ay_prom_batch_send_deadline %>
}
}
}
<% end %>