From e700da41f7727ab4c7a13353cf6d0e37ba13a2cd Mon Sep 17 00:00:00 2001 From: suhasinish05 Date: Fri, 9 May 2025 19:04:40 +0530 Subject: [PATCH 01/11] Create test-poll --- test-poll | 1 + 1 file changed, 1 insertion(+) create mode 100644 test-poll diff --git a/test-poll b/test-poll new file mode 100644 index 0000000..ccdc5e4 --- /dev/null +++ b/test-poll @@ -0,0 +1 @@ +testing poll scm From 6bdbc528f1fc9ee42a454c8dfcdf25686b0bcff5 Mon Sep 17 00:00:00 2001 From: suhasinish05 Date: Fri, 9 May 2025 19:10:13 +0530 Subject: [PATCH 02/11] Update test-poll --- test-poll | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-poll b/test-poll index ccdc5e4..8b13789 100644 --- a/test-poll +++ b/test-poll @@ -1 +1 @@ -testing poll scm + From 8a83d7016e833d4c307fd19bc70f69854614d599 Mon Sep 17 00:00:00 2001 From: suhasinish05 Date: Fri, 9 May 2025 19:18:28 +0530 Subject: [PATCH 03/11] Update test-poll --- test-poll | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-poll b/test-poll index 8b13789..e8bc738 100644 --- a/test-poll +++ b/test-poll @@ -1 +1 @@ - +testing webhook From bb0936542181242379e5554852853a5aeed49db1 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Fri, 9 May 2025 13:57:20 +0000 Subject: [PATCH 04/11] adding testing file --- dummy.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 dummy.txt diff --git a/dummy.txt b/dummy.txt new file mode 100644 index 0000000..3a5af19 --- /dev/null +++ b/dummy.txt @@ -0,0 +1 @@ +ting purpose From 5a59fb2594d6d43bb7aa33ff0e89912c0635ed9e Mon Sep 17 00:00:00 2001 From: suhasinish05 Date: Thu, 15 May 2025 01:38:37 +0530 Subject: [PATCH 05/11] Update pom.xml --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ccaa92c..f83091e 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ com.example jenkins-test - 2.0 + 2.14 jenkins-test Demo for jenkins From c1af91bae3aeaa9b69e7833b74c2d033d1ee63b8 Mon Sep 17 00:00:00 2001 From: suhasinish05 Date: Thu, 15 May 2025 01:42:34 +0530 Subject: [PATCH 06/11] Update pom.xml --- pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f83091e..62153c6 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,8 @@ com.example jenkins-test - 2.14 + 3.0 + 3.1 jenkins-test Demo for jenkins From 82f4ce731e13473fb9aaee0d64d59d43d9d99a8b Mon Sep 17 00:00:00 2001 From: suhasinish05 Date: Thu, 15 May 2025 01:43:26 +0530 Subject: [PATCH 07/11] Update pom.xml --- pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/pom.xml b/pom.xml index 62153c6..55674ff 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,6 @@ com.example jenkins-test 3.0 - 3.1 jenkins-test Demo for jenkins From 31c2e47aea5a33bfc91a0651d872e77baec31e03 Mon Sep 17 00:00:00 2001 From: suhasinish05 Date: Thu, 15 May 2025 03:21:13 +0530 Subject: [PATCH 08/11] Create Testfile --- Testfile | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 Testfile diff --git a/Testfile b/Testfile new file mode 100644 index 0000000..d765e51 --- /dev/null +++ b/Testfile @@ -0,0 +1,70 @@ +pipeline { + agent any + + environment { + SONARQUBE_SERVER = 'MySonarQubeServer' // name configured in Jenkins -> Manage Jenkins -> Configure System + } + + stages { + + stage('Checkout from Git') { + steps { + git 'https://github.com/suhasinish05/example-java.git' + } + } + + stage('Build') { + steps { + sh 'mvn clean compile' + } + } + + /* stage('Unit Test (JUnit)') { + steps { + sh 'mvn test' + junit '**/target/surefire-reports/*.xml' // Publish JUnit results + } + } */ + + stage('SonarQube Analysis') { + steps { + withSonarQubeEnv("${SONARQUBE_SERVER}") { + catchError(buildResult: 'SUCCESS', stageResult: 'UNSTABLE') { + sh 'mvn sonar:sonar' + } + } + } + } + + stage('Quality Gate Check') { + steps { + timeout(time: 1, unit: 'MINUTES') { + script { + def qg = waitForQualityGate() + if (qg.status != 'OK') { + echo "Quality Gate failed: ${qg.status}" + currentBuild.result = 'UNSTABLE' + } + } + } + } + } + + stage('Deploy (Dev Environment)') { + steps { + echo 'Deploying to development server...' + // Add your deployment script or commands here + sh 'echo "Deployment Done"' + } + } + } + + post { + always { + echo 'Pipeline finished!' + } + failure { + echo 'Build failed! Check logs.' + } + } +} From 7674c04642be0f627b1318a8811a7edbbb1c4cac Mon Sep 17 00:00:00 2001 From: suhasinish05 Date: Thu, 15 May 2025 03:22:08 +0530 Subject: [PATCH 09/11] Update Testfile --- Testfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Testfile b/Testfile index d765e51..4a6f644 100644 --- a/Testfile +++ b/Testfile @@ -19,12 +19,12 @@ pipeline { } } - /* stage('Unit Test (JUnit)') { + stage('Unit Test (JUnit)') { steps { sh 'mvn test' junit '**/target/surefire-reports/*.xml' // Publish JUnit results } - } */ + } stage('SonarQube Analysis') { steps { From c59bc417e0bc6a16b1708c33ad5c36c0429053e0 Mon Sep 17 00:00:00 2001 From: suhasinish05 Date: Thu, 15 May 2025 03:24:30 +0530 Subject: [PATCH 10/11] Update Testfile --- Testfile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Testfile b/Testfile index 4a6f644..1b79574 100644 --- a/Testfile +++ b/Testfile @@ -1,15 +1,13 @@ pipeline { agent any - environment { - SONARQUBE_SERVER = 'MySonarQubeServer' // name configured in Jenkins -> Manage Jenkins -> Configure System - } + stages { stage('Checkout from Git') { steps { - git 'https://github.com/suhasinish05/example-java.git' + git branch : main , url: 'https://github.com/suhasinish05/example-java.git' } } From c9bc80da6784fd1d4a30ea883c38d49409397998 Mon Sep 17 00:00:00 2001 From: suhasinish05 Date: Thu, 15 May 2025 03:26:21 +0530 Subject: [PATCH 11/11] Update Testfile --- Testfile | 78 ++++++++++++-------------------------------------------- 1 file changed, 17 insertions(+), 61 deletions(-) diff --git a/Testfile b/Testfile index 1b79574..12b29a0 100644 --- a/Testfile +++ b/Testfile @@ -1,68 +1,24 @@ -pipeline { - agent any - - - - stages { - - stage('Checkout from Git') { - steps { - git branch : main , url: 'https://github.com/suhasinish05/example-java.git' +pipeline{ + agent {label 'sonar'} + stages{ + /*stage('Git Checkout Stage'){ + steps{ + git branch: 'main', url: 'https://github.com/tranju664/Sonar-Qube-war-example.git' } - } - - stage('Build') { - steps { - sh 'mvn clean compile' - } - } - - stage('Unit Test (JUnit)') { - steps { - sh 'mvn test' - junit '**/target/surefire-reports/*.xml' // Publish JUnit results + }*/ + stage('Build Stage'){ + steps{ + sh 'mvn clean install' + sh hell } - } - - stage('SonarQube Analysis') { - steps { - withSonarQubeEnv("${SONARQUBE_SERVER}") { - catchError(buildResult: 'SUCCESS', stageResult: 'UNSTABLE') { - sh 'mvn sonar:sonar' - } - } - } - } - - stage('Quality Gate Check') { - steps { - timeout(time: 1, unit: 'MINUTES') { - script { - def qg = waitForQualityGate() - if (qg.status != 'OK') { - echo "Quality Gate failed: ${qg.status}" - currentBuild.result = 'UNSTABLE' - } - } + } + stage('SonarQube Analysis Stage') { + steps{ + withSonarQubeEnv('sonardemo') { + catchError(buildResult: 'SUCCESS', stageResult: 'UNSTABLE') { + sh "mvn clean verify sonar:sonar -Dsonar.projectKey=sonardemo" } } } - - stage('Deploy (Dev Environment)') { - steps { - echo 'Deploying to development server...' - // Add your deployment script or commands here - sh 'echo "Deployment Done"' - } - } - } - - post { - always { - echo 'Pipeline finished!' - } - failure { - echo 'Build failed! Check logs.' - } } }