From 17900a6fa7c00c8859e9adf10bea5ad8ce30651b Mon Sep 17 00:00:00 2001 From: jubersheikh9284 <146079345+jubersheikh9284@users.noreply.github.com> Date: Mon, 4 Dec 2023 13:39:08 +0530 Subject: [PATCH 01/21] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 969d00c6e..52c2dbc08 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ pipeline { environment { NEXUS_VERSION = "nexus3" NEXUS_PROTOCOL = "http" - NEXUS_URL = "172.31.40.209:8081" + NEXUS_URL = ":172.31.88.918081" NEXUS_REPOSITORY = "vprofile-release" NEXUS_REPOGRP_ID = "vprofile-grp-repo" NEXUS_CREDENTIAL_ID = "nexuslogin" From b3969df4e0163b8e1d866f8f56c62cad0c01457a Mon Sep 17 00:00:00 2001 From: jubersheikh9284 <146079345+jubersheikh9284@users.noreply.github.com> Date: Mon, 4 Dec 2023 13:41:52 +0530 Subject: [PATCH 02/21] Update settings.xml --- settings.xml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/settings.xml b/settings.xml index eb788f017..21b54bb49 100644 --- a/settings.xml +++ b/settings.xml @@ -5,31 +5,31 @@ - ${SNAP-REPO} - ${NEXUS-USER} - ${NEXUS-PASS} + ${SNAP_REPO} + ${NEXUS_USER} + ${NEXUS_PASS} - ${RELEASE-REPO} - ${NEXUS-USER} - ${NEXUS-PASS} + ${RELEASE_REPO} + ${NEXUS_USER} + ${NEXUS_PASS} - ${CENTRAL-REPO} - ${NEXUS-USER} - ${NEXUS-PASS} + ${CENTRAL_REPO} + ${NEXUS_USER} + ${NEXUS_PASS} - ${NEXUS-GRP-REPO} - ${NEXUS-USER} - ${NEXUS-PASS} + ${NEXUS_GRP_REPO} + ${NEXUS_USER} + ${NEXUS_PASS} - ${CENTRAL-REPO} - ${CENTRAL-REPO} + ${CENTRAL_REPO} + ${CENTRAL_REPO} http://${NEXUSIP}:${NEXUSPORT}/repository/${NEXUS-GRP-REPO}/ * From f77d4dc16fd1d09fb5826dfd9e775aa32c480e85 Mon Sep 17 00:00:00 2001 From: jubersheikh9284 <146079345+jubersheikh9284@users.noreply.github.com> Date: Mon, 4 Dec 2023 13:43:13 +0530 Subject: [PATCH 03/21] Update settings.xml --- settings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings.xml b/settings.xml index 21b54bb49..ccaf6406c 100644 --- a/settings.xml +++ b/settings.xml @@ -30,7 +30,7 @@ ${CENTRAL_REPO} ${CENTRAL_REPO} - http://${NEXUSIP}:${NEXUSPORT}/repository/${NEXUS-GRP-REPO}/ + http://${NEXUSIP}:${NEXUSPORT}/repository/${NEXUS_RP_REPO}/ * From fc8b1e9af24b6f333e3320ec16286720ee1c4c97 Mon Sep 17 00:00:00 2001 From: jubersheikh9284 <146079345+jubersheikh9284@users.noreply.github.com> Date: Mon, 4 Dec 2023 13:46:15 +0530 Subject: [PATCH 04/21] Update pom.xml --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9579838c0..b9640ea63 100644 --- a/pom.xml +++ b/pom.xml @@ -211,7 +211,7 @@ ${NEXUS-GRP-REPO} - http://${NEXUSIP}:${NEXUSPORT}/repository/${NEXUS-GRP-REPO}/ + http://${NEXUSIP}:${NEXUSPORT}/repository/${NEXUS_GRP_REPO}/ From 2368f69db0916cc95f4d602ed94415325d41ba33 Mon Sep 17 00:00:00 2001 From: jubersheikh9284 <146079345+jubersheikh9284@users.noreply.github.com> Date: Mon, 4 Dec 2023 13:49:19 +0530 Subject: [PATCH 05/21] Update pom.xml --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b9640ea63..23b5b414c 100644 --- a/pom.xml +++ b/pom.xml @@ -210,7 +210,7 @@ - ${NEXUS-GRP-REPO} + ${NEXUS_GRP_REPO} http://${NEXUSIP}:${NEXUSPORT}/repository/${NEXUS_GRP_REPO}/ From c96d7cab8f392eb88ffa94fcd8aa63e1a1147a8e Mon Sep 17 00:00:00 2001 From: jubersheikh9284 <146079345+jubersheikh9284@users.noreply.github.com> Date: Mon, 4 Dec 2023 13:52:25 +0530 Subject: [PATCH 06/21] Update pom.xml --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 23b5b414c..b76fa60e5 100644 --- a/pom.xml +++ b/pom.xml @@ -211,7 +211,7 @@ ${NEXUS_GRP_REPO} - http://${NEXUSIP}:${NEXUSPORT}/repository/${NEXUS_GRP_REPO}/ + http://${NEXUSIP}:8081/repository/${NEXUS_GRP_REPO}/ From 8393fea1c54b6cfaed24cd04e32d4276cfb251a9 Mon Sep 17 00:00:00 2001 From: jubersheikh9284 <146079345+jubersheikh9284@users.noreply.github.com> Date: Mon, 4 Dec 2023 15:35:04 +0530 Subject: [PATCH 07/21] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 52c2dbc08..3d1e8cbdb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -56,7 +56,7 @@ pipeline { stage('CODE ANALYSIS with SONARQUBE') { environment { - scannerHome = tool 'sonarscanner4' + scannerHome = tool 'sonarscanner' } steps { From 53e19afd42b3e99c549bef834bbeef9ddd0fe22c Mon Sep 17 00:00:00 2001 From: jubersheikh9284 <146079345+jubersheikh9284@users.noreply.github.com> Date: Mon, 4 Dec 2023 16:00:23 +0530 Subject: [PATCH 08/21] Update Jenkinsfile --- Jenkinsfile | 126 +++++++++++++++++++--------------------------------- 1 file changed, 46 insertions(+), 80 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3d1e8cbdb..593755d73 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,26 +1,29 @@ pipeline { - - agent any -/* - tools { - maven "maven3" + agent any + + tools { + maven "MAVEN3" + jdk "OracleJDK8" } -*/ + environment { - NEXUS_VERSION = "nexus3" - NEXUS_PROTOCOL = "http" - NEXUS_URL = ":172.31.88.918081" - NEXUS_REPOSITORY = "vprofile-release" - NEXUS_REPOGRP_ID = "vprofile-grp-repo" - NEXUS_CREDENTIAL_ID = "nexuslogin" - ARTVERSION = "${env.BUILD_ID}" + SNAP_REPO = 'vprofile-snapshot' + NEXUS_USER = 'admin' + NEXUS_PASS = 'admin123' // Corrected line + RELEASE_REPO = 'vprofile-release' + CENTRAL_REPO = 'vpro-maven-central' + NEXUSIP = '172.31.88.91' + NEXUSPORT = '8081' + NEXUS_GRP_REPO = 'vpro-maven-group' + NEXUS_LOGIN = 'nexuslogin' + SONARSERVER = 'sonarserver' + SONARSCANNER = 'sonarscanner' } - - stages{ - - stage('BUILD'){ + + stages { + stage('BUILD') { steps { - sh 'mvn clean install -DskipTests' + sh 'mvn -s setting.xml -DskipTests install' } post { success { @@ -30,21 +33,15 @@ pipeline { } } - stage('UNIT TEST'){ + stage('UNIT TEST') { steps { - sh 'mvn test' + sh 'mvn -s setting.xml test' } } - stage('INTEGRATION TEST'){ - steps { - sh 'mvn verify -DskipUnitTests' - } - } - - stage ('CODE ANALYSIS WITH CHECKSTYLE'){ + stage('CODE ANALYSIS WITH CHECKSTYLE') { steps { - sh 'mvn checkstyle:checkstyle' + sh 'mvn -s setting.xml checkstyle:checkstyle' } post { success { @@ -54,68 +51,37 @@ pipeline { } stage('CODE ANALYSIS with SONARQUBE') { - - environment { - scannerHome = tool 'sonarscanner' - } - - steps { - withSonarQubeEnv('sonar-pro') { - sh '''${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=vprofile \ - -Dsonar.projectName=vprofile-repo \ - -Dsonar.projectVersion=1.0 \ - -Dsonar.sources=src/ \ - -Dsonar.java.binaries=target/test-classes/com/visualpathit/account/controllerTest/ \ - -Dsonar.junit.reportsPath=target/surefire-reports/ \ - -Dsonar.jacoco.reportsPath=target/jacoco.exec \ - -Dsonar.java.checkstyle.reportPaths=target/checkstyle-result.xml''' + environment { + scannerHome = tool 'SONARSCANNER' } - timeout(time: 10, unit: 'MINUTES') { - waitForQualityGate abortPipeline: true + steps { + withSonarQubeEnv('sonar-pro') { + sh '''${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=vprofile \ + -Dsonar.projectName=vprofile-repo \ + -Dsonar.projectVersion=1.0 \ + -Dsonar.sources=src/ \ + -Dsonar.java.binaries=target/test-classes/com/visualpathit/account/controllerTest/ \ + -Dsonar.junit.reportsPath=target/surefire-reports/ \ + -Dsonar.jacoco.reportsPath=target/jacoco.exec \ + -Dsonar.java.checkstyle.reportPaths=target/checkstyle-result.xml''' + } + + timeout(time: 10, unit: 'MINUTES') { + waitForQualityGate abortPipeline: true + } } - } } + // Uncomment and modify the following stage based on your requirements + /* stage("Publish to Nexus Repository Manager") { steps { script { - pom = readMavenPom file: "pom.xml"; - filesByGlob = findFiles(glob: "target/*.${pom.packaging}"); - echo "${filesByGlob[0].name} ${filesByGlob[0].path} ${filesByGlob[0].directory} ${filesByGlob[0].length} ${filesByGlob[0].lastModified}" - artifactPath = filesByGlob[0].path; - artifactExists = fileExists artifactPath; - if(artifactExists) { - echo "*** File: ${artifactPath}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version} ARTVERSION"; - nexusArtifactUploader( - nexusVersion: NEXUS_VERSION, - protocol: NEXUS_PROTOCOL, - nexusUrl: NEXUS_URL, - groupId: NEXUS_REPOGRP_ID, - version: ARTVERSION, - repository: NEXUS_REPOSITORY, - credentialsId: NEXUS_CREDENTIAL_ID, - artifacts: [ - [artifactId: pom.artifactId, - classifier: '', - file: artifactPath, - type: pom.packaging], - [artifactId: pom.artifactId, - classifier: '', - file: "pom.xml", - type: "pom"] - ] - ); - } - else { - error "*** File: ${artifactPath}, could not be found"; - } + // Your publishing to Nexus logic here } } } - - + */ } - - } From 77acd0b502762479d10e3a7afcd24e12c3170ea3 Mon Sep 17 00:00:00 2001 From: jubersheikh9284 <146079345+jubersheikh9284@users.noreply.github.com> Date: Mon, 4 Dec 2023 16:09:40 +0530 Subject: [PATCH 09/21] Update Jenkinsfile --- Jenkinsfile | 126 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 80 insertions(+), 46 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 593755d73..d03ea8eb1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,29 +1,26 @@ pipeline { - agent any - - tools { - maven "MAVEN3" - jdk "OracleJDK8" + + agent any +/* + tools { + maven "maven3" } - +*/ environment { - SNAP_REPO = 'vprofile-snapshot' - NEXUS_USER = 'admin' - NEXUS_PASS = 'admin123' // Corrected line - RELEASE_REPO = 'vprofile-release' - CENTRAL_REPO = 'vpro-maven-central' - NEXUSIP = '172.31.88.91' - NEXUSPORT = '8081' - NEXUS_GRP_REPO = 'vpro-maven-group' - NEXUS_LOGIN = 'nexuslogin' - SONARSERVER = 'sonarserver' - SONARSCANNER = 'sonarscanner' + NEXUS_VERSION = "nexus3" + NEXUS_PROTOCOL = "http" + NEXUS_URL = "172.31.88.91:8081" + NEXUS_REPOSITORY = "vprofile-release" + NEXUS_REPO_ID = "vprofile-release" + NEXUS_CREDENTIAL_ID = "nexuslogin" + ARTVERSION = "${env.BUILD_ID}" } - - stages { - stage('BUILD') { + + stages{ + + stage('BUILD'){ steps { - sh 'mvn -s setting.xml -DskipTests install' + sh 'mvn clean install -DskipTests' } post { success { @@ -33,15 +30,21 @@ pipeline { } } - stage('UNIT TEST') { + stage('UNIT TEST'){ steps { - sh 'mvn -s setting.xml test' + sh 'mvn test' } } - stage('CODE ANALYSIS WITH CHECKSTYLE') { + stage('INTEGRATION TEST'){ + steps { + sh 'mvn verify -DskipUnitTests' + } + } + + stage ('CODE ANALYSIS WITH CHECKSTYLE'){ steps { - sh 'mvn -s setting.xml checkstyle:checkstyle' + sh 'mvn checkstyle:checkstyle' } post { success { @@ -51,37 +54,68 @@ pipeline { } stage('CODE ANALYSIS with SONARQUBE') { - environment { - scannerHome = tool 'SONARSCANNER' - } + + environment { + scannerHome = tool 'sonarscanner4' + } - steps { - withSonarQubeEnv('sonar-pro') { - sh '''${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=vprofile \ - -Dsonar.projectName=vprofile-repo \ - -Dsonar.projectVersion=1.0 \ - -Dsonar.sources=src/ \ - -Dsonar.java.binaries=target/test-classes/com/visualpathit/account/controllerTest/ \ - -Dsonar.junit.reportsPath=target/surefire-reports/ \ - -Dsonar.jacoco.reportsPath=target/jacoco.exec \ - -Dsonar.java.checkstyle.reportPaths=target/checkstyle-result.xml''' - } + steps { + withSonarQubeEnv('sonar-pro') { + sh '''${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=vprofile \ + -Dsonar.projectName=vprofile-repo \ + -Dsonar.projectVersion=1.0 \ + -Dsonar.sources=src/ \ + -Dsonar.java.binaries=target/test-classes/com/visualpathit/account/controllerTest/ \ + -Dsonar.junit.reportsPath=target/surefire-reports/ \ + -Dsonar.jacoco.reportsPath=target/jacoco.exec \ + -Dsonar.java.checkstyle.reportPaths=target/checkstyle-result.xml''' + } - timeout(time: 10, unit: 'MINUTES') { - waitForQualityGate abortPipeline: true - } + timeout(time: 10, unit: 'MINUTES') { + waitForQualityGate abortPipeline: true } + } } - // Uncomment and modify the following stage based on your requirements - /* stage("Publish to Nexus Repository Manager") { steps { script { - // Your publishing to Nexus logic here + pom = readMavenPom file: "pom.xml"; + filesByGlob = findFiles(glob: "target/*.${pom.packaging}"); + echo "${filesByGlob[0].name} ${filesByGlob[0].path} ${filesByGlob[0].directory} ${filesByGlob[0].length} ${filesByGlob[0].lastModified}" + artifactPath = filesByGlob[0].path; + artifactExists = fileExists artifactPath; + if(artifactExists) { + echo "*** File: ${artifactPath}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version} ARTVERSION"; + nexusArtifactUploader( + nexusVersion: NEXUS_VERSION, + protocol: NEXUS_PROTOCOL, + nexusUrl: NEXUS_URL, + groupId: pom.groupId, + version: ARTVERSION, + repository: NEXUS_REPOSITORY, + credentialsId: NEXUS_CREDENTIAL_ID, + artifacts: [ + [artifactId: pom.artifactId, + classifier: '', + file: artifactPath, + type: pom.packaging], + [artifactId: pom.artifactId, + classifier: '', + file: "pom.xml", + type: "pom"] + ] + ); + } + else { + error "*** File: ${artifactPath}, could not be found"; + } } } } - */ + + } + + } From 7156828269bd144262df64c2afaf00ff6162fc41 Mon Sep 17 00:00:00 2001 From: jubersheikh9284 <146079345+jubersheikh9284@users.noreply.github.com> Date: Mon, 4 Dec 2023 16:16:56 +0530 Subject: [PATCH 10/21] Update Jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d03ea8eb1..dabc0f732 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -77,7 +77,7 @@ pipeline { } } - stage("Publish to Nexus Repository Manager") { + /* stage("Publish to Nexus Repository Manager") { steps { script { pom = readMavenPom file: "pom.xml"; @@ -112,7 +112,7 @@ pipeline { } } } - } + }*/ } From 1ada4ed873062c5f3f8c32ce4b3a67480fc23b62 Mon Sep 17 00:00:00 2001 From: jubersheikh9284 <146079345+jubersheikh9284@users.noreply.github.com> Date: Mon, 4 Dec 2023 16:19:11 +0530 Subject: [PATCH 11/21] Update Jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index dabc0f732..d03ea8eb1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -77,7 +77,7 @@ pipeline { } } - /* stage("Publish to Nexus Repository Manager") { + stage("Publish to Nexus Repository Manager") { steps { script { pom = readMavenPom file: "pom.xml"; @@ -112,7 +112,7 @@ pipeline { } } } - }*/ + } } From 37878038c7c07d1ae36a77bf9f19daa24173adf6 Mon Sep 17 00:00:00 2001 From: jubersheikh9284 <146079345+jubersheikh9284@users.noreply.github.com> Date: Mon, 4 Dec 2023 16:33:16 +0530 Subject: [PATCH 12/21] Update Jenkinsfile --- Jenkinsfile | 145 ++++++++++++++++++++++------------------------------ 1 file changed, 60 insertions(+), 85 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d03ea8eb1..ec1c60b93 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,121 +1,96 @@ pipeline { - - agent any -/* - tools { - maven "maven3" + agent any + tools { + maven "MAVEN3" + jdk "OracleJDK8" } -*/ + environment { - NEXUS_VERSION = "nexus3" - NEXUS_PROTOCOL = "http" - NEXUS_URL = "172.31.88.91:8081" - NEXUS_REPOSITORY = "vprofile-release" - NEXUS_REPO_ID = "vprofile-release" - NEXUS_CREDENTIAL_ID = "nexuslogin" - ARTVERSION = "${env.BUILD_ID}" + SNAP_REPO = 'vprofile-snapshot' + NEXUS_USER = 'admin' + NEXUS_PASS = 'admin123' + RELEASE_REPO = 'vprofile-release' + CENTRAL_REPO = 'vpro-maven-central' + NEXUSIP = '172.31.88.91' + NEXUSPORT = '8081' + NEXUS_GRP_REPO = 'vpro-maven-group' + NEXUS_LOGIN = 'nexuslogin' + SONARSERVER = 'sonarserver' + SONARSCANNER = 'sonarscanner' } - - stages{ - - stage('BUILD'){ + + stages { + stage('Build'){ steps { - sh 'mvn clean install -DskipTests' + sh 'mvn -s settings.xml -DskipTests install' } post { success { - echo 'Now Archiving...' - archiveArtifacts artifacts: '**/target/*.war' + echo "Now Archiving." + archiveArtifacts artifacts: '**/*.war' } } } - stage('UNIT TEST'){ + stage('Test'){ steps { - sh 'mvn test' + sh 'mvn -s settings.xml test' } - } - stage('INTEGRATION TEST'){ - steps { - sh 'mvn verify -DskipUnitTests' - } } - - stage ('CODE ANALYSIS WITH CHECKSTYLE'){ + + stage('Checkstyle Analysis'){ steps { - sh 'mvn checkstyle:checkstyle' - } - post { - success { - echo 'Generated Analysis Result' - } + sh 'mvn -s settings.xml checkstyle:checkstyle' } } - stage('CODE ANALYSIS with SONARQUBE') { - - environment { - scannerHome = tool 'sonarscanner4' - } - - steps { - withSonarQubeEnv('sonar-pro') { - sh '''${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=vprofile \ - -Dsonar.projectName=vprofile-repo \ + stage('Sonar Analysis') { + environment { + scannerHome = tool "${SONARSCANNER}" + } + steps { + withSonarQubeEnv("${SONARSERVER}") { + sh '''${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=vprofile \ + -Dsonar.projectName=vprofile \ -Dsonar.projectVersion=1.0 \ -Dsonar.sources=src/ \ -Dsonar.java.binaries=target/test-classes/com/visualpathit/account/controllerTest/ \ -Dsonar.junit.reportsPath=target/surefire-reports/ \ -Dsonar.jacoco.reportsPath=target/jacoco.exec \ -Dsonar.java.checkstyle.reportPaths=target/checkstyle-result.xml''' + } } - - timeout(time: 10, unit: 'MINUTES') { - waitForQualityGate abortPipeline: true - } - } } - stage("Publish to Nexus Repository Manager") { + stage("Quality Gate") { steps { - script { - pom = readMavenPom file: "pom.xml"; - filesByGlob = findFiles(glob: "target/*.${pom.packaging}"); - echo "${filesByGlob[0].name} ${filesByGlob[0].path} ${filesByGlob[0].directory} ${filesByGlob[0].length} ${filesByGlob[0].lastModified}" - artifactPath = filesByGlob[0].path; - artifactExists = fileExists artifactPath; - if(artifactExists) { - echo "*** File: ${artifactPath}, group: ${pom.groupId}, packaging: ${pom.packaging}, version ${pom.version} ARTVERSION"; - nexusArtifactUploader( - nexusVersion: NEXUS_VERSION, - protocol: NEXUS_PROTOCOL, - nexusUrl: NEXUS_URL, - groupId: pom.groupId, - version: ARTVERSION, - repository: NEXUS_REPOSITORY, - credentialsId: NEXUS_CREDENTIAL_ID, - artifacts: [ - [artifactId: pom.artifactId, - classifier: '', - file: artifactPath, - type: pom.packaging], - [artifactId: pom.artifactId, - classifier: '', - file: "pom.xml", - type: "pom"] - ] - ); - } - else { - error "*** File: ${artifactPath}, could not be found"; - } + timeout(time: 1, unit: 'HOURS') { + // Parameter indicates whether to set pipeline to UNSTABLE if Quality Gate fails + // true = set pipeline to UNSTABLE, false = don't + waitForQualityGate abortPipeline: true } } } - + stage("UploadArtifact"){ + steps{ + nexusArtifactUploader( + nexusVersion: 'nexus3', + protocol: 'http', + nexusUrl: "${NEXUSIP}:${NEXUSPORT}", + groupId: 'QA', + version: "${env.BUILD_ID}-${env.BUILD_TIMESTAMP}", + repository: "${RELEASE_REPO}", + credentialsId: "${NEXUS_LOGIN}", + artifacts: [ + [artifactId: 'vproapp', + classifier: '', + file: 'target/vprofile-v2.war', + type: 'war'] + ] + ) + } + } } - - } From fd65dfeaf22891976c745bfea73ea4caf8e8fc15 Mon Sep 17 00:00:00 2001 From: jubersheikh9284 <146079345+jubersheikh9284@users.noreply.github.com> Date: Mon, 4 Dec 2023 16:35:57 +0530 Subject: [PATCH 13/21] Update Jenkinsfile --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ec1c60b93..3d0ddfce4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -22,7 +22,7 @@ pipeline { stages { stage('Build'){ steps { - sh 'mvn -s settings.xml -DskipTests install' + sh 'mvn -DskipTests install' } post { success { @@ -34,14 +34,14 @@ pipeline { stage('Test'){ steps { - sh 'mvn -s settings.xml test' + sh 'mvn test' } } stage('Checkstyle Analysis'){ steps { - sh 'mvn -s settings.xml checkstyle:checkstyle' + sh 'mvn checkstyle:checkstyle' } } From de4438e470972410757e2cea0f8339625498bf2f Mon Sep 17 00:00:00 2001 From: jubersheikh9284 <146079345+jubersheikh9284@users.noreply.github.com> Date: Mon, 4 Dec 2023 16:46:50 +0530 Subject: [PATCH 14/21] Update Jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3d0ddfce4..f924e7db3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -63,7 +63,7 @@ pipeline { } } - stage("Quality Gate") { + /* stage("Quality Gate") { steps { timeout(time: 1, unit: 'HOURS') { // Parameter indicates whether to set pipeline to UNSTABLE if Quality Gate fails @@ -91,6 +91,6 @@ pipeline { ] ) } - } + }*/ } } From f7a2e18a64388259347207f9511cf0b6322930f9 Mon Sep 17 00:00:00 2001 From: jubersheikh9284 <146079345+jubersheikh9284@users.noreply.github.com> Date: Mon, 4 Dec 2023 16:50:40 +0530 Subject: [PATCH 15/21] Update Jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f924e7db3..4469d953c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -63,7 +63,7 @@ pipeline { } } - /* stage("Quality Gate") { + stage("Quality Gate") { steps { timeout(time: 1, unit: 'HOURS') { // Parameter indicates whether to set pipeline to UNSTABLE if Quality Gate fails @@ -73,7 +73,7 @@ pipeline { } } - stage("UploadArtifact"){ + /* stage("UploadArtifact"){ steps{ nexusArtifactUploader( nexusVersion: 'nexus3', From 7515d2b7676cc55205c3d9e37d3e821ef5ea6af9 Mon Sep 17 00:00:00 2001 From: jubersheikh9284 <146079345+jubersheikh9284@users.noreply.github.com> Date: Mon, 4 Dec 2023 16:55:44 +0530 Subject: [PATCH 16/21] Update Jenkinsfile --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index 4469d953c..22617ddf7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -72,6 +72,7 @@ pipeline { } } } + /* stage("UploadArtifact"){ steps{ From 580442c98f5ac10bdee26ae595297b2be0afd8cd Mon Sep 17 00:00:00 2001 From: jubersheikh9284 <146079345+jubersheikh9284@users.noreply.github.com> Date: Mon, 4 Dec 2023 16:57:40 +0530 Subject: [PATCH 17/21] Update Jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 22617ddf7..4908299e4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -74,7 +74,7 @@ pipeline { } - /* stage("UploadArtifact"){ + stage("UploadArtifact"){ steps{ nexusArtifactUploader( nexusVersion: 'nexus3', @@ -92,6 +92,6 @@ pipeline { ] ) } - }*/ + } } } From 2644178c3b9fe71b2f39770e20d3b2a43fdcdcda Mon Sep 17 00:00:00 2001 From: jubersheikh9284 <146079345+jubersheikh9284@users.noreply.github.com> Date: Tue, 5 Dec 2023 12:37:11 +0530 Subject: [PATCH 18/21] Update Jenkinsfile with slack --- Jenkinsfile | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4908299e4..89a4c7bea 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,3 +1,7 @@ +def COLOR_MAP = [ + 'SUCCESS': 'good', + 'FAILURE': 'danger', +] pipeline { agent any tools { @@ -11,7 +15,7 @@ pipeline { NEXUS_PASS = 'admin123' RELEASE_REPO = 'vprofile-release' CENTRAL_REPO = 'vpro-maven-central' - NEXUSIP = '172.31.88.91' + NEXUSIP = '172.31.5.4' NEXUSPORT = '8081' NEXUS_GRP_REPO = 'vpro-maven-group' NEXUS_LOGIN = 'nexuslogin' @@ -22,7 +26,7 @@ pipeline { stages { stage('Build'){ steps { - sh 'mvn -DskipTests install' + sh 'mvn -s settings.xml -DskipTests install' } post { success { @@ -34,14 +38,14 @@ pipeline { stage('Test'){ steps { - sh 'mvn test' + sh 'mvn -s settings.xml test' } } stage('Checkstyle Analysis'){ steps { - sh 'mvn checkstyle:checkstyle' + sh 'mvn -s settings.xml checkstyle:checkstyle' } } @@ -72,9 +76,8 @@ pipeline { } } } - - stage("UploadArtifact"){ + stage("UploadArtifact"){ steps{ nexusArtifactUploader( nexusVersion: 'nexus3', @@ -93,5 +96,14 @@ pipeline { ) } } + + } + post { + always { + echo 'Slack Notifications.' + slackSend channel: '#vprofilecicd', + color: COLOR_MAP[currentBuild.currentResult], + message: "*${currentBuild.currentResult}:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} \n More info at: ${env.BUILD_URL}" + } } } From a744cf1b5cb36231a95a72a613e0ee8b82bb13e8 Mon Sep 17 00:00:00 2001 From: jubersheikh9284 <146079345+jubersheikh9284@users.noreply.github.com> Date: Tue, 5 Dec 2023 12:39:11 +0530 Subject: [PATCH 19/21] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 89a4c7bea..ba144f3eb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,7 +15,7 @@ pipeline { NEXUS_PASS = 'admin123' RELEASE_REPO = 'vprofile-release' CENTRAL_REPO = 'vpro-maven-central' - NEXUSIP = '172.31.5.4' + NEXUSIP = '172.31.88.91' NEXUSPORT = '8081' NEXUS_GRP_REPO = 'vpro-maven-group' NEXUS_LOGIN = 'nexuslogin' From 2477de0312d7874038455d34abc6ae77461abe77 Mon Sep 17 00:00:00 2001 From: jubersheikh9284 <146079345+jubersheikh9284@users.noreply.github.com> Date: Tue, 5 Dec 2023 12:41:13 +0530 Subject: [PATCH 20/21] Update Jenkinsfile old --- Jenkinsfile | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ba144f3eb..4908299e4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,3 @@ -def COLOR_MAP = [ - 'SUCCESS': 'good', - 'FAILURE': 'danger', -] pipeline { agent any tools { @@ -26,7 +22,7 @@ pipeline { stages { stage('Build'){ steps { - sh 'mvn -s settings.xml -DskipTests install' + sh 'mvn -DskipTests install' } post { success { @@ -38,14 +34,14 @@ pipeline { stage('Test'){ steps { - sh 'mvn -s settings.xml test' + sh 'mvn test' } } stage('Checkstyle Analysis'){ steps { - sh 'mvn -s settings.xml checkstyle:checkstyle' + sh 'mvn checkstyle:checkstyle' } } @@ -76,8 +72,9 @@ pipeline { } } } + - stage("UploadArtifact"){ + stage("UploadArtifact"){ steps{ nexusArtifactUploader( nexusVersion: 'nexus3', @@ -96,14 +93,5 @@ pipeline { ) } } - - } - post { - always { - echo 'Slack Notifications.' - slackSend channel: '#vprofilecicd', - color: COLOR_MAP[currentBuild.currentResult], - message: "*${currentBuild.currentResult}:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} \n More info at: ${env.BUILD_URL}" - } } } From 23edaf06a00e32187e915138e6b925d6efdfdc42 Mon Sep 17 00:00:00 2001 From: jubersheikh9284 <146079345+jubersheikh9284@users.noreply.github.com> Date: Tue, 5 Dec 2023 12:47:24 +0530 Subject: [PATCH 21/21] Update Jenkinsfile with slack --- Jenkinsfile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 4908299e4..312330075 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,3 +1,8 @@ +def COLOR_MAP = [ + 'SUCCESS': 'good', + 'FAILURE': 'danger', +] + pipeline { agent any tools { @@ -94,4 +99,13 @@ pipeline { } } } +post { + always { + echo 'Slack Notifications.' + slackSend channel: '#vprofilecicd', + color: COLOR_MAP[currentBuild.currentResult], + message: "*${currentBuild.currentResult}:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} \n More info at: ${env.BUILD_URL}" + } + } + }