From 59cd7c97fc5c94bdd3d18389560fdf5ae44423d4 Mon Sep 17 00:00:00 2001 From: kishore1512 <52534799+kishore1512@users.noreply.github.com> Date: Mon, 23 Dec 2019 14:35:18 +0530 Subject: [PATCH 01/10] Jenkinsfile Adding jenkins file to build pipeline project --- Jenkinsfile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..fef8072 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,17 @@ +pipeline { + agent any + stages{ + stage{ + steps('clone') { + git url: 'https://github.com/kishore1512/Python-Sample-Application.git' + } + } + stage{ + steps('SonarQube analysis') { + def scannerHome = tool 'Sonar-Scanner'; + withSonarQubeEnv('sonar') { // If you have configured more than one global server connection, you can specify its name + sh "${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=Python -Dsonar.sources=. -Dsonar.host.url=http://18.215.62.84:9000 -Dsonar.login=832d34ef467b163050306fa45439a1383d541ad9" + } + } + } +} \ No newline at end of file From a75d150cfa5060070b919aa823a3599487a95766 Mon Sep 17 00:00:00 2001 From: kishore1512 <52534799+kishore1512@users.noreply.github.com> Date: Mon, 23 Dec 2019 14:42:32 +0530 Subject: [PATCH 02/10] Update Jenkinsfile Removed Flower Bracket --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index fef8072..52ce7c8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,9 +9,9 @@ pipeline { stage{ steps('SonarQube analysis') { def scannerHome = tool 'Sonar-Scanner'; - withSonarQubeEnv('sonar') { // If you have configured more than one global server connection, you can specify its name + withSonarQubeEnv('sonar') // If you have configured more than one global server connection, you can specify its name sh "${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=Python -Dsonar.sources=. -Dsonar.host.url=http://18.215.62.84:9000 -Dsonar.login=832d34ef467b163050306fa45439a1383d541ad9" } } } -} \ No newline at end of file +} From ff1e72ede0fea29a68c59d32539c2d28e2baba4c Mon Sep 17 00:00:00 2001 From: kishore1512 <52534799+kishore1512@users.noreply.github.com> Date: Mon, 23 Dec 2019 14:48:23 +0530 Subject: [PATCH 03/10] Update Jenkinsfile --- Jenkinsfile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 52ce7c8..0b4d25a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,16 +1,17 @@ pipeline { agent any - stages{ - stage{ + stages { + stage { steps('clone') { git url: 'https://github.com/kishore1512/Python-Sample-Application.git' } } - stage{ + stage { steps('SonarQube analysis') { def scannerHome = tool 'Sonar-Scanner'; - withSonarQubeEnv('sonar') // If you have configured more than one global server connection, you can specify its name + withSonarQubeEnv('sonar') { // If you have configured more than one global server connection, you can specify its name sh "${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=Python -Dsonar.sources=. -Dsonar.host.url=http://18.215.62.84:9000 -Dsonar.login=832d34ef467b163050306fa45439a1383d541ad9" + } } } } From 9ef31aee5f529fd2a68e7fc71938ba95c5650321 Mon Sep 17 00:00:00 2001 From: kishore1512 <52534799+kishore1512@users.noreply.github.com> Date: Mon, 23 Dec 2019 15:06:08 +0530 Subject: [PATCH 04/10] Update Jenkinsfile --- Jenkinsfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0b4d25a..f0aadd7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,16 +1,20 @@ pipeline { agent any + environment { + scannerHome= '/opt/sonar-scanner/bin/sonar-scanner' + } + stages { stage { steps('clone') { - git url: 'https://github.com/kishore1512/Python-Sample-Application.git' + git branch: 'kishore', url: 'https://github.com/kishore1512/Python-Sample-Application.git' } } stage { steps('SonarQube analysis') { def scannerHome = tool 'Sonar-Scanner'; withSonarQubeEnv('sonar') { // If you have configured more than one global server connection, you can specify its name - sh "${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=Python -Dsonar.sources=. -Dsonar.host.url=http://18.215.62.84:9000 -Dsonar.login=832d34ef467b163050306fa45439a1383d541ad9" + sh "${scannerHome} -Dsonar.projectKey=Python -Dsonar.sources=. -Dsonar.host.url=http://18.215.62.84:9000 -Dsonar.login=832d34ef467b163050306fa45439a1383d541ad9" } } } From c7bda8fedbb646831c23dae388359d40ee6bf13b Mon Sep 17 00:00:00 2001 From: kishore1512 <52534799+kishore1512@users.noreply.github.com> Date: Mon, 23 Dec 2019 15:13:19 +0530 Subject: [PATCH 05/10] Update Jenkinsfile --- Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f0aadd7..f445131 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,13 +5,13 @@ pipeline { } stages { - stage { - steps('clone') { + stage('clone') { + steps { git branch: 'kishore', url: 'https://github.com/kishore1512/Python-Sample-Application.git' } } - stage { - steps('SonarQube analysis') { + stage('SonarQube analysis') { + steps { def scannerHome = tool 'Sonar-Scanner'; withSonarQubeEnv('sonar') { // If you have configured more than one global server connection, you can specify its name sh "${scannerHome} -Dsonar.projectKey=Python -Dsonar.sources=. -Dsonar.host.url=http://18.215.62.84:9000 -Dsonar.login=832d34ef467b163050306fa45439a1383d541ad9" From 8d5097ada8bce98927adeabcd91851b3a44b346d Mon Sep 17 00:00:00 2001 From: kishore1512 <52534799+kishore1512@users.noreply.github.com> Date: Mon, 23 Dec 2019 15:28:28 +0530 Subject: [PATCH 06/10] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index f445131..39ba22f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,7 +12,7 @@ pipeline { } stage('SonarQube analysis') { steps { - def scannerHome = tool 'Sonar-Scanner'; + //def scannerHome = tool 'Sonar-Scanner'; withSonarQubeEnv('sonar') { // If you have configured more than one global server connection, you can specify its name sh "${scannerHome} -Dsonar.projectKey=Python -Dsonar.sources=. -Dsonar.host.url=http://18.215.62.84:9000 -Dsonar.login=832d34ef467b163050306fa45439a1383d541ad9" } From 3b3658f24c3b9d4799858146afa72cc01bbb70a1 Mon Sep 17 00:00:00 2001 From: kishore1512 <52534799+kishore1512@users.noreply.github.com> Date: Mon, 23 Dec 2019 15:28:47 +0530 Subject: [PATCH 07/10] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 39ba22f..c0bb5b7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,7 @@ pipeline { agent any environment { - scannerHome= '/opt/sonar-scanner/bin/sonar-scanner' + scannerHome='/opt/sonar-scanner/bin/sonar-scanner' } stages { From 42322833ca7b20b2c9e920229f22b6c7b94bebeb Mon Sep 17 00:00:00 2001 From: kishore1512 <52534799+kishore1512@users.noreply.github.com> Date: Mon, 23 Dec 2019 15:30:11 +0530 Subject: [PATCH 08/10] Update Jenkinsfile --- Jenkinsfile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index c0bb5b7..db1b27c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,11 +12,20 @@ pipeline { } stage('SonarQube analysis') { steps { - //def scannerHome = tool 'Sonar-Scanner'; + def scannerHome = tool 'Sonar-Scanner'; withSonarQubeEnv('sonar') { // If you have configured more than one global server connection, you can specify its name sh "${scannerHome} -Dsonar.projectKey=Python -Dsonar.sources=. -Dsonar.host.url=http://18.215.62.84:9000 -Dsonar.login=832d34ef467b163050306fa45439a1383d541ad9" } } } + stage("Quality Gate") { + steps { + 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 + } + } + } } } From 04b14ce2c9deef37a74e946368257295a5d7aafe Mon Sep 17 00:00:00 2001 From: kishore1512 <52534799+kishore1512@users.noreply.github.com> Date: Mon, 23 Dec 2019 15:30:49 +0530 Subject: [PATCH 09/10] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index db1b27c..ed53adb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,7 +12,7 @@ pipeline { } stage('SonarQube analysis') { steps { - def scannerHome = tool 'Sonar-Scanner'; + //def scannerHome = tool 'Sonar-Scanner'; withSonarQubeEnv('sonar') { // If you have configured more than one global server connection, you can specify its name sh "${scannerHome} -Dsonar.projectKey=Python -Dsonar.sources=. -Dsonar.host.url=http://18.215.62.84:9000 -Dsonar.login=832d34ef467b163050306fa45439a1383d541ad9" } From 2c4ef18b9910576d6853bfddb40e9baf03cd8ac3 Mon Sep 17 00:00:00 2001 From: kishore1512 <52534799+kishore1512@users.noreply.github.com> Date: Mon, 23 Dec 2019 15:49:29 +0530 Subject: [PATCH 10/10] Update Jenkinsfile --- Jenkinsfile | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ed53adb..c0bb5b7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -18,14 +18,5 @@ pipeline { } } } - stage("Quality Gate") { - steps { - 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 - } - } - } } }