From 54b7e4117be50a9842dd1262bd67db12209e1205 Mon Sep 17 00:00:00 2001 From: BharathKumarS23121995 <139286572+BharathKumarS23121995@users.noreply.github.com> Date: Sat, 8 Feb 2025 01:52:12 +0530 Subject: [PATCH 01/16] Update HelloWorld.java --- src/main/java/HelloWorld.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/HelloWorld.java b/src/main/java/HelloWorld.java index 2f1fbd86..c2e9ae33 100644 --- a/src/main/java/HelloWorld.java +++ b/src/main/java/HelloWorld.java @@ -1,8 +1,8 @@ -import spark.servlet.SparkApplication; +// import spark.servlet.SparkApplication; -import static spark.Spark.get; +// import static spark.Spark.get; -public class HelloWorld implements SparkApplication { +// public class HelloWorld implements SparkApplication { public static void main(String[] args) { new HelloWorld().init(); } From 0b45fb1aac1eb7e28f8ee56b95e176885edc24bc Mon Sep 17 00:00:00 2001 From: BharathKumarS23121995 <139286572+BharathKumarS23121995@users.noreply.github.com> Date: Sat, 8 Feb 2025 01:57:01 +0530 Subject: [PATCH 02/16] Update HelloWorld.java --- src/main/java/HelloWorld.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/HelloWorld.java b/src/main/java/HelloWorld.java index c2e9ae33..2f1fbd86 100644 --- a/src/main/java/HelloWorld.java +++ b/src/main/java/HelloWorld.java @@ -1,8 +1,8 @@ -// import spark.servlet.SparkApplication; +import spark.servlet.SparkApplication; -// import static spark.Spark.get; +import static spark.Spark.get; -// public class HelloWorld implements SparkApplication { +public class HelloWorld implements SparkApplication { public static void main(String[] args) { new HelloWorld().init(); } From 411290d4ea19e406083d4bd84f87f10510d18390 Mon Sep 17 00:00:00 2001 From: BharathKumarS23121995 <139286572+BharathKumarS23121995@users.noreply.github.com> Date: Wed, 12 Feb 2025 01:05:59 +0530 Subject: [PATCH 03/16] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8d7640e7..086dce42 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # sparkjava-war-example Build war with maven and sparkjava framework -Steps: +Steps:- 1. Download a fresh [Tomcat 8 distribution](https://tomcat.apache.org/download-80.cgi) 2. Clone this repository to your local machine From d66ce29d59d8d4d9119988fb730bcaf9cac067e3 Mon Sep 17 00:00:00 2001 From: BharathKumarS23121995 <139286572+BharathKumarS23121995@users.noreply.github.com> Date: Wed, 12 Feb 2025 01:06:36 +0530 Subject: [PATCH 04/16] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 086dce42..c183db97 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # sparkjava-war-example Build war with maven and sparkjava framework -Steps:- +Steps:-- 1. Download a fresh [Tomcat 8 distribution](https://tomcat.apache.org/download-80.cgi) 2. Clone this repository to your local machine From bb53e984d65bcd21890d8ca6780a03a1195c7c7f Mon Sep 17 00:00:00 2001 From: BharathKumarS23121995 <139286572+BharathKumarS23121995@users.noreply.github.com> Date: Wed, 12 Feb 2025 01:10:54 +0530 Subject: [PATCH 05/16] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c183db97..086dce42 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # sparkjava-war-example Build war with maven and sparkjava framework -Steps:-- +Steps:- 1. Download a fresh [Tomcat 8 distribution](https://tomcat.apache.org/download-80.cgi) 2. Clone this repository to your local machine From c18e90bd5cba26573d3d13747547685bea2edc9e Mon Sep 17 00:00:00 2001 From: bharath Date: Mon, 17 Feb 2025 20:30:17 +0000 Subject: [PATCH 06/16] sonar-properties --- sonar-project.properties | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 sonar-project.properties diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 00000000..3d090159 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,22 @@ +# Required metadata +sonar.verbose=true +sonar.organization=Bharathkumars +sonar.projectKey=bharathkumars-key_bharathtrend +sonar.projectName=bharathtrend +sonar.projectVersion=1.0 + +# Path settings +sonar.sources=src +#sonar.tests=tests +sonar.language=java +sonar.java.binaries=target/classes + +# Optional settings +sonar.sourceEncoding=UTF-8 +#sonar.exclusions=**/*.json,**/*.xml +sonar.test.inclusions=**/*Test.java + +# Coverage (if using Jacoco) +#sonar.jacoco.reportPaths=target/jacoco.exec +sonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml + From 4609722905f4cfd7af963389d877cd4c6884c6d7 Mon Sep 17 00:00:00 2001 From: bharath Date: Mon, 17 Feb 2025 21:05:26 +0000 Subject: [PATCH 07/16] jenkinsfile --- Jenkinsfile | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..385e4c3c --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,26 @@ +pipeline{ + + agent any + environment{ + PATH="/opt/maven/bin:$PATH" + } + stages{ + stage('Build'){ + steps{ + sh 'mvn clean deploy' + } + } + stage('sonarQube analysis'){ + environment{ + scannerHome=tool 'bharath-sonarqube-scanner' + } + steps{ + withSonarQubeEnv('Bharath-SonarQube-Server'){ + sh "${sonarHome}/bin/sonar-scanner" + } + } + } + } + } + + From fa3df699807c348cbd13d7cf7f324b08fd92555a Mon Sep 17 00:00:00 2001 From: BharathKumarS23121995 <139286572+BharathKumarS23121995@users.noreply.github.com> Date: Tue, 18 Feb 2025 08:25:09 +0530 Subject: [PATCH 08/16] Update pom.xml --- pom.xml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f55768d8..3b883372 100644 --- a/pom.xml +++ b/pom.xml @@ -24,6 +24,12 @@ + + org.apache.maven.plugins + maven-deploy-plugin + 3.1.2 + + org.apache.maven.plugins maven-compiler-plugin @@ -57,4 +63,4 @@ - \ No newline at end of file + From 81911788dc320ba1c1cf83659fcb2ec01a0c173b Mon Sep 17 00:00:00 2001 From: BharathKumarS23121995 <139286572+BharathKumarS23121995@users.noreply.github.com> Date: Tue, 18 Feb 2025 08:27:54 +0530 Subject: [PATCH 09/16] Update pom.xml --- pom.xml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/pom.xml b/pom.xml index 3b883372..367eeb27 100644 --- a/pom.xml +++ b/pom.xml @@ -24,12 +24,6 @@ - - org.apache.maven.plugins - maven-deploy-plugin - 3.1.2 - - org.apache.maven.plugins maven-compiler-plugin From 3d5406958933f012a5bf31d059a4147d4b1f4558 Mon Sep 17 00:00:00 2001 From: BharathKumarS23121995 <139286572+BharathKumarS23121995@users.noreply.github.com> Date: Tue, 18 Feb 2025 08:28:08 +0530 Subject: [PATCH 10/16] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 385e4c3c..a3ae3327 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,7 +7,7 @@ pipeline{ stages{ stage('Build'){ steps{ - sh 'mvn clean deploy' + sh 'mvn clean install' } } stage('sonarQube analysis'){ From cd4d9ba83ad12e0169b9cd86da0109ef88215c8e Mon Sep 17 00:00:00 2001 From: BharathKumarS23121995 <139286572+BharathKumarS23121995@users.noreply.github.com> Date: Tue, 18 Feb 2025 08:29:17 +0530 Subject: [PATCH 11/16] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index a3ae3327..1c7fa431 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ pipeline{ } steps{ withSonarQubeEnv('Bharath-SonarQube-Server'){ - sh "${sonarHome}/bin/sonar-scanner" + sh "${scannerHome}/bin/sonar-scanner" } } } From 1470f18c6a26cdcb42f157b666fccece80140fc2 Mon Sep 17 00:00:00 2001 From: BharathKumarS23121995 <139286572+BharathKumarS23121995@users.noreply.github.com> Date: Tue, 18 Feb 2025 08:33:08 +0530 Subject: [PATCH 12/16] Update sonar-project.properties --- sonar-project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-project.properties b/sonar-project.properties index 3d090159..5ab2bead 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,6 +1,6 @@ # Required metadata sonar.verbose=true -sonar.organization=Bharathkumars +sonar.organization=bharathkumars-key sonar.projectKey=bharathkumars-key_bharathtrend sonar.projectName=bharathtrend sonar.projectVersion=1.0 From 654bc5e3e17c4e23e2b5b692adaa41b36b2da191 Mon Sep 17 00:00:00 2001 From: BharathKumarS23121995 <139286572+BharathKumarS23121995@users.noreply.github.com> Date: Tue, 18 Feb 2025 08:49:47 +0530 Subject: [PATCH 13/16] Update Jenkinsfile --- Jenkinsfile | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 1c7fa431..6a089ec7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,6 +20,18 @@ pipeline{ } } } + stage("Quality Gate"){ + steps{ + script{ + timeout(time:1,unit:'Hours'){ + def qg=waitforQualityGate() + if (qg.status != 'ok'){ + error "pipeline aborted due to quality gate failure: ${qg.status}" + } + } + } + } + } } } From 84a45b8b51609b7128f6d700c2af3bc2530aec79 Mon Sep 17 00:00:00 2001 From: BharathKumarS23121995 <139286572+BharathKumarS23121995@users.noreply.github.com> Date: Tue, 18 Feb 2025 08:54:47 +0530 Subject: [PATCH 14/16] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6a089ec7..80c64cbe 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -26,7 +26,7 @@ pipeline{ timeout(time:1,unit:'Hours'){ def qg=waitforQualityGate() if (qg.status != 'ok'){ - error "pipeline aborted due to quality gate failure: ${qg.status}" + echo " warning pipeline aborted due to quality gate failure: ${qg.status}" } } } From e01aab1c1c43a3aca4e4e5d5ca87331d32b80659 Mon Sep 17 00:00:00 2001 From: BharathKumarS23121995 <139286572+BharathKumarS23121995@users.noreply.github.com> Date: Tue, 18 Feb 2025 08:59:01 +0530 Subject: [PATCH 15/16] Update Jenkinsfile --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 80c64cbe..ea96379c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -23,9 +23,9 @@ pipeline{ stage("Quality Gate"){ steps{ script{ - timeout(time:1,unit:'Hours'){ - def qg=waitforQualityGate() - if (qg.status != 'ok'){ + timeout(time:1,unit:'hours'){ + def qg=waitForQualityGate() + if (qg.status != 'OK'){ echo " warning pipeline aborted due to quality gate failure: ${qg.status}" } } From 741c121d778612d04e9675b5f6cc5f5412fc1807 Mon Sep 17 00:00:00 2001 From: BharathKumarS23121995 <139286572+BharathKumarS23121995@users.noreply.github.com> Date: Tue, 18 Feb 2025 09:01:55 +0530 Subject: [PATCH 16/16] Update Jenkinsfile --- Jenkinsfile | 75 ++++++++++++++++++++++++++--------------------------- 1 file changed, 37 insertions(+), 38 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ea96379c..033a524b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,38 +1,37 @@ -pipeline{ - - agent any - environment{ - PATH="/opt/maven/bin:$PATH" - } - stages{ - stage('Build'){ - steps{ - sh 'mvn clean install' - } - } - stage('sonarQube analysis'){ - environment{ - scannerHome=tool 'bharath-sonarqube-scanner' - } - steps{ - withSonarQubeEnv('Bharath-SonarQube-Server'){ - sh "${scannerHome}/bin/sonar-scanner" - } - } - } - stage("Quality Gate"){ - steps{ - script{ - timeout(time:1,unit:'hours'){ - def qg=waitForQualityGate() - if (qg.status != 'OK'){ - echo " warning pipeline aborted due to quality gate failure: ${qg.status}" - } - } - } - } - } - } - } - - +pipeline { + agent any + environment { + PATH = "/opt/maven/bin:$PATH" + } + stages { + stage('Build') { + steps { + sh 'mvn clean install' + } + } + + stage('SonarQube Analysis') { + environment { + scannerHome = tool 'bharath-sonarqube-scanner' + } + steps { + withSonarQubeEnv('Bharath-SonarQube-Server') { + sh "${scannerHome}/bin/sonar-scanner" + } + } + } + + stage('Quality Gate') { + steps { + script { + timeout(time: 1, unit: 'hours') { // Corrected 'Hours' -> 'hours' + def qg = waitForQualityGate() // Fixed function name + if (qg.status != 'OK') { // Ensure 'OK' is capitalized correctly + error "Pipeline aborted due to Quality Gate failure: ${qg.status}" + } + } + } + } + } + } +}