From facf7db871acc3b7f4c7509df2c544bba641353d Mon Sep 17 00:00:00 2001 From: cece69 Date: Wed, 13 Nov 2024 14:14:21 -0500 Subject: [PATCH 01/15] Update Jenkinsfile --- Jenkinsfile | 128 ++++++++++------------------------------------------ 1 file changed, 23 insertions(+), 105 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index be7508be5..9f21cf976 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,121 +1,39 @@ pipeline { - agent any -/* tools { - maven "maven3" - } -*/ - environment { - NEXUS_VERSION = "nexus3" - NEXUS_PROTOCOL = "http" - NEXUS_URL = "172.31.40.209:8081" - NEXUS_REPOSITORY = "vprofile-release" - NEXUS_REPO_ID = "vprofile-release" - NEXUS_CREDENTIAL_ID = "nexuslogin" - ARTVERSION = "${env.BUILD_ID}" - } - - stages{ - - stage('BUILD'){ - steps { - sh 'mvn clean install -DskipTests' - } - post { - success { - echo 'Now Archiving...' - archiveArtifacts artifacts: '**/target/*.war' - } - } - } - - stage('UNIT TEST'){ - steps { - sh 'mvn test' - } - } + maven "Maven" + jdk "JDK17" + } - stage('INTEGRATION TEST'){ - steps { - sh 'mvn verify -DskipUnitTests' - } - } - - stage ('CODE ANALYSIS WITH CHECKSTYLE'){ + stages { + stage('Fetch code') { steps { - sh 'mvn checkstyle:checkstyle' - } - post { - success { - echo 'Generated Analysis Result' - } + git branch: 'atom', url: 'https://github.com/cece69/vprofile-project2.git' } - } - - 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 \ - -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") { - 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"; - } - } + stage('UNIT TEST') { + steps{ + sh 'mvn test' } } - } + stage('Build'){ + steps{ + sh 'mvn install -DskipTests' + } + post { + success { + echo 'Now Archiving it...' + archiveArtifacts artifacts: '**/target/*.war' + } + } + } + + } } From 6ff20fba082ff3e375af43d7894c3d0b43d1bff3 Mon Sep 17 00:00:00 2001 From: cece69 Date: Wed, 13 Nov 2024 14:22:16 -0500 Subject: [PATCH 02/15] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9f21cf976..7e4aa7a15 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,7 +8,7 @@ pipeline { stages { stage('Fetch code') { steps { - git branch: 'atom', url: 'https://github.com/cece69/vprofile-project2.git' + git branch: 'pipeline', url: 'https://github.com/cece69/vprofile-project2.git/' } } From e89030ea0bf3767e546d1ba0735fe3171ca1426d Mon Sep 17 00:00:00 2001 From: cece69 Date: Wed, 13 Nov 2024 14:25:13 -0500 Subject: [PATCH 03/15] Update Jenkinsfile --- Jenkinsfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7e4aa7a15..9ea006e76 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,7 +6,7 @@ pipeline { } stages { - stage('Fetch code') { + stage('Fetch Code') { steps { git branch: 'pipeline', url: 'https://github.com/cece69/vprofile-project2.git/' } @@ -14,21 +14,21 @@ pipeline { } - stage('UNIT TEST') { + stage('Unit Test') { steps{ - sh 'mvn test' + sh 'mvn test -DskipTests' } } stage('Build'){ steps{ - sh 'mvn install -DskipTests' + sh 'mvn install' } post { success { - echo 'Now Archiving it...' + echo 'Now Archiving...' archiveArtifacts artifacts: '**/target/*.war' } } From ab6818dc221a4cc1c540401d9a5d9f43fd98a8e6 Mon Sep 17 00:00:00 2001 From: cece69 Date: Fri, 15 Nov 2024 12:45:12 -0500 Subject: [PATCH 04/15] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9ea006e76..4148785ed 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ pipeline { stage('Unit Test') { steps{ - sh 'mvn test -DskipTests' + # sh 'mvn test -DskipTests' } } From a45f77197cc0fd8b9f2e6c8b910a93ab4e2d2a0b Mon Sep 17 00:00:00 2001 From: cece69 Date: Fri, 15 Nov 2024 12:46:29 -0500 Subject: [PATCH 05/15] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4148785ed..c36be6f2f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ pipeline { stage('Unit Test') { steps{ - # sh 'mvn test -DskipTests' + echo "starting test...." } } From 358ff57e0c155f37b9345b5ef06653a21e81d8c4 Mon Sep 17 00:00:00 2001 From: cece69 Date: Fri, 15 Nov 2024 12:49:45 -0500 Subject: [PATCH 06/15] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index c36be6f2f..dd7a1403c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ pipeline { stage('Unit Test') { steps{ - echo "starting test...." + echo "starting test via sh mvn test" } } From 856a1601ea16ae8a151c43e1cd00acf5801b795c Mon Sep 17 00:00:00 2001 From: cece69 Date: Fri, 15 Nov 2024 13:14:33 -0500 Subject: [PATCH 07/15] Update Jenkinsfile --- Jenkinsfile | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index dd7a1403c..e3121f800 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,14 +13,6 @@ pipeline { } - - stage('Unit Test') { - steps{ - echo "starting test via sh mvn test" - } - } - - stage('Build'){ steps{ sh 'mvn install' @@ -33,7 +25,16 @@ pipeline { } } } - - + + stage('Unit Test') { + steps{ + echo "starting test via sh mvn test" + } + } + + stage('Checkstyle Analysis') { + steps{ + sh 'mvn checkstyle:checkstyle' + } } } From 03406e6081deb1c79fbdc098b942f46b8fe4d814 Mon Sep 17 00:00:00 2001 From: cece69 Date: Fri, 15 Nov 2024 13:16:39 -0500 Subject: [PATCH 08/15] Update Jenkinsfile --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index e3121f800..219e4a225 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -37,4 +37,5 @@ pipeline { sh 'mvn checkstyle:checkstyle' } } + } } From b666d1d237ff36763c501598e2a21921aa61a4c5 Mon Sep 17 00:00:00 2001 From: cece69 Date: Fri, 15 Nov 2024 13:29:43 -0500 Subject: [PATCH 09/15] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 219e4a225..122820f0f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,7 +15,7 @@ pipeline { stage('Build'){ steps{ - sh 'mvn install' + echo "starting install via sh mvn install" } post { From 7112f51178b323aa3d4f81e20b0d4d3a95abe2f4 Mon Sep 17 00:00:00 2001 From: cece69 Date: Fri, 15 Nov 2024 13:36:56 -0500 Subject: [PATCH 10/15] Update Jenkinsfile From b201904880f7c07bda10350c9d60a882f7e5bc47 Mon Sep 17 00:00:00 2001 From: cece69 Date: Fri, 15 Nov 2024 13:42:49 -0500 Subject: [PATCH 11/15] Update Jenkinsfile --- Jenkinsfile | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 122820f0f..138c740aa 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,13 +17,6 @@ pipeline { steps{ echo "starting install via sh mvn install" } - - post { - success { - echo 'Now Archiving...' - archiveArtifacts artifacts: '**/target/*.war' - } - } } stage('Unit Test') { From b7c6ac3f8ce7f5d7e67fa0aaaaf8ce208416d783 Mon Sep 17 00:00:00 2001 From: cece69 Date: Fri, 15 Nov 2024 13:48:59 -0500 Subject: [PATCH 12/15] Update Jenkinsfile --- Jenkinsfile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 138c740aa..c0b8ccee4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -30,5 +30,13 @@ pipeline { sh 'mvn checkstyle:checkstyle' } } - } + + stage('Sonar Code Analysis') { + steps { + withSonarQubeEnv('sonarqube_server') { + sh 'mvn clean package sonar:sonar' + } + } + } + } } From 5db24c42cf182d1dc6382328b9850e59f3eca291 Mon Sep 17 00:00:00 2001 From: cece69 Date: Fri, 15 Nov 2024 14:03:05 -0500 Subject: [PATCH 13/15] Update Jenkinsfile --- Jenkinsfile | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c0b8ccee4..66badcf34 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,29 +9,31 @@ pipeline { stage('Fetch Code') { steps { git branch: 'pipeline', url: 'https://github.com/cece69/vprofile-project2.git/' - } - + } } - stage('Build'){ - steps{ + stage('Build') { + steps { echo "starting install via sh mvn install" } } stage('Unit Test') { - steps{ + steps { echo "starting test via sh mvn test" } } stage('Checkstyle Analysis') { - steps{ + steps { sh 'mvn checkstyle:checkstyle' } } stage('Sonar Code Analysis') { + environment { + scannerHome = tool 'sonarqube_scanner' + } steps { withSonarQubeEnv('sonarqube_server') { sh 'mvn clean package sonar:sonar' From e46b9b12d947ca555acb9052ccc8c80505dfad55 Mon Sep 17 00:00:00 2001 From: cece69 Date: Fri, 15 Nov 2024 14:14:10 -0500 Subject: [PATCH 14/15] Update Jenkinsfile --- Jenkinsfile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 66badcf34..4c3b40317 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -36,7 +36,15 @@ pipeline { } steps { withSonarQubeEnv('sonarqube_server') { - sh 'mvn clean package sonar:sonar' + 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.exe \ + -Dsonar.java.checkstyle.reportPaths=target/checkstyle-result.xml + ''' } } } From 7ca8616381423138b92e0f910a0f32ab07e2e11a Mon Sep 17 00:00:00 2001 From: cece69 Date: Fri, 15 Nov 2024 14:15:05 -0500 Subject: [PATCH 15/15] Update Jenkinsfile --- Jenkinsfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4c3b40317..7948d0398 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -43,8 +43,7 @@ pipeline { -Dsonar.java.binaries=target/test-classes/com/visualpathit/account/controllerTest/ \ -Dsonar.junit.reportsPath=target/surefire-reports/ \ -Dsonar.jacoco.reportsPath=target/jacoco.exe \ - -Dsonar.java.checkstyle.reportPaths=target/checkstyle-result.xml - ''' + -Dsonar.java.checkstyle.reportPaths=target/checkstyle-result.xml''' } } }