Compare commits

...

12 Commits

Author SHA1 Message Date
c3c92ecd4b OP#586 edit warning section 2026-04-16 22:03:53 +02:00
f7c6180b01 OP#586 add tagging sync 2026-04-16 22:01:10 +02:00
e923c8c0e2 OP#586 add tagging sync 2026-04-16 22:00:34 +02:00
8c7d3947cb OP#586 add tagging sync 2026-04-16 21:57:39 +02:00
bce7f4d033 OP#586 initial commit after fork 2026-04-16 14:59:05 +02:00
Jenkins
7ff8e9b5eb Merge branch 'jenkins-build-3' into 'master'
Auto-merge for build 3

See merge request puppet/java_cd!1
2025-08-17 15:52:39 +00:00
Jenkins Server
79661ba78f Merge remote-tracking branch 'origin/master' into jenkins-build-3 2025-06-06 17:20:10 +02:00
Arne Teuke
ab6e5579ce add new MR approach 2025-06-06 17:19:47 +02:00
Jenkins Server
cd9d5c20c0 Recommit for updates in build 2 2025-05-22 18:10:06 +02:00
Jenkins Server
8e35b21717 Merge remote-tracking branch 'origin/master' into jenkins-build-2 2025-05-22 18:09:35 +02:00
Arne Teuke
5167a81612 fix build info and Jenkins pipeline 2025-05-22 18:09:18 +02:00
Jenkins Server
c221cadec6 recommit for updates in build 1 2025-05-15 14:35:17 +02:00
7 changed files with 136 additions and 64 deletions

2
.gitignore vendored
View File

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

72
Jenkinsfile vendored
View File

@@ -25,10 +25,22 @@ pipeline {
stage('pull master') {
steps {
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
sh '''git config user.name "Jenkins Server"
sh '''
git config user.name "Jenkins Server"
git config user.email jenkins@confdroid.com
git pull origin master
git checkout -b jenkins '''
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; }
'''
}
}
}
@@ -53,21 +65,24 @@ pipeline {
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=java_cd \
-Dsonar.projectKey=confdroid_java \
-Dsonar.sources=. \
-Dsonar.host.url=https://sonarqube.confdroid.com \
-Dsonar.token=sqa_aca21cc41336d0f31987ed196ccfb9be55ded774
-Dsonar.token=$SONAR_TOKEN
'''
}
}
}
stage('create Puppet documentation') {
steps {
@@ -78,10 +93,51 @@ pipeline {
stage('update repo') {
steps {
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
sh '''git config user.name "Jenkins Server"
sh '''
git config user.name "Jenkins Server"
git config user.email jenkins@confdroid.com
echo `git add -A && git commit -am "recommit for updates in build $BUILD_NUMBER"`
git push origin HEAD:master'''
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 --tags 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_java.git \
|| git remote add master https://sourcecode.confdroid.com/confdroid/confdroid_java.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
git -c credential.helper="!f() { echo username=${GITEA_USER}; echo password=${GITEA_TOKEN}; }; f" \
push master --tags
git ls-remote --tags master | awk '{print $2}' | sed 's#refs/tags/##' | cut -d'^' -f1 | sort -u | while read tag; do
if [ -n "$tag" ] && ! git show-ref --tags --verify --quiet "refs/tags/$tag"; then
git -c credential.helper="!f() { echo username=${GITEA_USER}; echo password=${GITEA_TOKEN}; }; f" \
push master ":refs/tags/$tag"
fi
done
'''
}
}
}
}

View File

@@ -1,22 +1,35 @@
# Readme
[![Build Status](https://pipelines.confdroid.com/buildStatus/icon?job=java_cd)](https://pipelines.confdroid.com/job/java_cd/)
[![Build Status](https://jenkins.confdroid.com/buildStatus/icon?job=confdroid_java&style=plastic)](https://jenkins.confdroid.com/job/confdroid_java/)
[![Security Hotspots](https://sonarqube.confdroid.com/api/project_badges/measure?project=confdroid_java&metric=security_hotspots&token=sqb_c7b9021dbe66678773699d0232454ad6cc64234f)](https://sonarqube.confdroid.com/dashboard?id=confdroid_java)
[[_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
`java_cd` is a Puppet module to automate installation and configuration of java, mainly to install the binaries and main configuration files for use with other modules, like jenkins_cd.
`confdroid_java` is a Puppet module to automate installation and configuration of java, mainly to install the binaries and main configuration files for use with other modules, like jenkins_cd.
## 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
INSTALLATION
* installs java binaries
- installs java binaries as specified.
## Repo Documentation
@@ -28,17 +41,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 java_cd
include confdroid_java
}
```
* 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.
@@ -52,21 +65,22 @@ All files and directories are configured with correct selinux context. If selinu
## Support
* OS: Rocky 9
* Puppet 6-8
- OS: Rocky 9 (all RHEL-based OS should work but Rocky 9 is tested)
- Puppet 8
## Tests
* 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
- 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 @@
## java_cd::init.pp
# Module name: java_cd
# Author: Arne Teuke (arne_teuke@confdroid.com)
# @summary Class initializes the java_cd module.
## confdroid_java::init.pp
# Module name: confdroid_java
# Author: 12ww1160 (12ww1160@confdroid.com)
# @summary Class initializes the confdroid_java module.
##############################################################################
class java_cd {
include java_cd::params
class confdroid_java {
include confdroid_java::params
}

View File

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

View File

@@ -1,12 +1,12 @@
## java_cd::main::install.pp
# Module name: java_cd
# Author: Arne Teuke (arne_teuke@confdroid.com)
# @summary Class manages the logic for the java_cd module.
## confdroid_java::main::install.pp
# Module name: confdroid_java
# Author: 12ww1160 (12ww1160@confdroid.com)
# @summary Class manages the logic for the confdroid_java module.
##############################################################################
class java_cd::main::install (
class confdroid_java::main::install (
) inherits java_cd::params {
package { $reqpackages:
ensure => $pkg_ensure,
) inherits confdroid_java::params {
package { $js_reqpackages:
ensure => $js_pkg_ensure,
}
}

View File

@@ -1,16 +1,16 @@
## java_cd::params.pp
# Module name: java_cd
# Author: Arne Teuke (arne_teuke@confdroid.com)
# @summary Class holds all parameters for the java_cd module.
# @param [String] reqpackages which packages to install
# @param [String] pkg_ensure which packages to install
## confdroid_java::params.pp
# Module name: confdroid_java
# Author: 12ww1160 (12ww1160@confdroid.com)
# @summary Class holds all parameters for the confdroid_java module.
# @param [String] js_reqpackages which packages to install
# @param [String] js_pkg_ensure which packages to install
##############################################################################
class java_cd::params (
class confdroid_java::params (
String $reqpackages = 'java-21-openjdk.x86_64',
String $pkg_ensure = 'latest',
String $js_reqpackages = 'java-21-openjdk.x86_64',
String $js_pkg_ensure = 'present',
) {
# includes must be last
include java_cd::main::config
include confdroid_java::main::config
}