From c7905211050af218e6269444f60a6174ceb33dd1 Mon Sep 17 00:00:00 2001 From: Kumarbn206 Date: Tue, 13 Jun 2023 14:00:47 +0530 Subject: [PATCH 01/19] added by jenkins pipeline --- Jenkinsfilebyme | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Jenkinsfilebyme diff --git a/Jenkinsfilebyme b/Jenkinsfilebyme new file mode 100644 index 0000000..e69de29 From 7d891b535adfabc6e5cd2961f63c068f3e4209a3 Mon Sep 17 00:00:00 2001 From: Kumarbn206 Date: Tue, 13 Jun 2023 14:04:25 +0530 Subject: [PATCH 02/19] added jenkinsby me file content --- Jenkinsfilebyme | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Jenkinsfilebyme b/Jenkinsfilebyme index e69de29..f56f828 100644 --- a/Jenkinsfilebyme +++ b/Jenkinsfilebyme @@ -0,0 +1,18 @@ +pipeline { + agent { + node { + label 'maven-agent' + } + } + +environment { + PATH = "/opt/apache-maven-3.9.2:$PATH" +} + stages { + stage(){ + steps{ + sh 'mvn clean deploy' + } + } + } +} \ No newline at end of file From 55ac4d381ed8e926c812b1310b67641461c21761 Mon Sep 17 00:00:00 2001 From: Kumarbn206 Date: Tue, 13 Jun 2023 14:05:32 +0530 Subject: [PATCH 03/19] added jenkinsb --- Jenkinsfilebyme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfilebyme b/Jenkinsfilebyme index f56f828..b35346d 100644 --- a/Jenkinsfilebyme +++ b/Jenkinsfilebyme @@ -9,7 +9,7 @@ environment { PATH = "/opt/apache-maven-3.9.2:$PATH" } stages { - stage(){ + stage('build the code'){ steps{ sh 'mvn clean deploy' } From b7307a2b8cc4a8cc29cf369325ddb9c197c4f1e9 Mon Sep 17 00:00:00 2001 From: kumarbn206 <113984452+kumarbn206@users.noreply.github.com> Date: Tue, 13 Jun 2023 14:08:57 +0530 Subject: [PATCH 04/19] added bin folder --- Jenkinsfilebyme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfilebyme b/Jenkinsfilebyme index b35346d..b8b5935 100644 --- a/Jenkinsfilebyme +++ b/Jenkinsfilebyme @@ -6,7 +6,7 @@ pipeline { } environment { - PATH = "/opt/apache-maven-3.9.2:$PATH" + PATH = "/opt/apache-maven-3.9.2/bin:$PATH" } stages { stage('build the code'){ @@ -15,4 +15,4 @@ environment { } } } -} \ No newline at end of file +} From b45ab125b0bf7cf00968827addb08da1f5f15525 Mon Sep 17 00:00:00 2001 From: Kumarbn206 Date: Tue, 13 Jun 2023 15:54:59 +0530 Subject: [PATCH 05/19] stored jenkins file under jenkins default file --- Jenkinsfile | 101 ++--------------------------------------- jenkinsdefaultfile | 111 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 97 deletions(-) create mode 100644 jenkinsdefaultfile diff --git a/Jenkinsfile b/Jenkinsfile index d123a85..154ed0d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,6 +1,3 @@ -def registry = 'https://valaxy01.jfrog.io' -def imageName = 'valaxy01.jfrog.io/valaxy-docker-local/ttrend' -def version = '2.1.2' pipeline { agent { node { @@ -9,103 +6,13 @@ pipeline { } environment { - PATH = "/opt/apache-maven-3.9.1/bin:$PATH" + PATH = "/opt/apache-maven-3.9.2/bin:$PATH" } stages { - stage('build'){ - steps { - echo '------------------- Build Started -------------' - sh 'mvn clean deploy -Dmaven.test.skip=true' - echo '------------------- Build Completed -------------' - } - } - - stage('Unit Test') { + stage('build the code'){ steps{ - echo '------------------- Unit Test Started -------------' - sh 'mvn surefire-report:report' - echo '------------------- Unit Test Completed -------------' + sh 'mvn clean deploy' } } - - stage('SonarQube analysis') { - environment { - scannerHome = tool 'Valaxy-SonarScanner' - } - steps { - echo '------------------- Sonar Started -------------' - withSonarQubeEnv('Valaxy-SonarQube-Server') { // If you have configured more than one global server connection, you can specify its name - sh "${scannerHome}/bin/sonar-scanner" - } - echo '------------------- Sonar Analysis Completed -------------' - } - } - stage("Quality Gate"){ - steps { - script { - timeout(time: 1, unit: 'HOURS') { // Just in case something goes wrong, pipeline will be killed after a timeout - def qg = waitForQualityGate() // Reuse taskId previously collected by withSonarQubeEnv - if (qg.status != 'OK') { - error "Pipeline aborted due to quality gate failure: ${qg.status}" - } - } -} - } - } - - stage("Jar Publish") { - steps { - script { - echo '<--------------- Jar Publish Started --------------->' - def server = Artifactory.newServer url:registry+"/artifactory" , credentialsId:"artifactory_token" - def properties = "buildid=${env.BUILD_ID},commitid=${GIT_COMMIT}"; - def uploadSpec = """{ - "files": [ - { - "pattern": "jarstaging/(*)", - "target": "libs-release-local/{1}", - "flat": "false", - "props" : "${properties}", - "exclusions": [ "*.sha1", "*.md5"] - } - ] - }""" - def buildInfo = server.upload(uploadSpec) - buildInfo.env.collect() - server.publishBuildInfo(buildInfo) - echo '<--------------- Jar Publish Ended --------------->' - - } - } } - stage(" Docker Build ") { - steps { - script { - echo '<--------------- Docker Build Started --------------->' - app = docker.build(imageName+":"+version) - echo '<--------------- Docker Build Ends --------------->' - } - } - } - stage (" Docker Publish "){ - steps { - script { - echo '<--------------- Docker Publish Started --------------->' - docker.withRegistry(registry, 'artifactory_token'){ - app.push() - } - echo '<--------------- Docker Publish Ended --------------->' - } - } - } - stage (" deployment "){ - steps { - script { - sh 'helm install ttrend-v2 ttrend-0.1.0.tgz' - } - } - } - -} -} - +} \ No newline at end of file diff --git a/jenkinsdefaultfile b/jenkinsdefaultfile new file mode 100644 index 0000000..d123a85 --- /dev/null +++ b/jenkinsdefaultfile @@ -0,0 +1,111 @@ +def registry = 'https://valaxy01.jfrog.io' +def imageName = 'valaxy01.jfrog.io/valaxy-docker-local/ttrend' +def version = '2.1.2' +pipeline { + agent { + node { + label 'maven-agent' + } + } + +environment { + PATH = "/opt/apache-maven-3.9.1/bin:$PATH" +} + stages { + stage('build'){ + steps { + echo '------------------- Build Started -------------' + sh 'mvn clean deploy -Dmaven.test.skip=true' + echo '------------------- Build Completed -------------' + } + } + + stage('Unit Test') { + steps{ + echo '------------------- Unit Test Started -------------' + sh 'mvn surefire-report:report' + echo '------------------- Unit Test Completed -------------' + } + } + + stage('SonarQube analysis') { + environment { + scannerHome = tool 'Valaxy-SonarScanner' + } + steps { + echo '------------------- Sonar Started -------------' + withSonarQubeEnv('Valaxy-SonarQube-Server') { // If you have configured more than one global server connection, you can specify its name + sh "${scannerHome}/bin/sonar-scanner" + } + echo '------------------- Sonar Analysis Completed -------------' + } + } + stage("Quality Gate"){ + steps { + script { + timeout(time: 1, unit: 'HOURS') { // Just in case something goes wrong, pipeline will be killed after a timeout + def qg = waitForQualityGate() // Reuse taskId previously collected by withSonarQubeEnv + if (qg.status != 'OK') { + error "Pipeline aborted due to quality gate failure: ${qg.status}" + } + } +} + } + } + + stage("Jar Publish") { + steps { + script { + echo '<--------------- Jar Publish Started --------------->' + def server = Artifactory.newServer url:registry+"/artifactory" , credentialsId:"artifactory_token" + def properties = "buildid=${env.BUILD_ID},commitid=${GIT_COMMIT}"; + def uploadSpec = """{ + "files": [ + { + "pattern": "jarstaging/(*)", + "target": "libs-release-local/{1}", + "flat": "false", + "props" : "${properties}", + "exclusions": [ "*.sha1", "*.md5"] + } + ] + }""" + def buildInfo = server.upload(uploadSpec) + buildInfo.env.collect() + server.publishBuildInfo(buildInfo) + echo '<--------------- Jar Publish Ended --------------->' + + } + } + } + stage(" Docker Build ") { + steps { + script { + echo '<--------------- Docker Build Started --------------->' + app = docker.build(imageName+":"+version) + echo '<--------------- Docker Build Ends --------------->' + } + } + } + stage (" Docker Publish "){ + steps { + script { + echo '<--------------- Docker Publish Started --------------->' + docker.withRegistry(registry, 'artifactory_token'){ + app.push() + } + echo '<--------------- Docker Publish Ended --------------->' + } + } + } + stage (" deployment "){ + steps { + script { + sh 'helm install ttrend-v2 ttrend-0.1.0.tgz' + } + } + } + +} +} + From 942f4e2cacb836d64b04df8ea9c74a7b8f577445 Mon Sep 17 00:00:00 2001 From: kumarbn206 <113984452+kumarbn206@users.noreply.github.com> Date: Wed, 14 Jun 2023 13:17:55 +0530 Subject: [PATCH 06/19] no thankds --- Jenkinsfile | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 154ed0d..55d3f6c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,6 +5,7 @@ pipeline { } } + environment { PATH = "/opt/apache-maven-3.9.2/bin:$PATH" } @@ -14,5 +15,17 @@ environment { sh 'mvn clean deploy' } } + } + + stages("SonarQube Analysis"){ + environment { + scannerHome = tool 'sonarScanner' + } + steps + { + withSonarQubeEnv('sonarqube-server'){ + sh '${scannerHome}/bin/sonar-scanner' + } + } } -} \ No newline at end of file +} From e121e55580ed87467d7ef0b063ac4529cc75d88c Mon Sep 17 00:00:00 2001 From: kumarbn206 <113984452+kumarbn206@users.noreply.github.com> Date: Wed, 14 Jun 2023 13:22:17 +0530 Subject: [PATCH 07/19] Update Jenkinsfile --- Jenkinsfile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 55d3f6c..49333f9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,14 +10,16 @@ environment { PATH = "/opt/apache-maven-3.9.2/bin:$PATH" } stages { + stage('build the code'){ steps{ sh 'mvn clean deploy' } } - } - stages("SonarQube Analysis"){ + + + stage("SonarQube Analysis"){ environment { scannerHome = tool 'sonarScanner' } @@ -28,4 +30,9 @@ environment { } } } + + + } + + } From 85ee7ba09a07da93c03aec05575c75a2a47422ab Mon Sep 17 00:00:00 2001 From: kumarbn206 <113984452+kumarbn206@users.noreply.github.com> Date: Wed, 14 Jun 2023 13:27:55 +0530 Subject: [PATCH 08/19] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 49333f9..edaeb57 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,7 +21,7 @@ environment { stage("SonarQube Analysis"){ environment { - scannerHome = tool 'sonarScanner' + scannerHome = tool 'SonarScanner' } steps { From fc6a98c4791c7dff47132b29fffd3e6ec9780745 Mon Sep 17 00:00:00 2001 From: kumarbn206 <113984452+kumarbn206@users.noreply.github.com> Date: Wed, 14 Jun 2023 13:31:49 +0530 Subject: [PATCH 09/19] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index edaeb57..c21c806 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -25,7 +25,7 @@ environment { } steps { - withSonarQubeEnv('sonarqube-server'){ + withSonarQubeEnv('Sonarqube-server'){ sh '${scannerHome}/bin/sonar-scanner' } } From 6993191cc860780a68c3600f632aa9554b0d4503 Mon Sep 17 00:00:00 2001 From: kumarbn206 <113984452+kumarbn206@users.noreply.github.com> Date: Wed, 14 Jun 2023 14:03:09 +0530 Subject: [PATCH 10/19] Update sonar-project.properties --- sonar-project.properties | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sonar-project.properties b/sonar-project.properties index 4ac1b27..708879e 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,9 +1,9 @@ sonar.verbose=true -sonar.projectKey=valaxy-ttrend -sonar.organization=valaxy01 -sonar.projectName=twittertrend +sonar.projectKey=kummi-ttrend +sonar.organization=kummi +sonar.projectName=twitter_trend sonar.language=java sonar.sourceEncoding=UTF-8 sonar.sources=. sonar.java.binaries=target/classes -sonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml \ No newline at end of file +sonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml From 4c67ddb7d096976639d32255fce2915a189f9dcf Mon Sep 17 00:00:00 2001 From: Kumarbn206 Date: Wed, 14 Jun 2023 14:46:30 +0530 Subject: [PATCH 11/19] updated sonalgate --- Jenkinsfile | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index c21c806..3012d74 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,7 +13,17 @@ environment { stage('build the code'){ steps{ - sh 'mvn clean deploy' + echo '----------------------------------------------Build Started--------------------------' + sh 'mvn clean deploy -Dmaven-test-skip=true' + echo '----------------------------------------------Build Completed--------------------------' + } + } + + stage('Unit Test') { + steps{ + echo '----------------------------------------------Unit Test Started--------------------------' + sh 'mvn surefire-report:report' + echo '----------------------------------------------Unit Test Completed--------------------------' } } @@ -25,8 +35,10 @@ environment { } steps { + echo '----------------------------------------------SonarQube Started--------------------------' withSonarQubeEnv('Sonarqube-server'){ sh '${scannerHome}/bin/sonar-scanner' + echo '----------------------------------------------Sonarqube Analysis Completed--------------------------' } } } From a47ce17acf7d49b327988695191e210e4ac32b3a Mon Sep 17 00:00:00 2001 From: Kumarbn206 Date: Mon, 19 Jun 2023 12:10:49 +0530 Subject: [PATCH 12/19] changes made --- Jenkinsfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3012d74..3f6b0d4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,7 +5,6 @@ pipeline { } } - environment { PATH = "/opt/apache-maven-3.9.2/bin:$PATH" } From 510e88f6f05ef69c4e97d31eb7b9d712fe15663b Mon Sep 17 00:00:00 2001 From: Kumarbn206 Date: Mon, 19 Jun 2023 13:21:49 +0530 Subject: [PATCH 13/19] this is the main gate code --- Jenkinsfile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 3f6b0d4..6cd9513 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -42,6 +42,21 @@ environment { } } + + stage("Quality Gate"){ + steps{ + script{ + timeout(time: 1, unit: 'HOURS') { // Just in case something goes wrong, pipeline will be killed after a timeout + def qg = waitForQualityGate() // Reuse taskId previously collected by withSonarQubeEnv + if (qg.status != 'OK') { + error "Pipeline aborted due to quality gate failure: ${qg.status}" + } + } + } + } + +} + } From 6640f68249f0846a9ae662eba6baaa2dd1cc98ac Mon Sep 17 00:00:00 2001 From: Kumarbn206 Date: Mon, 19 Jun 2023 13:22:24 +0530 Subject: [PATCH 14/19] this is the main gatede --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6cd9513..b5317f7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -55,7 +55,7 @@ environment { } } -} + } } From 128d0afb3296135872beb6ab3e364c9b0bf90fd6 Mon Sep 17 00:00:00 2001 From: Kumarbn206 Date: Mon, 19 Jun 2023 13:39:01 +0530 Subject: [PATCH 15/19] this is the main --- Jenkinsfile | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b5317f7..2ffde34 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -43,19 +43,18 @@ environment { } - stage("Quality Gate"){ - steps{ - script{ - timeout(time: 1, unit: 'HOURS') { // Just in case something goes wrong, pipeline will be killed after a timeout - def qg = waitForQualityGate() // Reuse taskId previously collected by withSonarQubeEnv - if (qg.status != 'OK') { - error "Pipeline aborted due to quality gate failure: ${qg.status}" - } - } - } - } - - } + 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 a039b0cb2c8e1f90d3d92555355961b4f458e84f Mon Sep 17 00:00:00 2001 From: Kumarbn206 Date: Mon, 19 Jun 2023 15:48:17 +0530 Subject: [PATCH 16/19] jar publish code has been copied --- Jenkinsfile | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 2ffde34..c4c343f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,3 +1,4 @@ +def registry = 'https://kummi.jfrog.io/' pipeline { agent { node { @@ -56,6 +57,34 @@ environment { } } + + + stage("Jar Publish") { + steps { + script { + echo '<--------------- Jar Publish Started --------------->' + def server = Artifactory.newServer url:registry+"/artifactory" , credentialsId:"jfrog-artifact" + def properties = "buildid=${env.BUILD_ID},commitid=${GIT_COMMIT}"; + def uploadSpec = """{ + "files": [ + { + "pattern": "jarstaging/(*)", + "target": "libs-release-local/{1}", + "flat": "false", + "props" : "${properties}", + "exclusions": [ "*.sha1", "*.md5"] + } + ] + }""" + def buildInfo = server.upload(uploadSpec) + buildInfo.env.collect() + server.publishBuildInfo(buildInfo) + echo '<--------------- Jar Publish Ended --------------->' + + } + } + } + } From 714fba1e36b7f5d55e36e6a1516cd833cd522d72 Mon Sep 17 00:00:00 2001 From: Kumarbn206 Date: Wed, 21 Jun 2023 11:08:26 +0530 Subject: [PATCH 17/19] docker files are added --- Jenkinsfile | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index c4c343f..01cf841 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,4 +1,6 @@ def registry = 'https://kummi.jfrog.io/' +def imageName = 'kummi.jfrog.io/kummi-docker-local/ttrend' +def version = '2.0.2' pipeline { agent { node { @@ -83,7 +85,30 @@ environment { } } - } + } + + stage(" Docker Build ") { + steps { + script { + echo '<--------------- Docker Build Started --------------->' + app = docker.build(imageName+":"+version) + echo '<--------------- Docker Build Ends --------------->' + } + } + } + + + stage (" Docker Publish "){ + steps { + script { + echo '<--------------- Docker Publish Started --------------->' + docker.withRegistry(registry, 'jfrog-artifact'){ + app.push() + } + echo '<--------------- Docker Publish Ended --------------->' + } + } + } } From f300f3b0089cb2c0873887746ecc992ea91d3fac Mon Sep 17 00:00:00 2001 From: Kumarbn206 Date: Wed, 21 Jun 2023 11:14:22 +0530 Subject: [PATCH 18/19] added docker file --- Jenkinsfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 01cf841..f009045 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -61,6 +61,7 @@ environment { + stage("Jar Publish") { steps { script { @@ -98,6 +99,7 @@ environment { } + stage (" Docker Publish "){ steps { script { From 99b66c9639ee88f1f74b9e662aa7fae617e56baf Mon Sep 17 00:00:00 2001 From: kumarbn206 <113984452+kumarbn206@users.noreply.github.com> Date: Thu, 6 Mar 2025 22:49:44 +0530 Subject: [PATCH 19/19] add texts.txt file contains data --- texts.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 texts.txt diff --git a/texts.txt b/texts.txt new file mode 100644 index 0000000..9470ab7 --- /dev/null +++ b/texts.txt @@ -0,0 +1 @@ +my_new text