Compare commits
12 Commits
230c969e8f
...
1.0.0-04.2
| Author | SHA1 | Date | |
|---|---|---|---|
| c3c92ecd4b | |||
| f7c6180b01 | |||
| e923c8c0e2 | |||
| 8c7d3947cb | |||
| bce7f4d033 | |||
|
|
7ff8e9b5eb | ||
|
|
79661ba78f | ||
|
|
ab6e5579ce | ||
|
|
cd9d5c20c0 | ||
|
|
8e35b21717 | ||
|
|
5167a81612 | ||
|
|
c221cadec6 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -2,3 +2,5 @@
|
|||||||
Gemfile.lock
|
Gemfile.lock
|
||||||
FileList
|
FileList
|
||||||
.scannerwork
|
.scannerwork
|
||||||
|
.vscode
|
||||||
|
.puppet-lint.rc
|
||||||
88
Jenkinsfile
vendored
88
Jenkinsfile
vendored
@@ -25,10 +25,22 @@ pipeline {
|
|||||||
stage('pull master') {
|
stage('pull master') {
|
||||||
steps {
|
steps {
|
||||||
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
|
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
|
||||||
sh '''git config user.name "Jenkins Server"
|
sh '''
|
||||||
git config user.email jenkins@confdroid.com
|
git config user.name "Jenkins Server"
|
||||||
git pull origin master
|
git config user.email jenkins@confdroid.com
|
||||||
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,20 +65,23 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
sh '''/usr/local/bin/puppet-lint . \\
|
sh '''/usr/local/bin/puppet-lint . \\
|
||||||
--no-variable_scope-check \\
|
--no-variable_scope-check \\
|
||||||
|
|| { echo "Puppet lint failed"; exit 1; }
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('SonarScan') {
|
stage('SonarScan') {
|
||||||
steps {
|
steps {
|
||||||
sh '''
|
withCredentials([string(credentialsId: 'sonar-token', variable: 'SONAR_TOKEN')]) {
|
||||||
/opt/sonar-scanner/bin/sonar-scanner \
|
sh '''
|
||||||
-Dsonar.projectKey=java_cd \
|
/opt/sonar-scanner/bin/sonar-scanner \
|
||||||
-Dsonar.sources=. \
|
-Dsonar.projectKey=confdroid_java \
|
||||||
-Dsonar.host.url=https://sonarqube.confdroid.com \
|
-Dsonar.sources=. \
|
||||||
-Dsonar.token=sqa_aca21cc41336d0f31987ed196ccfb9be55ded774
|
-Dsonar.host.url=https://sonarqube.confdroid.com \
|
||||||
'''
|
-Dsonar.token=$SONAR_TOKEN
|
||||||
}
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('create Puppet documentation') {
|
stage('create Puppet documentation') {
|
||||||
@@ -78,10 +93,51 @@ pipeline {
|
|||||||
stage('update repo') {
|
stage('update repo') {
|
||||||
steps {
|
steps {
|
||||||
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
|
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
|
||||||
sh '''git config user.name "Jenkins Server"
|
sh '''
|
||||||
git config user.email jenkins@confdroid.com
|
git config user.name "Jenkins Server"
|
||||||
echo `git add -A && git commit -am "recommit for updates in build $BUILD_NUMBER"`
|
git config user.email jenkins@confdroid.com
|
||||||
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
|
||||||
|
'''
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
48
README.md
48
README.md
@@ -1,22 +1,35 @@
|
|||||||
# Readme
|
# Readme
|
||||||
|
|
||||||
[](https://pipelines.confdroid.com/job/java_cd/)
|
[](https://jenkins.confdroid.com/job/confdroid_java/)
|
||||||
|
[](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
|
## 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
|
## 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
|
## Features
|
||||||
|
|
||||||
INSTALLATION
|
INSTALLATION
|
||||||
|
|
||||||
* installs java binaries
|
- installs java binaries as specified.
|
||||||
|
|
||||||
## Repo Documentation
|
## Repo Documentation
|
||||||
|
|
||||||
@@ -28,17 +41,17 @@ All dependencies must be included in the catalogue.
|
|||||||
|
|
||||||
## Deployment
|
## Deployment
|
||||||
|
|
||||||
* native Puppet deployment
|
- native Puppet deployment
|
||||||
|
|
||||||
via site.pp or nodes.pp
|
via site.pp or nodes.pp
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
node 'example.example.net' {
|
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.
|
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
|
## Support
|
||||||
|
|
||||||
* OS: Rocky 9
|
- OS: Rocky 9 (all RHEL-based OS should work but Rocky 9 is tested)
|
||||||
* Puppet 6-8
|
- Puppet 8
|
||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
|
|
||||||
* Puppet Lint
|
- Puppet Lint
|
||||||
* excluded tests:
|
- 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.
|
- `--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
|
- Puppet Parser
|
||||||
* ERB Template Parser
|
- ERB Template Parser
|
||||||
* Sonar Quality Gate
|
- Sonar Quality Gate
|
||||||
|
|
||||||
## Contact Us
|
## Contact Us
|
||||||
|
|
||||||
[contact Us](https://confdroid.com/contact/)
|
- [contact Us](https://confdroid.com/contact/)
|
||||||
|
- [Feedback Portal](https://feedback.confdroid.com/)
|
||||||
|
|
||||||
## Disclaimer
|
## Disclaimer
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
## java_cd::init.pp
|
## confdroid_java::init.pp
|
||||||
# Module name: java_cd
|
# Module name: confdroid_java
|
||||||
# Author: Arne Teuke (arne_teuke@confdroid.com)
|
# Author: 12ww1160 (12ww1160@confdroid.com)
|
||||||
# @summary Class initializes the java_cd module.
|
# @summary Class initializes the confdroid_java module.
|
||||||
##############################################################################
|
##############################################################################
|
||||||
class java_cd {
|
class confdroid_java {
|
||||||
include java_cd::params
|
include confdroid_java::params
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
## java_cd::main::config.pp
|
## confdroid_java::main::config.pp
|
||||||
# Module name: java_cd
|
# Module name: confdroid_java
|
||||||
# Author: Arne Teuke (arne_teuke@confdroid.com)
|
# Author: 12ww1160 (12ww1160@confdroid.com)
|
||||||
# @summary Class manages the logic for the java_cd module.
|
# @summary Class manages the logic for the confdroid_java module.
|
||||||
##############################################################################
|
##############################################################################
|
||||||
class java_cd::main::config (
|
class confdroid_java::main::config (
|
||||||
|
|
||||||
) inherits java_cd::params {
|
) inherits confdroid_java::params {
|
||||||
include java_cd::main::install
|
include confdroid_java::main::install
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
## java_cd::main::install.pp
|
## confdroid_java::main::install.pp
|
||||||
# Module name: java_cd
|
# Module name: confdroid_java
|
||||||
# Author: Arne Teuke (arne_teuke@confdroid.com)
|
# Author: 12ww1160 (12ww1160@confdroid.com)
|
||||||
# @summary Class manages the logic for the java_cd module.
|
# @summary Class manages the logic for the confdroid_java module.
|
||||||
##############################################################################
|
##############################################################################
|
||||||
class java_cd::main::install (
|
class confdroid_java::main::install (
|
||||||
|
|
||||||
) inherits java_cd::params {
|
) inherits confdroid_java::params {
|
||||||
package { $reqpackages:
|
package { $js_reqpackages:
|
||||||
ensure => $pkg_ensure,
|
ensure => $js_pkg_ensure,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
## java_cd::params.pp
|
## confdroid_java::params.pp
|
||||||
# Module name: java_cd
|
# Module name: confdroid_java
|
||||||
# Author: Arne Teuke (arne_teuke@confdroid.com)
|
# Author: 12ww1160 (12ww1160@confdroid.com)
|
||||||
# @summary Class holds all parameters for the java_cd module.
|
# @summary Class holds all parameters for the confdroid_java module.
|
||||||
# @param [String] reqpackages which packages to install
|
# @param [String] js_reqpackages which packages to install
|
||||||
# @param [String] pkg_ensure 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 $js_reqpackages = 'java-21-openjdk.x86_64',
|
||||||
String $pkg_ensure = 'latest',
|
String $js_pkg_ensure = 'present',
|
||||||
|
|
||||||
) {
|
) {
|
||||||
# includes must be last
|
# includes must be last
|
||||||
include java_cd::main::config
|
include confdroid_java::main::config
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user