OP#647 initial commit after fork

This commit is contained in:
2026-07-21 13:25:48 +02:00
parent fd638a276f
commit a1d70fb4ab
12 changed files with 128 additions and 87 deletions

2
.gitignore vendored
View File

@@ -2,3 +2,5 @@
Gemfile.lock
FileList
.scannerwork
.vscode
.puppet-lint.rc

View File

@@ -5,6 +5,8 @@
"missingok",
"postrotate",
"sharedscripts",
"syslogs"
"syslogs",
"userpass",
"yumrepo"
]
}

36
Jenkinsfile vendored
View File

@@ -69,7 +69,7 @@ pipeline {
withCredentials([string(credentialsId: 'sonar-token', variable: 'SONAR_TOKEN')]) {
sh '''
/opt/sonar-scanner/bin/sonar-scanner \
-Dsonar.projectKey=alloy_cd \
-Dsonar.projectKey=confdroid_alloy \
-Dsonar.sources=. \
-Dsonar.host.url=https://sonarqube.confdroid.com \
-Dsonar.token=$SONAR_TOKEN
@@ -90,16 +90,38 @@ pipeline {
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 -o merge_request.create \
-o merge_request.target=master \
-o merge_request.title="Auto-merge for build $BUILD_NUMBER" \
-o merge_request.description="Automated changes from Jenkins build $BUILD_NUMBER" \
-o merge_request.merge_when_pipeline_succeeds=true \
origin jenkins-build-$BUILD_NUMBER
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

@@ -1,14 +1,26 @@
# Readme
[![Build Status](https://jenkins.confdroid.com/buildStatus/icon?job=alloy_cd)](https://jenkins.confdroid.com/job/alloy_cd/)
[![Build Status](https://jenkins.confdroid.com/buildStatus/icon?job=confdroid_alloy&style=plastic)](https://jenkins.confdroid.com/job/confdroid_alloy/)
[[_TOC_]]
- [Readme](#readme)
- [Synopsis](#synopsis)
- [WARNING](#warning)
- [Features](#features)
- [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
Grafana Alloy is a log management agent built by Grafana labs to scrape and forward logs to Loki, a log management system also built by Grafana labs. Then you can use Grafana itself to visualize those logs and built an alerting system.
`alloy_cd` is a Puppet module to automate installation and configuration of alloy.
`confdroid_alloy` is a Puppet module to automate installation and configuration of alloy.
## WARNING
@@ -18,13 +30,13 @@ Grafana Alloy is a log management agent built by Grafana labs to scrape and forw
INSTALLATION
* installs alloy binaries
- installs alloy binaries
CONFIGURATION
* manage directories and files including templates
* manages the main alloy jenkins for loki and prometheus
* manage service
- manage directories and files including templates
- manages the main alloy jenkins for loki and prometheus
- manage service
## Repo Documentation
@@ -36,17 +48,17 @@ All dependencies must be included in the catalogue.
## Deployment
* native Puppet deployment
- native Puppet deployment
via site.pp or nodes.pp
```bash
node 'example.example.net' {
include cd_kubernetes
include confdroid_alloy
}
```
* 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.
@@ -60,19 +72,22 @@ All files and directories are configured with correct selinux context. If selinu
## Support
* OS: Rocky 9
* Puppet 6,8
- OS: Rocky 9
- Puppet 8
## Tests
* Puppet Lint
* Puppet Parser
* ERB Template Parser
* Sonar Quality Gate
- Puppet Lint
- excluded tests:
- `--no-variable_scope-check`: not applicable as we are inheriting parameters from params class. the lint check does not distinguish between facts and inherited parameters.
- Puppet Parser
- ERB Template Parser
- Sonar Quality Gate
## Contact Us
[contact Us](https://confdroid.com/contact/)
- [contact Us](https://confdroid.com/contact/)
- [Feedback Portal](https://feedback.confdroid.com)
## Disclaimer

View File

@@ -1,8 +1,8 @@
## alloy_cd::init.pp
# Module name: alloy_cd
# Author: Arne Teuke (arne_teuke@confdroid.com)
# @summary Class initializes the alloy_cd module.
## confdroid_alloy::init.pp
# Module name: confdroid_alloy
# Author: 12ww1160 (12ww1160@confdroid.com)
# @summary Class initializes the confdroid_alloy module.
##############################################################################
class alloy_cd {
include alloy_cd::params
class confdroid_alloy {
include confdroid_alloy::params
}

View File

@@ -1,10 +1,10 @@
#### alloy_cd::main::config.pp
# Module name: alloy_cd
# Author: Arne Teuke (arne_teuke@confdroid.com)
# @summary Class manages module logic for the alloy_cd module
#### confdroid_alloy::main::config.pp
# Module name: confdroid_alloy
# Author: 12ww1160 (12ww1160@confdroid.com)
# @summary Class manages module logic for the confdroid_alloy module
###############################################################################
class alloy_cd::main::config (
class confdroid_alloy::main::config (
) inherits alloy_cd::params {
include alloy_cd::main::service
) inherits confdroid_alloy::params {
include confdroid_alloy::main::service
}

View File

@@ -1,12 +1,12 @@
## alloy_cd::main::dirs.pp
# Module name: alloy_cd
# Author: Arne Teuke (arne_teuke@confdroid.com)
# @summary Class manages required directories for the alloy_cd module
## confdroid_alloy::main::dirs.pp
# Module name: confdroid_alloy
# Author: 12ww1160 (12ww1160@confdroid.com)
# @summary Class manages required directories for the confdroid_alloy module
###############################################################################
class alloy_cd::main::dirs (
class confdroid_alloy::main::dirs (
) inherits alloy_cd::params {
require alloy_cd::main::install
) inherits confdroid_alloy::params {
require confdroid_alloy::main::install
# main config dir
file { $ay_main_dir:

View File

@@ -1,15 +1,15 @@
## alloy_cd::main::files.pp
# Module name: alloy_cd
# Author: Arne Teuke (arne_teuke@confdroid.com)
# @summary Class manages required config files for the alloy_cd module
## confdroid_alloy::main::files.pp
# Module name: confdroid_alloy
# Author: 12ww1160 (12ww1160@confdroid.com)
# @summary Class manages required config files for the confdroid_alloy module
###############################################################################
class alloy_cd::main::files (
class confdroid_alloy::main::files (
) inherits alloy_cd::params {
require alloy_cd::main::dirs
) inherits confdroid_alloy::params {
require confdroid_alloy::main::dirs
# Ensure log_targets is always an array
$log_targets_array = Array($alloy_cd::params::ay_log_targets, true)
$log_targets_array = Array($confdroid_alloy::params::ay_log_targets, true)
file { $ay_main_file:
ensure => file,
@@ -20,7 +20,7 @@ class alloy_cd::main::files (
selrole => object_r,
seltype => etc_t,
seluser => system_u,
content => template('alloy_cd/config.alloy.erb'),
content => template('confdroid_alloy/config.alloy.erb'),
notify => Service[$ay_service],
}
@@ -34,7 +34,7 @@ class alloy_cd::main::files (
selrole => object_r,
seltype => etc_t,
seluser => system_u,
content => template('alloy_cd/logrotate.rsyslog.erb'),
content => template('confdroid_alloy/logrotate.rsyslog.erb'),
}
# manage log file group permissions

View File

@@ -1,14 +1,14 @@
## alloy_cd::main::install.pp
# Module name: alloy_cd
# Author: Arne Teuke (arne_teuke@confdroid.com)
# @summary Class installs packages for the alloy_cd module
## confdroid_alloy::main::install.pp
# Module name: confdroid_alloy
# Author: 12ww1160 (12ww1160@confdroid.com)
# @summary Class installs packages for the confdroid_alloy module
###############################################################################
class alloy_cd::main::install (
class confdroid_alloy::main::install (
) inherits alloy_cd::params {
require alloy_cd::main::yumrepo
) inherits confdroid_alloy::params {
require confdroid_alloy::main::yumrepo
package { $reqpackages:
ensure => $pkg_ensure,
package { $ay_reqpackages:
ensure => $ay_pkg_ensure,
}
}

View File

@@ -1,12 +1,12 @@
## alloy_cd::main::service.pp
# Module name: alloy_cd
# Author: Arne Teuke (arne_teuke@confdroid.com)
## confdroid_alloy::main::service.pp
# Module name: confdroid_alloy
# Author: 12ww1160 (12ww1160@confdroid.com)
# @summary Class manages the alloy service
###############################################################################
class alloy_cd::main::service (
class confdroid_alloy::main::service (
) inherits alloy_cd::params {
require alloy_cd::main::files
) inherits confdroid_alloy::params {
require confdroid_alloy::main::files
service { $ay_service:
ensure => running,

View File

@@ -1,11 +1,11 @@
## alloy_cd::main::yumrepo.pp
# Module name: alloy_cd
# Author: Arne Teuke (arne_teuke@confdroid.com)
# @summary class install yum repos for the alloy_cd module
## confdroid_alloy::main::yumrepo.pp
# Module name: confdroid_alloy
# Author: 12ww1160 (12ww1160@confdroid.com)
# @summary class install yum repos for the confdroid_alloy module
##############################################################################
class alloy_cd::main::yumrepo (
class confdroid_alloy::main::yumrepo (
) inherits alloy_cd::params {
) inherits confdroid_alloy::params {
# test
yumrepo { 'grafana':
ensure => 'present',

View File

@@ -1,8 +1,8 @@
## alloy_cd::params.pp
# Module name: alloy_cd
# Author: Arne Teuke (arne_teuke@confdroid.com)
# @param [String] reqpackages which packages to install
# @param [String] pkg_ensure 'latest' or 'present'
## confdroid_alloy::params.pp
# Module name: confdroid_alloy
# Author: 12ww1160 (12ww1160@confdroid.com)
# @param [String] ay_reqpackages which packages to install
# @param [String] ay_pkg_ensure 'latest' or 'present'
# @param [String] ay_loki_url the url where alloy will send logs to.
# @param [String] ay_loki_username the username to logon to loki
# @param [String] ay_loki_userpass the password to logon to loki
@@ -12,12 +12,12 @@
# the node exporter (external)
# @param [String] ay_prom_url the url where alloy will send metrics
# @param [Array] ay_log_targets the logging targets
# @summary Class contains all parameters for the alloy_cd module.
# @summary Class contains all parameters for the confdroid_alloy module.
##############################################################################
class alloy_cd::params (
class confdroid_alloy::params (
String $reqpackages = 'alloy',
String $pkg_ensure = 'latest',
String $ay_reqpackages = 'alloy',
String $ay_pkg_ensure = 'latest',
# loki
Boolean $ay_manage_loki = true,
@@ -44,5 +44,5 @@ class alloy_cd::params (
$ay_main_file = "${ay_main_dir}/config.alloy"
# includes must be last
include alloy_cd::main::config
include confdroid_alloy::main::config
}