From 71423d552f3696b36fcdec955453233480ff89a9 Mon Sep 17 00:00:00 2001 From: Sushantkhandelwal <63052923+sushantkhandelwal@users.noreply.github.com> Date: Tue, 14 Jun 2022 15:36:13 +0530 Subject: [PATCH 1/6] Update Jenkinsfile-2 --- Jenkinsfile-2 | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/Jenkinsfile-2 b/Jenkinsfile-2 index cf293943..ef07b9d5 100644 --- a/Jenkinsfile-2 +++ b/Jenkinsfile-2 @@ -1,22 +1,25 @@ -pipeline { - agent { label 'linux' } - options { - buildDiscarder(logRotator(numToKeepStr: '5')) - } - stages { - stage('Scan') { - steps { - withSonarQubeEnv(installationName: 'sq1') { - sh './mvnw clean org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar' - } - } - } - stage("Quality Gate") { - steps { - timeout(time: 2, unit: 'MINUTES') { - waitForQualityGate abortPipeline: true - } - } - } - } -} \ No newline at end of file +node { +stage('SCM') +{ +checkout scm +} +stage('SonarQube Analysis') +{ +def scannerHome = tool 'sonarqubedemo'; +withSonarQubeEnv() +{ +bat "${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=sonarqubedemo" +} +} +stage("Quality Gate") { +steps { +timeout(time: 2, unit: 'MINUTES') { +waitForQualityGate abortPipeline: true +} +} +} +stage("Build Result") +{ +echo "Build Successful" +} +} From 57958777257dd798d9556d2d9b74f12d5ab8ccd2 Mon Sep 17 00:00:00 2001 From: Sushantkhandelwal <63052923+sushantkhandelwal@users.noreply.github.com> Date: Tue, 14 Jun 2022 15:38:44 +0530 Subject: [PATCH 2/6] Update Jenkinsfile-2 --- Jenkinsfile-2 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Jenkinsfile-2 b/Jenkinsfile-2 index ef07b9d5..413e0475 100644 --- a/Jenkinsfile-2 +++ b/Jenkinsfile-2 @@ -11,6 +11,7 @@ withSonarQubeEnv() bat "${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=sonarqubedemo" } } +stages{ stage("Quality Gate") { steps { timeout(time: 2, unit: 'MINUTES') { @@ -18,6 +19,7 @@ waitForQualityGate abortPipeline: true } } } +} stage("Build Result") { echo "Build Successful" From 55c2955dde2cc738cc3d9fef210f2a39d2cd39d8 Mon Sep 17 00:00:00 2001 From: Sushantkhandelwal <63052923+sushantkhandelwal@users.noreply.github.com> Date: Tue, 14 Jun 2022 15:40:42 +0530 Subject: [PATCH 3/6] Update Jenkinsfile-2 --- Jenkinsfile-2 | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Jenkinsfile-2 b/Jenkinsfile-2 index 413e0475..5166ae7d 100644 --- a/Jenkinsfile-2 +++ b/Jenkinsfile-2 @@ -11,15 +11,6 @@ withSonarQubeEnv() bat "${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=sonarqubedemo" } } -stages{ -stage("Quality Gate") { -steps { -timeout(time: 2, unit: 'MINUTES') { -waitForQualityGate abortPipeline: true -} -} -} -} stage("Build Result") { echo "Build Successful" From 4d2c4d459451b116229eb71e74269de8513a4b11 Mon Sep 17 00:00:00 2001 From: Sushantkhandelwal <63052923+sushantkhandelwal@users.noreply.github.com> Date: Mon, 20 Jun 2022 13:36:57 +0530 Subject: [PATCH 4/6] Update Jenkinsfile-1 --- Jenkinsfile-1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile-1 b/Jenkinsfile-1 index 4edf935f..f5c87323 100644 --- a/Jenkinsfile-1 +++ b/Jenkinsfile-1 @@ -1,15 +1,15 @@ pipeline { - agent { label 'linux' } + agent any options { buildDiscarder(logRotator(numToKeepStr: '5')) } stages { stage('Scan') { steps { - withSonarQubeEnv(installationName: 'sq1') { + withSonarQubeEnv(installationName: 'sonarqubedemo') { sh './mvnw clean org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar' } } } } -} \ No newline at end of file +} From 29569b4f60ff9840dbb33e60301e629b63b7ca68 Mon Sep 17 00:00:00 2001 From: Sushantkhandelwal <63052923+sushantkhandelwal@users.noreply.github.com> Date: Mon, 20 Jun 2022 13:56:09 +0530 Subject: [PATCH 5/6] Update Jenkinsfile-1 --- Jenkinsfile-1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile-1 b/Jenkinsfile-1 index f5c87323..ecd950c5 100644 --- a/Jenkinsfile-1 +++ b/Jenkinsfile-1 @@ -4,10 +4,10 @@ pipeline { buildDiscarder(logRotator(numToKeepStr: '5')) } stages { - stage('Scan') { + stage('Sonar Analysis') { steps { withSonarQubeEnv(installationName: 'sonarqubedemo') { - sh './mvnw clean org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar' + sh './mvnw clean install' } } } From 999ac515b58a6cbab9611bc58ff23ed4ce8bfdb7 Mon Sep 17 00:00:00 2001 From: Sushantkhandelwal <63052923+sushantkhandelwal@users.noreply.github.com> Date: Tue, 21 Jun 2022 11:49:59 +0530 Subject: [PATCH 6/6] Create Jenkinsfile --- Jenkinsfile | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 00000000..f113b59a --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,19 @@ +node { +stage('SCM') +{ +checkout scm +} +stage('SonarQube Analysis') +{ +def scannerHome = tool 'sonarqubedemo'; +withSonarQubeEnv() +{ +bat "${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=sonarqubedemo" +} +} + +stage("Build Result") +{ +echo "Build Successful" +} +}