From ab57ba7a5481093626baf114280b484c4b91fc5b Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sat, 2 Aug 2025 00:33:29 +0530 Subject: [PATCH 01/41] jenkinsfile update --- Jenkinsfile | 2 +- Jenkinsfile_aditya | 36 ------------------------------------ 2 files changed, 1 insertion(+), 37 deletions(-) delete mode 100644 Jenkinsfile_aditya diff --git a/Jenkinsfile b/Jenkinsfile index cc4897e0..07e8ec94 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,7 @@ pipeline { agent any tools { - maven 'maven3.6' + maven 'Maven3' jdk 'jdk17' } diff --git a/Jenkinsfile_aditya b/Jenkinsfile_aditya deleted file mode 100644 index 8a84ca86..00000000 --- a/Jenkinsfile_aditya +++ /dev/null @@ -1,36 +0,0 @@ -pipeline { - agent any - - tools { - maven 'maven3.6' - jdk 'jdk17' - } - - stages { - stage('New-Jenkinsfile') { - steps { - echo 'New Jenkinsfile' - } - } - stage('Compile') { - steps { - sh 'mvn compile' - } - } - stage('test') { - steps { - sh 'mvn test' - } - } - stage('Package') { - steps { - sh 'mvn package' - } - } - stage('Hello') { - steps { - echo 'Hello World' - } - } - } -} From c0d0356ce7805425c261f6c50ecfea7f32595808 Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sat, 2 Aug 2025 00:41:51 +0530 Subject: [PATCH 02/41] Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 07e8ec94..d19be4f9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -25,7 +25,7 @@ pipeline { } stage('Hello') { steps { - echo 'Hello World' + echo 'Hello World !' } } } From c4226d9e11ed6e340db61fcd33dcc15d8f1562c9 Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sat, 2 Aug 2025 00:46:43 +0530 Subject: [PATCH 03/41] Jenkins file update --- Jenkinsfile | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d19be4f9..44bede62 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,32 +1,56 @@ pipeline { agent any - + tools { - maven 'Maven3' - jdk 'jdk17' + maven 'Maven3' // Ensure this name matches your Jenkins tool configuration + jdk 'jdk17' // Ensure JDK 17 is installed and labeled as 'jdk17' in Jenkins } stages { - + stage('Checkout Code') { + steps { + echo 'Cloning repository...' + checkout scm + } + } + stage('Compile') { steps { - sh 'mvn compile' + echo 'Compiling the application...' + sh 'mvn compile' } } - stage('test') { + + stage('Test') { steps { + echo 'Running unit tests...' sh 'mvn test' } } + stage('Package') { steps { - sh 'mvn package' + echo 'Packaging the application...' + sh 'mvn package' } } + stage('Hello') { steps { - echo 'Hello World !' + echo 'Hello World!' } } } + + post { + always { + echo 'Pipeline execution completed.' + } + success { + echo 'Build completed successfully!' + } + failure { + echo 'Build failed. Please check the logs.' + } + } } From 5ec6f89c219e58c7a899f89a687db2e134a2b3ee Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sat, 2 Aug 2025 00:49:39 +0530 Subject: [PATCH 04/41] Jenkins file update --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 44bede62..4c45d7b3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,7 +10,7 @@ pipeline { stage('Checkout Code') { steps { echo 'Cloning repository...' - checkout scm + git url: 'https://github.com/Savirean07/Boardgame.git', branch: 'main' } } From 91b63be86720cb23521412efe193f17f224ec551 Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sat, 2 Aug 2025 00:51:00 +0530 Subject: [PATCH 05/41] Jenkins file update --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4c45d7b3..bc9ae156 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -37,7 +37,7 @@ pipeline { stage('Hello') { steps { - echo 'Hello World!' + echo 'Hello World !' } } } From 9fa7dcc1a334eb39d8074d73fc4484d4984d62e4 Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sat, 2 Aug 2025 00:54:08 +0530 Subject: [PATCH 06/41] Jenkins file update --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index bc9ae156..0d184a77 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -37,7 +37,7 @@ pipeline { stage('Hello') { steps { - echo 'Hello World !' + echo 'Hello World !!' } } } From 5e70649527cff8eb5d4b228662a27b5529d0c039 Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sat, 2 Aug 2025 00:58:19 +0530 Subject: [PATCH 07/41] Jenkins file update --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0d184a77..671effea 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -37,7 +37,7 @@ pipeline { stage('Hello') { steps { - echo 'Hello World !!' + echo 'This is Boardgame project CI-CD!' } } } From 890c87a9e7b67656a4a52e85c2ed7b2f3b69aae6 Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sat, 2 Aug 2025 01:19:20 +0530 Subject: [PATCH 08/41] Jenkins file update --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 671effea..6cd643eb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,7 +3,7 @@ pipeline { tools { maven 'Maven3' // Ensure this name matches your Jenkins tool configuration - jdk 'jdk17' // Ensure JDK 17 is installed and labeled as 'jdk17' in Jenkins + jdk 'Java 8' // Ensure JDK 17 is installed and labeled as 'jdk17' in Jenkins } stages { From 422eeaea8511fb96b361de33dee8b424aa1f0794 Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sat, 2 Aug 2025 01:42:50 +0530 Subject: [PATCH 09/41] Jenkins file update --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6cd643eb..bbc90341 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -37,7 +37,7 @@ pipeline { stage('Hello') { steps { - echo 'This is Boardgame project CI-CD!' + echo 'This is Boardgame project CI-CD! Heloo ' } } } From 5b9bd3f9ccf475b11f206bb465d80a98f193ad9f Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sat, 2 Aug 2025 21:25:38 +0530 Subject: [PATCH 10/41] Trivy scan stage --- Jenkinsfile | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bbc90341..963e1456 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,20 +20,13 @@ pipeline { sh 'mvn compile' } } - - stage('Test') { + stage('File scan by Trivy') { steps { - echo 'Running unit tests...' - sh 'mvn test' + echo 'Running Trivy scan...' + sh 'trivy fs --format table --output trivy-filescanproject-output.txt .' } } - stage('Package') { - steps { - echo 'Packaging the application...' - sh 'mvn package' - } - } stage('Hello') { steps { From 4624f5b5913980c2d9f007ef66bb502dc1686796 Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sun, 3 Aug 2025 00:50:17 +0530 Subject: [PATCH 11/41] Sonar Analysis stage added --- Jenkinsfile | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 963e1456..78363027 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -26,24 +26,17 @@ pipeline { sh 'trivy fs --format table --output trivy-filescanproject-output.txt .' } } - - - stage('Hello') { + stage('Sonar Analysis') { steps { - echo 'This is Boardgame project CI-CD! Heloo ' + echo 'Running SonarQube analysis...' + withSonarQubeEnv('SonarQube') { // Ensure 'SonarQube' matches your SonarQube server configuration in Jenkins + sh ''' Scanner_Home/bin/sonar-scanner \ + -Dsonar.projectKey=Boardgame \ + -Dsonar.projectkey=Boardgame \ + -Dsonar.java.binaries=. -Dsonar.exclusions=**trivy-filescanproject-output.txt \ + ''' + } } } - } - post { - always { - echo 'Pipeline execution completed.' - } - success { - echo 'Build completed successfully!' - } - failure { - echo 'Build failed. Please check the logs.' - } - } } From 3bb0170d47fef9b722656b6d356e46f981364455 Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sun, 3 Aug 2025 00:51:11 +0530 Subject: [PATCH 12/41] Sonar Analysis stage added --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 78363027..30bdb407 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -38,5 +38,5 @@ pipeline { } } } - + } } From c965e248ef65ba492abec6b29dbb66a308a53ddd Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sun, 3 Aug 2025 00:59:55 +0530 Subject: [PATCH 13/41] Sonar Analysis stage added --- Jenkinsfile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 30bdb407..f8ce42e0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -30,10 +30,11 @@ pipeline { steps { echo 'Running SonarQube analysis...' withSonarQubeEnv('SonarQube') { // Ensure 'SonarQube' matches your SonarQube server configuration in Jenkins - sh ''' Scanner_Home/bin/sonar-scanner \ - -Dsonar.projectKey=Boardgame \ - -Dsonar.projectkey=Boardgame \ - -Dsonar.java.binaries=. -Dsonar.exclusions=**trivy-filescanproject-output.txt \ + sh ''' + ${Sonar_Scanner_Home}/bin/sonar-scanner \ + -Dsonar.projectKey=Boardgame \ + -Dsonar.java.binaries=. + -Dsonar.exclusions=**trivy-filescanproject-output.txt \ ''' } } From 19b45e4dfdf60e3b58ab7a3f86490bc017724f8a Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sun, 3 Aug 2025 01:03:26 +0530 Subject: [PATCH 14/41] Sonar Analysis stage added --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f8ce42e0..915928da 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -33,8 +33,8 @@ pipeline { sh ''' ${Sonar_Scanner_Home}/bin/sonar-scanner \ -Dsonar.projectKey=Boardgame \ - -Dsonar.java.binaries=. - -Dsonar.exclusions=**trivy-filescanproject-output.txt \ + -Dsonar.java.binaries=. \ + -Dsonar.exclusions=**trivy-filescanproject-output.txt ''' } } From f67048cb9680826fc661802ac3ecd1ce962c7aa7 Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sun, 3 Aug 2025 01:06:20 +0530 Subject: [PATCH 15/41] Sonar Analysis stage added --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 915928da..175e7abe 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -31,10 +31,10 @@ pipeline { echo 'Running SonarQube analysis...' withSonarQubeEnv('SonarQube') { // Ensure 'SonarQube' matches your SonarQube server configuration in Jenkins sh ''' - ${Sonar_Scanner_Home}/bin/sonar-scanner \ + ${SONAR_SCANNER_HOME}/bin/sonar-scanner \ -Dsonar.projectKey=Boardgame \ -Dsonar.java.binaries=. \ - -Dsonar.exclusions=**trivy-filescanproject-output.txt + -Dsonar.exclusions=**/trivy-filescanproject-output.txt ''' } } From 0fa79fe3e556d9d6d7526b2da169d54e02a35fda Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sun, 3 Aug 2025 01:14:56 +0530 Subject: [PATCH 16/41] Sonar Analysis stage added --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 175e7abe..9594d151 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -32,7 +32,7 @@ pipeline { withSonarQubeEnv('SonarQube') { // Ensure 'SonarQube' matches your SonarQube server configuration in Jenkins sh ''' ${SONAR_SCANNER_HOME}/bin/sonar-scanner \ - -Dsonar.projectKey=Boardgame \ + -Dsonar.projectKey=Boardgame \ -Dsonar.java.binaries=. \ -Dsonar.exclusions=**/trivy-filescanproject-output.txt ''' From 800d99d20ff5e015ec9ab0389d07dd575173ab47 Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sun, 3 Aug 2025 01:15:33 +0530 Subject: [PATCH 17/41] Sonar Analysis stage added --- Jenkinsfile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9594d151..10ad7cd1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,7 +3,7 @@ pipeline { tools { maven 'Maven3' // Ensure this name matches your Jenkins tool configuration - jdk 'Java 8' // Ensure JDK 17 is installed and labeled as 'jdk17' in Jenkins + jdk 'Java 8' // Ensure JDK 8 is installed and labeled as 'Java 8' in Jenkins } stages { @@ -20,21 +20,23 @@ pipeline { sh 'mvn compile' } } + stage('File scan by Trivy') { steps { echo 'Running Trivy scan...' sh 'trivy fs --format table --output trivy-filescanproject-output.txt .' } } + stage('Sonar Analysis') { steps { echo 'Running SonarQube analysis...' - withSonarQubeEnv('SonarQube') { // Ensure 'SonarQube' matches your SonarQube server configuration in Jenkins - sh ''' + withSonarQubeEnv('SonarQube') { + sh ''' ${SONAR_SCANNER_HOME}/bin/sonar-scanner \ - -Dsonar.projectKey=Boardgame \ + -Dsonar.projectKey=Boardgame \ -Dsonar.java.binaries=. \ - -Dsonar.exclusions=**/trivy-filescanproject-output.txt + -Dsonar.exclusions=**/trivy-filescanproject-output.txt ''' } } From 019efd34e8f46c05c8b3059102a753fb16812f31 Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sun, 3 Aug 2025 01:19:47 +0530 Subject: [PATCH 18/41] Sonar Analysis stage added --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 10ad7cd1..e63e6edc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -31,7 +31,7 @@ pipeline { stage('Sonar Analysis') { steps { echo 'Running SonarQube analysis...' - withSonarQubeEnv('SonarQube') { + withSonarQubeEnv('sonarqube') { sh ''' ${SONAR_SCANNER_HOME}/bin/sonar-scanner \ -Dsonar.projectKey=Boardgame \ From deca5f3b2c756170a0a7aacf3b69fb209f2e0591 Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sun, 3 Aug 2025 01:28:32 +0530 Subject: [PATCH 19/41] Sonar Analysis stage added --- Jenkinsfile | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e63e6edc..3c6b580e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -32,12 +32,10 @@ pipeline { steps { echo 'Running SonarQube analysis...' withSonarQubeEnv('sonarqube') { - sh ''' - ${SONAR_SCANNER_HOME}/bin/sonar-scanner \ - -Dsonar.projectKey=Boardgame \ - -Dsonar.java.binaries=. \ - -Dsonar.exclusions=**/trivy-filescanproject-output.txt - ''' + + sh "sonar-scanner -Dsonar.projectKey=Boardgame -Dsonar.java.binaries=. -Dsonar.exclusions=**/trivy-filescanproject-output.txt" + + } } } From 4e0957cfcc24994eb9ce5f8596fe0efbf6b1b7ef Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sun, 3 Aug 2025 01:41:39 +0530 Subject: [PATCH 20/41] Sonar Analysis stage added --- Jenkinsfile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3c6b580e..ab17ac16 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -31,10 +31,13 @@ pipeline { stage('Sonar Analysis') { steps { echo 'Running SonarQube analysis...' - withSonarQubeEnv('sonarqube') { - - sh "sonar-scanner -Dsonar.projectKey=Boardgame -Dsonar.java.binaries=. -Dsonar.exclusions=**/trivy-filescanproject-output.txt" - + withSonarQubeEnv('SonarQube') { + sh ''' + ${SONAR_SCANNER_HOME}/bin/sonar-scanner \ + -Dsonar.projectKey=Boardgame \ + -Dsonar.java.binaries=. \ + -Dsonar.exclusions=**/trivy-filescanproject-output.txt + ''' } } From 9355a64a879256b9374c3fb5842cea589de8172c Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sun, 3 Aug 2025 10:23:19 +0530 Subject: [PATCH 21/41] Sonar Analysis stage added --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index ab17ac16..44c2cdaf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -31,7 +31,7 @@ pipeline { stage('Sonar Analysis') { steps { echo 'Running SonarQube analysis...' - withSonarQubeEnv('SonarQube') { + withSonarQubeEnv('sonarqube') { sh ''' ${SONAR_SCANNER_HOME}/bin/sonar-scanner \ -Dsonar.projectKey=Boardgame \ From 138b44a55b75dd7676d359a502bf55817dd402cc Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sun, 3 Aug 2025 10:46:42 +0530 Subject: [PATCH 22/41] Sonar Analysis stage added --- Jenkinsfile | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 44c2cdaf..f33e3f9d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -32,12 +32,7 @@ pipeline { steps { echo 'Running SonarQube analysis...' withSonarQubeEnv('sonarqube') { - sh ''' - ${SONAR_SCANNER_HOME}/bin/sonar-scanner \ - -Dsonar.projectKey=Boardgame \ - -Dsonar.java.binaries=. \ - -Dsonar.exclusions=**/trivy-filescanproject-output.txt - ''' + sh 'sonar-scanner -Dsonar.projectKey=Boardgame -Dsonar.java.binaries=. -Dsonar.exclusions=**/trivy-filescanproject-output.txt' } } From fbcea7ac9305d6b6215301f4ce52fd41fb460fe3 Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sun, 3 Aug 2025 10:52:02 +0530 Subject: [PATCH 23/41] Sonar Analysis stage added --- Jenkinsfile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index f33e3f9d..91b3b658 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -37,5 +37,12 @@ pipeline { } } } + stage('Check Scanner') + { + steps { + sh 'which sonar-scanner' + sh 'sonar-scanner --version' + } + } } } From 9781d08d897e33aedebc5ea65b46e6727ee28ad3 Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sun, 3 Aug 2025 10:59:43 +0530 Subject: [PATCH 24/41] Sonar Analysis stage added --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 91b3b658..d10845cd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,7 +3,8 @@ pipeline { tools { maven 'Maven3' // Ensure this name matches your Jenkins tool configuration - jdk 'Java 8' // Ensure JDK 8 is installed and labeled as 'Java 8' in Jenkins + jdk 'Java 8' + sonarQubeScanner 'SonarScanner' // Ensure JDK 8 is installed and labeled as 'Java 8' in Jenkins } stages { From d3a423851339a10c19b9e28c76e4f215f3e9ab88 Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sun, 3 Aug 2025 11:02:41 +0530 Subject: [PATCH 25/41] Sonar Analysis stage added --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d10845cd..47b26d4c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,8 +3,8 @@ pipeline { tools { maven 'Maven3' // Ensure this name matches your Jenkins tool configuration - jdk 'Java 8' - sonarQubeScanner 'SonarScanner' // Ensure JDK 8 is installed and labeled as 'Java 8' in Jenkins + jdk 'Java 8' // Ensure JDK 8 is installed and labeled as 'Java 8' in Jenkins + sonarQubeScanner 'SonarScanner' } stages { From 7e18b3ec358dffcf65fda95b44cb5078c4692381 Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sun, 3 Aug 2025 11:04:57 +0530 Subject: [PATCH 26/41] Sonar Analysis stage added --- Jenkinsfile | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 47b26d4c..ddfe7ea1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,9 +2,9 @@ pipeline { agent any tools { - maven 'Maven3' // Ensure this name matches your Jenkins tool configuration - jdk 'Java 8' // Ensure JDK 8 is installed and labeled as 'Java 8' in Jenkins - sonarQubeScanner 'SonarScanner' + maven 'Maven3' // Ensure this matches Jenkins config + jdk 'Java 8' // Ensure this is defined in Jenkins + sonarQubeScanner 'SonarScanner' // Must match Global Tool Configuration name } stages { @@ -29,21 +29,27 @@ pipeline { } } + stage('Check Scanner') { + steps { + echo 'Checking sonar-scanner path and version...' + sh 'echo $PATH' + sh 'which sonar-scanner || echo "sonar-scanner not found!"' + sh 'sonar-scanner --version || echo "Version check failed!"' + } + } + stage('Sonar Analysis') { steps { echo 'Running SonarQube analysis...' withSonarQubeEnv('sonarqube') { - sh 'sonar-scanner -Dsonar.projectKey=Boardgame -Dsonar.java.binaries=. -Dsonar.exclusions=**/trivy-filescanproject-output.txt' - + sh ''' + sonar-scanner \ + -Dsonar.projectKey=Boardgame \ + -Dsonar.java.binaries=. \ + -Dsonar.exclusions=**/trivy-filescanproject-output.txt + ''' } } } - stage('Check Scanner') - { - steps { - sh 'which sonar-scanner' - sh 'sonar-scanner --version' - } - } } } From cb88eb21173d3f874e71fc0a05ac5092339a2db0 Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sun, 3 Aug 2025 11:06:40 +0530 Subject: [PATCH 27/41] Sonar Analysis stage added --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index ddfe7ea1..1cd1e05b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,7 +4,7 @@ pipeline { tools { maven 'Maven3' // Ensure this matches Jenkins config jdk 'Java 8' // Ensure this is defined in Jenkins - sonarQubeScanner 'SonarScanner' // Must match Global Tool Configuration name + } stages { From 9edce11ced4cd313fa6b64180aa4bc0e718f11dd Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sun, 3 Aug 2025 11:17:37 +0530 Subject: [PATCH 28/41] Sonar Analysis stage added --- Jenkinsfile | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1cd1e05b..57c57e64 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -42,12 +42,8 @@ pipeline { steps { echo 'Running SonarQube analysis...' withSonarQubeEnv('sonarqube') { - sh ''' - sonar-scanner \ - -Dsonar.projectKey=Boardgame \ - -Dsonar.java.binaries=. \ - -Dsonar.exclusions=**/trivy-filescanproject-output.txt - ''' + sh '/opt/sonar-scanner/bin/sonar-scanner -Dsonar.projectKey=Boardgame -Dsonar.java.binaries=. -Dsonar.exclusions=**/trivy-filescanproject-output.txt' + } } } From 218ab85d4549ab49eae93a11ffbb70894a7fb485 Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sun, 3 Aug 2025 17:32:24 +0530 Subject: [PATCH 29/41] Quality gate stage added --- Jenkinsfile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 57c57e64..5cb020cf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -47,5 +47,15 @@ pipeline { } } } + stage('Quality Gate') { + steps { + echo 'Waiting for SonarQube Quality Gate...' + timeout(time: 1, unit: 'HOURS') { + waitForQualityGate abortPipeline: true, credentialsId: 'sonarqube' + + } + + } + } } } From 181466e0692bf55ba77a70236522dd0fa50d3d38 Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sun, 3 Aug 2025 17:32:47 +0530 Subject: [PATCH 30/41] Sonar Analysis stage added --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 5cb020cf..0d4bb17f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -50,7 +50,7 @@ pipeline { stage('Quality Gate') { steps { echo 'Waiting for SonarQube Quality Gate...' - timeout(time: 1, unit: 'HOURS') { + timeout(time: 1, unit: 'MINUTES') { waitForQualityGate abortPipeline: true, credentialsId: 'sonarqube' } From c06de4f8a00835bd4c77aec5e697f24dc292f19f Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sun, 3 Aug 2025 17:38:14 +0530 Subject: [PATCH 31/41] Maven Package stage added --- Jenkinsfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 0d4bb17f..2adb6dbf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -57,5 +57,11 @@ pipeline { } } + stage('Maven Package'){ + steps { + echo 'Maven packaging started ....' + sh 'mvn package' + } + } } } From 74768aa5ff5386a315422fe6081564d3e540b4dd Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sun, 3 Aug 2025 18:01:45 +0530 Subject: [PATCH 32/41] Jar publish stage --- Jenkinsfile | 54 ++++++++++++-- pom.xml | 204 +++++++++++++++++++--------------------------------- 2 files changed, 122 insertions(+), 136 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2adb6dbf..62ab2bad 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,7 +4,10 @@ pipeline { tools { maven 'Maven3' // Ensure this matches Jenkins config jdk 'Java 8' // Ensure this is defined in Jenkins + } + environment { + registry = "https://your-jfrog-url" // Replace with your actual JFrog base URL (without /artifactory) } stages { @@ -42,26 +45,63 @@ pipeline { steps { echo 'Running SonarQube analysis...' withSonarQubeEnv('sonarqube') { - sh '/opt/sonar-scanner/bin/sonar-scanner -Dsonar.projectKey=Boardgame -Dsonar.java.binaries=. -Dsonar.exclusions=**/trivy-filescanproject-output.txt' - + sh ''' + /opt/sonar-scanner/bin/sonar-scanner \ + -Dsonar.projectKey=Boardgame \ + -Dsonar.java.binaries=. \ + -Dsonar.exclusions=**/trivy-filescanproject-output.txt + ''' } } } + stage('Quality Gate') { steps { echo 'Waiting for SonarQube Quality Gate...' timeout(time: 1, unit: 'MINUTES') { - waitForQualityGate abortPipeline: true, credentialsId: 'sonarqube' - + waitForQualityGate abortPipeline: true } - } } - stage('Maven Package'){ + + stage('Maven Package') { steps { - echo 'Maven packaging started ....' + echo 'Maven packaging started...' sh 'mvn package' } } + + stage('Jar Publish') { + steps { + script { + echo '<-------------- Jar Publish Started -------------->' + + def server = Artifactory.newServer( + url: "${registry}/artifactory", + credentialsId: "jfrogaccess" + ) + + def properties = "buildid=${env.BUILD_ID},commitid=${env.GIT_COMMIT}" + + def uploadSpec = """{ + "files": [ + { + "pattern": "target/database_service_project.jar", + "target": "boardgame-libs-release/", + "flat": false, + "props": "${properties}", + "exclusions": ["*.sha1", "*.md5"] + } + ] + }""" + + def buildInfo = server.upload(uploadSpec) + buildInfo.env.collect() + server.publishBuildInfo(buildInfo) + + echo '<-------------- Jar Publish Ended -------------->' + } + } + } } } diff --git a/pom.xml b/pom.xml index bc36443b..cb094d52 100644 --- a/pom.xml +++ b/pom.xml @@ -1,131 +1,77 @@ - - - 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 2.5.6 - - - com.javaproject - database_service_project - 0.0.7-SNAPSHOT - database_service_project - Project for Spring Boot - jar - - 11 - 0.8.7 - jacoco - reuseReports - ${project.basedir}/../target/jacoco.exec - java - - - - - - org.thymeleaf.extras - thymeleaf-extras-springsecurity5 - - - org.springframework.boot - spring-boot-starter-security - - - - org.springframework.boot - spring-boot-starter-data-jdbc - - - org.springframework.boot - spring-boot-starter-thymeleaf - - - org.springframework.boot - spring-boot-starter-web - - - com.h2database - h2 - runtime - - + + + 4.0.0 + + + com.qubitware + To-Do-App + 1.0.0 + jar + + + To-Do App + A sample to-do app for CI/CD pipeline demo + + + + 17 + 17 + + + + + + + junit + junit + 4.13.2 + test + + + + + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.10.1 + + ${maven.compiler.source} + ${maven.compiler.target} + + + + + + + + + \ No newline at end of file From 9c3730e676da21902220e7f60d606dc612791ab0 Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sun, 3 Aug 2025 18:11:47 +0530 Subject: [PATCH 33/41] Jar publish stage --- pom.xml | 204 +++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 129 insertions(+), 75 deletions(-) diff --git a/pom.xml b/pom.xml index cb094d52..bc36443b 100644 --- a/pom.xml +++ b/pom.xml @@ -1,77 +1,131 @@ - - - 4.0.0 - - - com.qubitware - To-Do-App - 1.0.0 - jar - - - To-Do App - A sample to-do app for CI/CD pipeline demo - - - - 17 - 17 - - - - - - - junit - junit - 4.13.2 - test - - - - - + + com.javaproject + database_service_project + 0.0.7-SNAPSHOT + database_service_project + Project for Spring Boot + jar + + 11 + 0.8.7 + jacoco + reuseReports + ${project.basedir}/../target/jacoco.exec + java + + + + + + org.thymeleaf.extras + thymeleaf-extras-springsecurity5 + + + org.springframework.boot + spring-boot-starter-security + + + + org.springframework.boot + spring-boot-starter-data-jdbc + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-web + + + com.h2database + h2 + runtime + + org.springframework.boot - spring-boot-starter-web + spring-boot-starter-data-jpa - --> - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.10.1 - - ${maven.compiler.source} - ${maven.compiler.target} - - - - - - - - - \ No newline at end of file + + org.projectlombok + lombok + true + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.security + spring-security-test + test + + + + org.jacoco + jacoco-maven-plugin + 0.8.7 + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + jacoco-initialize + + prepare-agent + + + + jacoco-site + package + + report + + + + + + + + + + + maven-releases + http://13.201.64.186:8081/repository/maven-releases/ + + + maven-snapshots + http://13.201.64.186:8081/repository/maven-snapshots/ + + + + From 1905d9343c28915a09b0f7f42a0d3b4bf5ae3aa8 Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Sun, 3 Aug 2025 18:25:02 +0530 Subject: [PATCH 34/41] Jar publish stage --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 62ab2bad..937a1d03 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,7 +7,7 @@ pipeline { } environment { - registry = "https://your-jfrog-url" // Replace with your actual JFrog base URL (without /artifactory) + registry = "https://trialosfhow.jfrog.io" // Replace with your actual JFrog base URL (without /artifactory) } stages { From ca1ff1798288230cfa2518288e5ba78e4e717942 Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Mon, 4 Aug 2025 23:41:25 +0530 Subject: [PATCH 35/41] Jenkinsfile updated with stages --- Jenkinsfile | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 72 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 937a1d03..f002326f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,6 +8,8 @@ pipeline { environment { registry = "https://trialosfhow.jfrog.io" // Replace with your actual JFrog base URL (without /artifactory) + IMAGE_NAME = "boardgame-app" + IMAGE_TAG = "latest" } stages { @@ -46,7 +48,7 @@ pipeline { echo 'Running SonarQube analysis...' withSonarQubeEnv('sonarqube') { sh ''' - /opt/sonar-scanner/bin/sonar-scanner \ + sonar-scanner \ -Dsonar.projectKey=Boardgame \ -Dsonar.java.binaries=. \ -Dsonar.exclusions=**/trivy-filescanproject-output.txt @@ -103,5 +105,74 @@ pipeline { } } } + + stage('Docker Build and Tag') { + steps { + script { + echo 'Docker Build and Tag started' + echo "Building Docker image ${IMAGE_NAME}:${IMAGE_TAG}" + sh "docker build -t ${IMAGE_NAME}:${IMAGE_TAG} ." + } + } + } + + stage('Trivy Docker Image Scan') { + steps { + echo 'Trivy Docker image scan started' + sh "trivy image --format table --output trivy-image-scan.txt ${IMAGE_NAME}:${IMAGE_TAG}" + } + } + + stage('Image Push to Docker Hub') { + steps { + script { + echo 'Docker Push to Docker Hub started' + withCredentials([usernamePassword(credentialsId: 'docker-hub-credentials', usernameVariable: 'DOCKER_USERNAME', passwordVariable: 'DOCKER_PASSWORD')]) { + sh ''' + echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + docker push ${IMAGE_NAME}:${IMAGE_TAG} + docker logout + ''' + } + } + } + } + + stage('Image Push to Azure Container Registry') { + steps { + script { + echo 'Docker Push to Azure Container Registry started' + + def acrRegistry = 'todo1-fravf4hkffbshdbc.azurecr.io' + def acrImage = "${acrRegistry}/to-do-app:${IMAGE_TAG}" + + sh "docker tag ${IMAGE_NAME}:${IMAGE_TAG} ${acrImage}" + + withCredentials([usernamePassword(credentialsId: 'acr-cred', usernameVariable: 'ACR_USERNAME', passwordVariable: 'ACR_PASSWORD')]) { + sh """ + echo "$ACR_PASSWORD" | docker login ${acrRegistry} -u "$ACR_USERNAME" --password-stdin + docker push ${acrImage} + docker logout ${acrRegistry} + """ + } + } + } + } + + stage('Deploy to Kubernetes') { + steps { + script { + echo 'Deploying to Kubernetes cluster' + + withCredentials([file(credentialsId: 'K8-cred', variable: 'KUBECONFIG_FILE')]) { + sh ''' + export KUBECONFIG=$KUBECONFIG_FILE + kubectl apply -f deployment-service.yml + kubectl rollout status deployment/to-do-app + ''' + } + } + } + } } } From 56e722fec6bcaa4545f73ef04fc329a037dec8e5 Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Tue, 5 Aug 2025 00:18:52 +0530 Subject: [PATCH 36/41] Jenkinsfile updated with stages --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index f002326f..ed2382d2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,6 +10,7 @@ pipeline { registry = "https://trialosfhow.jfrog.io" // Replace with your actual JFrog base URL (without /artifactory) IMAGE_NAME = "boardgame-app" IMAGE_TAG = "latest" + PATH = "/opt/sonar-scanner/bin:$PATH" } stages { From 688b39aa57190c168737016383bc38a06f7a0e19 Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Tue, 5 Aug 2025 00:37:08 +0530 Subject: [PATCH 37/41] Jenkinsfile updated with stages --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index ed2382d2..b835692c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,7 +8,7 @@ pipeline { environment { registry = "https://trialosfhow.jfrog.io" // Replace with your actual JFrog base URL (without /artifactory) - IMAGE_NAME = "boardgame-app" + IMAGE_NAME = "himanshujangid/boardgame-app" IMAGE_TAG = "latest" PATH = "/opt/sonar-scanner/bin:$PATH" } From 148b619536ee8c6c094eba4b2a3b0208211006c6 Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Tue, 5 Aug 2025 00:42:38 +0530 Subject: [PATCH 38/41] Jenkinsfile updated with stages --- deployment-service.yaml | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/deployment-service.yaml b/deployment-service.yaml index c735026a..bf33ad2e 100644 --- a/deployment-service.yaml +++ b/deployment-service.yaml @@ -1,36 +1,19 @@ apiVersion: apps/v1 -kind: Deployment # Kubernetes resource kind we are creating +kind: Deployment metadata: - name: boardgame-deployment + name: to-do-app spec: + replicas: 1 selector: matchLabels: - app: boardgame - replicas: 2 # Number of replicas that will be created for this deployment + app: to-do-app template: metadata: labels: - app: boardgame + app: to-do-app spec: containers: - - name: boardgame - image: adijaiswal/boardshack:latest # Image that will be used to containers in the cluster - imagePullPolicy: Always - ports: - - containerPort: 8080 # The port that the container is running on in the cluster - - ---- - -apiVersion: v1 # Kubernetes API version -kind: Service # Kubernetes resource kind we are creating -metadata: # Metadata of the resource kind we are creating - name: boardgame-ssvc -spec: - selector: - app: boardgame - ports: - - protocol: "TCP" - port: 80 - targetPort: 8080 - type: LoadBalancer # type of the service. + - name: to-do-app + image: himanshujangid/boardgame-app:latest + ports: + - containerPort: 8080 From 40231a464a400f2c49dfd951ed216d5dd5ffc0fd Mon Sep 17 00:00:00 2001 From: Savirean07 Date: Tue, 5 Aug 2025 00:46:13 +0530 Subject: [PATCH 39/41] Jenkinsfile updated with stages --- deployment-service.yaml => deployment-service.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename deployment-service.yaml => deployment-service.yml (100%) diff --git a/deployment-service.yaml b/deployment-service.yml similarity index 100% rename from deployment-service.yaml rename to deployment-service.yml From f3c2ca8fd6702a06620414a51818f9330dade08b Mon Sep 17 00:00:00 2001 From: Himanshu Jangid <72200563+Savirean07@users.noreply.github.com> Date: Thu, 7 Aug 2025 00:22:21 +0530 Subject: [PATCH 40/41] Update Jenkinsfile --- Jenkinsfile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b835692c..864bb19f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,17 +7,17 @@ pipeline { } environment { - registry = "https://trialosfhow.jfrog.io" // Replace with your actual JFrog base URL (without /artifactory) - IMAGE_NAME = "himanshujangid/boardgame-app" + registry = "https://jfrog.io" // Replace with your actual JFrog base URL (without /artifactory) + IMAGE_NAME = "Image Name" // replace with your Docker image name IMAGE_TAG = "latest" - PATH = "/opt/sonar-scanner/bin:$PATH" + PATH = "/opt/sonar-scanner/bin:$PATH" // Replace with your Image path } stages { stage('Checkout Code') { steps { echo 'Cloning repository...' - git url: 'https://github.com/Savirean07/Boardgame.git', branch: 'main' + git url: 'https://github.com.git', branch: 'main' // Replace with your git repo URl } } @@ -39,7 +39,7 @@ pipeline { steps { echo 'Checking sonar-scanner path and version...' sh 'echo $PATH' - sh 'which sonar-scanner || echo "sonar-scanner not found!"' + sh 'which sonar-scanner || echo "sonar-scanner not found!"' // jenkins Sonar scanner Creds sh 'sonar-scanner --version || echo "Version check failed!"' } } @@ -47,7 +47,7 @@ pipeline { stage('Sonar Analysis') { steps { echo 'Running SonarQube analysis...' - withSonarQubeEnv('sonarqube') { + withSonarQubeEnv('sonarqube') { // Replace with your Jenkins sonarqube creds name sh ''' sonar-scanner \ -Dsonar.projectKey=Boardgame \ @@ -144,7 +144,7 @@ pipeline { script { echo 'Docker Push to Azure Container Registry started' - def acrRegistry = 'todo1-fravf4hkffbshdbc.azurecr.io' + def acrRegistry = '' // Place your registry name here def acrImage = "${acrRegistry}/to-do-app:${IMAGE_TAG}" sh "docker tag ${IMAGE_NAME}:${IMAGE_TAG} ${acrImage}" From 798dd436f64d1c0a3e7b609cb692b2817af3519d Mon Sep 17 00:00:00 2001 From: Himanshu Jangid <72200563+Savirean07@users.noreply.github.com> Date: Thu, 7 Aug 2025 00:23:04 +0530 Subject: [PATCH 41/41] Update deployment-service.yml --- deployment-service.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment-service.yml b/deployment-service.yml index bf33ad2e..9359bfe8 100644 --- a/deployment-service.yml +++ b/deployment-service.yml @@ -1,7 +1,7 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: to-do-app + name: to-do-app spec: replicas: 1 selector: