diff --git a/.gitignore b/.gitignore index a356406..ae5ef54 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ Gemfile.lock FileList .scannerwork +.vscode +.puppet-lint.rc \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index 8fde767..febb0f7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -28,11 +28,17 @@ pipeline { 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 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; } ''' } @@ -69,7 +75,7 @@ pipeline { withCredentials([string(credentialsId: 'sonar-token', variable: 'SONAR_TOKEN')]) { sh ''' /opt/sonar-scanner/bin/sonar-scanner \ - -Dsonar.projectKey=cd_jenkins \ + -Dsonar.projectKey=confdroid_java \ -Dsonar.sources=. \ -Dsonar.host.url=https://sonarqube.confdroid.com \ -Dsonar.token=$SONAR_TOKEN @@ -91,15 +97,34 @@ pipeline { 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 -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 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 origin + git checkout master + git reset --hard origin/master + 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 refs/heads/master:refs/heads/master + ''' + } + } + } + } } } \ No newline at end of file diff --git a/README.md b/README.md index ef81893..8e29bc1 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,24 @@ # Readme -[![Build Status](https://jenkins.confdroid.com/buildStatus/icon?job=java_cd)](https://jenkins.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/) -[[_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 @@ -16,7 +28,7 @@ INSTALLATION -* installs java binaries +- installs java binaries as specified. ## Repo Documentation @@ -28,17 +40,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 +64,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 diff --git a/doc/_index.html b/doc/_index.html index 2c6b76c..0c8fc67 100644 --- a/doc/_index.html +++ b/doc/_index.html @@ -64,27 +64,27 @@ -