From e2cc38ad04ac97570ce729af6deb3348c172cdd7 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Fri, 29 Oct 2021 11:42:49 +0530
Subject: [PATCH 01/36] Create Jenkinsfile
---
Jenkinsfile | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
create mode 100644 Jenkinsfile
diff --git a/Jenkinsfile b/Jenkinsfile
new file mode 100644
index 0000000..3928956
--- /dev/null
+++ b/Jenkinsfile
@@ -0,0 +1,49 @@
+pipeline {
+ // environment {
+ //registry = "akash64574/myapp"
+ //registryCredential = 'dockerhub'
+ //dockerImage = ''
+ // }
+agent any
+
+stages {
+
+stage('SCM Checkout') {
+ steps {
+ checkout scm
+ // git 'https://github.com/akash64574/maven-hello-world'
+}
+}
+
+stage('Build') {
+steps {
+ sh"/opt/maven/bin/mvn clean package -Dmaven.test.skip=true"
+}
+}
+stage("build & SonarQube analysis") {
+
+ steps {
+ withSonarQubeEnv('sonar') {
+ sh '/opt/maven/bin/mvn sonar:sonar'
+ }
+ }
+ }
+ stage("testing") {
+ when {
+ branch 'QA'
+ }
+ steps {
+ sh 'echo hello'
+ }
+ }
+
+ // stage('Building our image') {
+ // steps {
+ // script {
+ // sh 'docker build -f Dockerfile -t my-app .'
+ //dockerImage = docker.build registry + ":$BUILD_NUMBER"
+ // }
+ // }
+ // }
+ }
+}
From 0395623aa46f2bd4fa8e0bc82446a2eda2941fab Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Fri, 29 Oct 2021 11:45:48 +0530
Subject: [PATCH 02/36] Update Jenkinsfile
---
Jenkinsfile | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 3928956..ae7e743 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -36,14 +36,23 @@ stage("build & SonarQube analysis") {
sh 'echo hello'
}
}
-
- // stage('Building our image') {
- // steps {
- // script {
- // sh 'docker build -f Dockerfile -t my-app .'
- //dockerImage = docker.build registry + ":$BUILD_NUMBER"
- // }
- // }
- // }
+ stage('Build Docker Image') {
+ steps {
+ script {
+ sh 'docker build -t akash64574/my-app-1.0 .'
+ }
+ }
+ }
+ stage('Push Docker Image') {
+ steps {
+ script {
+ withCredentials([string(credentialsId: 'dockerhub-pwd', variable: 'dockerhubpwd')]) {
+ sh 'docker login -u akash64574 -p ${dockerhubpwd}'
+ }
+ sh 'docker push akash64574/my-app-1.0'
+ }
+ }
+ }
+
}
}
From 5cf1507cbe98332ad7d07890a774e2304376c726 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Fri, 29 Oct 2021 12:05:52 +0530
Subject: [PATCH 03/36] Update Jenkinsfile
---
Jenkinsfile | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Jenkinsfile b/Jenkinsfile
index ae7e743..24f3553 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -28,6 +28,12 @@ stage("build & SonarQube analysis") {
}
}
}
+ post {
+ always {
+ emailext body: "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\n More info at: ${env.BUILD_URL}", recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']], subject: 'Test'
+ }
+ }
+
stage("testing") {
when {
branch 'QA'
From 766c69b07125e363b5c6c605a6d2094d8b1f0014 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Fri, 29 Oct 2021 12:06:51 +0530
Subject: [PATCH 04/36] Update Jenkinsfile
---
Jenkinsfile | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 24f3553..2e4d2ec 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -28,11 +28,7 @@ stage("build & SonarQube analysis") {
}
}
}
- post {
- always {
- emailext body: "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\n More info at: ${env.BUILD_URL}", recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']], subject: 'Test'
- }
- }
+
stage("testing") {
when {
From 8176adbe646e0cfa98f409eccf7b8ab1def4f559 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Fri, 29 Oct 2021 14:34:08 +0530
Subject: [PATCH 05/36] Update Jenkinsfile
---
Jenkinsfile | 37 ++++++++++++++++++++++++++++++++++++-
1 file changed, 36 insertions(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 2e4d2ec..582d6cf 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -38,6 +38,11 @@ stage("build & SonarQube analysis") {
sh 'echo hello'
}
}
+ stage ('Notify'){
+ steps {
+ slackSend baseUrl: 'https://hooks.slack.com/services/', channel: 'jenkins_dev', message: 'Build and Testing completed Deployment is under process , please wait for further notification ', teamDomain: '$WORKSPACE', tokenCredentialId: 'slack', username: 'Akash'
+ }
+ }
stage('Build Docker Image') {
steps {
script {
@@ -45,6 +50,35 @@ stage("build & SonarQube analysis") {
}
}
}
+ stage ('Notify'){
+ steps {
+ slackSend baseUrl: 'https://hooks.slack.com/services/', channel: 'jenkins_qa', message: 'Build and Testing completed and status is good , Deployment is pending for approval', teamDomain: '$WORKSPACE', tokenCredentialId: 'slackqa', username: 'Akash'
+ }
+ }
+ stage( 'Appoval mail for QA' ){
+ steps{
+ slackSend baseUrl: 'https://hooks.slack.com/services/', channel: 'jenkins_qa', message: "${env.BUILD_URL}", teamDomain: '', tokenCredentialId: 'slackqa'
+ }
+}
+
+ stage("QA Approval") {
+ steps {
+
+script {
+def userInput = input(id: 'Proceed1', message: 'Promote build?', parameters: [[$class: 'BooleanParameterDefinition', defaultValue: true, description: '', name: 'Please confirm you agree with this']])
+echo 'userInput: ' + userInput
+
+ if(userInput == true) {
+ // do action
+ } else {
+ // not do action
+ echo "Action was aborted."
+ }
+
+ }
+
+ }
+ }
stage('Push Docker Image') {
steps {
script {
@@ -54,7 +88,8 @@ stage("build & SonarQube analysis") {
sh 'docker push akash64574/my-app-1.0'
}
}
- }
+ }
+
}
}
From 69d76e2ea7ffd2c4394702332ff684395a56d090 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Fri, 29 Oct 2021 14:35:29 +0530
Subject: [PATCH 06/36] Update Jenkinsfile
---
Jenkinsfile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 582d6cf..e4c7434 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -38,7 +38,7 @@ stage("build & SonarQube analysis") {
sh 'echo hello'
}
}
- stage ('Notify'){
+ stage ('Notify Dev'){
steps {
slackSend baseUrl: 'https://hooks.slack.com/services/', channel: 'jenkins_dev', message: 'Build and Testing completed Deployment is under process , please wait for further notification ', teamDomain: '$WORKSPACE', tokenCredentialId: 'slack', username: 'Akash'
}
@@ -50,7 +50,7 @@ stage("build & SonarQube analysis") {
}
}
}
- stage ('Notify'){
+ stage ('Notify qa'){
steps {
slackSend baseUrl: 'https://hooks.slack.com/services/', channel: 'jenkins_qa', message: 'Build and Testing completed and status is good , Deployment is pending for approval', teamDomain: '$WORKSPACE', tokenCredentialId: 'slackqa', username: 'Akash'
}
From 621d2a6c9a190a008c0c9d5389fa8bb7d06cdd37 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Fri, 29 Oct 2021 17:45:10 +0530
Subject: [PATCH 07/36] Update AppTest.java
---
src/test/java/com/mycompany/app/AppTest.java | 31 +++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/src/test/java/com/mycompany/app/AppTest.java b/src/test/java/com/mycompany/app/AppTest.java
index 81ac345..54f3e07 100644
--- a/src/test/java/com/mycompany/app/AppTest.java
+++ b/src/test/java/com/mycompany/app/AppTest.java
@@ -15,6 +15,35 @@ public class AppTest
@Test
public void shouldAnswerWithTrue()
{
- assertTrue( true );
+
+ //comment the above 2 lines and uncomment below 2 lines to use Chrome
+ //System.setProperty("webdriver.chrome.driver","G:\\chromedriver.exe");
+ WebDriverManager.chromedriver().browserVersion("94.0.4606.81").setup();
+ WebDriver driver = new ChromeDriver();
+
+ String baseUrl = "http://demo.guru99.com/test/newtours/";
+ String expectedTitle = "Welcome: Mercury Tours";
+ String actualTitle = "";
+
+ // launch Fire fox and direct it to the Base URL
+ driver.get(baseUrl);
+
+ // get the actual value of the title
+ actualTitle = driver.getTitle();
+
+ /*
+ * compare the actual title of the page with the expected one and print
+ * the result as "Passed" or "Failed"
+ */
+ if (actualTitle.contentEquals(expectedTitle)){
+ System.out.println("Test Passed!");
+ } else {
+ System.out.println("Test Failed");
+ }
+
+ //close Fire fox
+ driver.close();
+
+ // assertTrue( true );
}
}
From 0e1c9974153a1b0fd3753c74c214040748c9cc08 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Fri, 29 Oct 2021 17:51:58 +0530
Subject: [PATCH 08/36] Update pom.xml
---
pom.xml | 31 ++++++++++++++++++++++++++-----
1 file changed, 26 insertions(+), 5 deletions(-)
diff --git a/pom.xml b/pom.xml
index 8671f90..7097b7e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,12 +20,28 @@
- junit
- junit
- 4.11
- test
+
+ org.seleniumhq.selenium
+ selenium-java
+ 4.0.0
+ //junit
+ //junit
+ //4.11
+ //test
-
+
+ org.testng
+ testng
+ 6.8
+ test
+
+
+ io.github.bonigarcia
+ webdrivermanager
+ 5.0.3
+
+
+
@@ -47,6 +63,11 @@
maven-surefire-plugin
2.22.1
+
+
+ Test.xml
+
+
maven-jar-plugin
From 965a0088596ab517f959be3f5243dba5c71c8679 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Fri, 29 Oct 2021 17:53:54 +0530
Subject: [PATCH 09/36] Create Test.xml
---
Test.xml | 7 +++++++
1 file changed, 7 insertions(+)
create mode 100644 Test.xml
diff --git a/Test.xml b/Test.xml
new file mode 100644
index 0000000..3acf3ac
--- /dev/null
+++ b/Test.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
From 37ce9f2d98f797bfc0a5326ca0debf2f146c0424 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Fri, 29 Oct 2021 17:54:28 +0530
Subject: [PATCH 10/36] Create Testing.xml
---
Testing.xml | 7 +++++++
1 file changed, 7 insertions(+)
create mode 100644 Testing.xml
diff --git a/Testing.xml b/Testing.xml
new file mode 100644
index 0000000..3acf3ac
--- /dev/null
+++ b/Testing.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
From 46ab80faecb9d1846dbcc04928c87f144163ebb9 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Fri, 29 Oct 2021 17:54:51 +0530
Subject: [PATCH 11/36] Delete Testing.xml
---
Testing.xml | 7 -------
1 file changed, 7 deletions(-)
delete mode 100644 Testing.xml
diff --git a/Testing.xml b/Testing.xml
deleted file mode 100644
index 3acf3ac..0000000
--- a/Testing.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
From 37d07b6837944028a3fa8e408b342e8b9bbe9837 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Fri, 29 Oct 2021 18:13:49 +0530
Subject: [PATCH 12/36] Update pom.xml
---
pom.xml | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/pom.xml b/pom.xml
index 7097b7e..5b98411 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,28 +20,23 @@
-
org.seleniumhq.selenium
selenium-java
4.0.0
- //junit
- //junit
- //4.11
- //test
- org.testng
- testng
- 6.8
- test
-
+ org.testng
+ testng
+ 6.8
+ test
+
- io.github.bonigarcia
- webdrivermanager
- 5.0.3
-
+ io.github.bonigarcia
+ webdrivermanager
+ 5.0.3
+
-
+
From 7bb214b1940348ba6554f539da180a260366c359 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Fri, 29 Oct 2021 18:14:06 +0530
Subject: [PATCH 13/36] Create pom.xml
From d346ddc0529baaf98c6d66ef5afd457a9a708e83 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Fri, 29 Oct 2021 18:22:47 +0530
Subject: [PATCH 14/36] Update AppTest.java
---
src/test/java/com/mycompany/app/AppTest.java | 28 ++------------------
1 file changed, 2 insertions(+), 26 deletions(-)
diff --git a/src/test/java/com/mycompany/app/AppTest.java b/src/test/java/com/mycompany/app/AppTest.java
index 54f3e07..0cb942c 100644
--- a/src/test/java/com/mycompany/app/AppTest.java
+++ b/src/test/java/com/mycompany/app/AppTest.java
@@ -18,32 +18,8 @@ public void shouldAnswerWithTrue()
//comment the above 2 lines and uncomment below 2 lines to use Chrome
//System.setProperty("webdriver.chrome.driver","G:\\chromedriver.exe");
- WebDriverManager.chromedriver().browserVersion("94.0.4606.81").setup();
- WebDriver driver = new ChromeDriver();
-
- String baseUrl = "http://demo.guru99.com/test/newtours/";
- String expectedTitle = "Welcome: Mercury Tours";
- String actualTitle = "";
+
- // launch Fire fox and direct it to the Base URL
- driver.get(baseUrl);
-
- // get the actual value of the title
- actualTitle = driver.getTitle();
-
- /*
- * compare the actual title of the page with the expected one and print
- * the result as "Passed" or "Failed"
- */
- if (actualTitle.contentEquals(expectedTitle)){
- System.out.println("Test Passed!");
- } else {
- System.out.println("Test Failed");
- }
-
- //close Fire fox
- driver.close();
-
- // assertTrue( true );
+ assertTrue( true );
}
}
From d3901eb12d24d3cf83d2d277a31dbbfad92bf9c9 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Fri, 29 Oct 2021 18:25:52 +0530
Subject: [PATCH 15/36] Update pom.xml
---
pom.xml | 24 +++++-------------------
1 file changed, 5 insertions(+), 19 deletions(-)
diff --git a/pom.xml b/pom.xml
index 5b98411..6989357 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,20 +20,10 @@
- org.seleniumhq.selenium
- selenium-java
- 4.0.0
-
-
- org.testng
- testng
- 6.8
- test
-
-
- io.github.bonigarcia
- webdrivermanager
- 5.0.3
+ junit
+ junit
+ 4.11
+ test
@@ -58,11 +48,7 @@
maven-surefire-plugin
2.22.1
-
-
- Test.xml
-
-
+
maven-jar-plugin
From 125ac711a22bdab8ba31477d2bedd1c182ff2488 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Fri, 29 Oct 2021 19:17:47 +0530
Subject: [PATCH 16/36] Update pom.xml
---
pom.xml | 31 ++++++++-----------------------
1 file changed, 8 insertions(+), 23 deletions(-)
diff --git a/pom.xml b/pom.xml
index 7097b7e..09b8b3a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,25 +21,14 @@
- org.seleniumhq.selenium
- selenium-java
- 4.0.0
- //junit
- //junit
- //4.11
- //test
+
+ junit
+ junit
+ 4.11
+ test
-
- org.testng
- testng
- 6.8
- test
-
-
- io.github.bonigarcia
- webdrivermanager
- 5.0.3
-
+
+
@@ -63,11 +52,7 @@
maven-surefire-plugin
2.22.1
-
-
- Test.xml
-
-
+
maven-jar-plugin
From 58ebb808e72bfed1a82564e251bee260bc091723 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Fri, 29 Oct 2021 19:47:57 +0530
Subject: [PATCH 17/36] Update pom.xml
---
pom.xml | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/pom.xml b/pom.xml
index 20de9e9..8671f90 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,24 +20,11 @@
-
-
-
- junit
- junit
- 4.11
- test
-
-
-
-
junit
junit
4.11
test
-
-
@@ -60,7 +47,6 @@
maven-surefire-plugin
2.22.1
-
maven-jar-plugin
From e4975be7ed48fc8d17b52c245edf01db99f9e3f2 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Sun, 31 Oct 2021 17:10:34 +0530
Subject: [PATCH 18/36] Update Jenkinsfile
---
Jenkinsfile | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index e4c7434..c16dfba 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -35,7 +35,10 @@ stage("build & SonarQube analysis") {
branch 'QA'
}
steps {
- sh 'echo hello'
+ sh '/opt/maven/bin/mvn cobertura:cobertura -Pmetrics -Dcobertura.report.format=xml'
+ cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: '**/target/site/cobertura/coverage.xml', conditionalCoverageTargets: '70, 0, 0', enableNewApi: true, failNoReports: false, failUnhealthy: false, failUnstable: false, lineCoverageTargets: '80, 0, 0', maxNumberOfBuilds: 0, methodCoverageTargets: '80, 0, 0', onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false
+ sh '/opt/maven/bin/mvn verify'
+ junit allowEmptyResults: true, testResults: '**/target/surefire-reports/*.xml'
}
}
stage ('Notify Dev'){
@@ -89,6 +92,11 @@ echo 'userInput: ' + userInput
}
}
}
+ stage ('Notify Dev again'){
+ steps {
+ slackSend baseUrl: 'https://hooks.slack.com/services/', channel: 'jenkins_dev', message: 'your deployment is completed !!', teamDomain: '$WORKSPACE', tokenCredentialId: 'slack', username: 'Akash'
+ }
+ }
}
From 3eb1eb21b7bf9929a64dffd67107f89340b1887d Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Sun, 31 Oct 2021 17:14:10 +0530
Subject: [PATCH 19/36] Update Jenkinsfile
---
Jenkinsfile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index c16dfba..8e5f25d 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -92,9 +92,9 @@ echo 'userInput: ' + userInput
}
}
}
- stage ('Notify Dev again'){
- steps {
- slackSend baseUrl: 'https://hooks.slack.com/services/', channel: 'jenkins_dev', message: 'your deployment is completed !!', teamDomain: '$WORKSPACE', tokenCredentialId: 'slack', username: 'Akash'
+ stage ('Notify Dev again'){
+ steps {
+ slackSend baseUrl: 'https://hooks.slack.com/services/', channel: 'jenkins_dev', message: 'your deployment is completed !!', teamDomain: '$WORKSPACE', tokenCredentialId: 'slack', username: 'Akash'
}
}
From e4654c3cb0c2f97132bb4843d792b366d4282752 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Sun, 31 Oct 2021 17:20:15 +0530
Subject: [PATCH 20/36] Update Jenkinsfile
---
Jenkinsfile | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 8e5f25d..6ddd54d 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -35,10 +35,7 @@ stage("build & SonarQube analysis") {
branch 'QA'
}
steps {
- sh '/opt/maven/bin/mvn cobertura:cobertura -Pmetrics -Dcobertura.report.format=xml'
- cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: '**/target/site/cobertura/coverage.xml', conditionalCoverageTargets: '70, 0, 0', enableNewApi: true, failNoReports: false, failUnhealthy: false, failUnstable: false, lineCoverageTargets: '80, 0, 0', maxNumberOfBuilds: 0, methodCoverageTargets: '80, 0, 0', onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false
- sh '/opt/maven/bin/mvn verify'
- junit allowEmptyResults: true, testResults: '**/target/surefire-reports/*.xml'
+ sh 'echo Hello'
}
}
stage ('Notify Dev'){
@@ -92,11 +89,7 @@ echo 'userInput: ' + userInput
}
}
}
- stage ('Notify Dev again'){
- steps {
- slackSend baseUrl: 'https://hooks.slack.com/services/', channel: 'jenkins_dev', message: 'your deployment is completed !!', teamDomain: '$WORKSPACE', tokenCredentialId: 'slack', username: 'Akash'
- }
- }
+
}
From 9f6e7572c83fb95295bc63df4cde1ab962ed4db9 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Sun, 31 Oct 2021 17:24:11 +0530
Subject: [PATCH 21/36] Update Jenkinsfile
---
Jenkinsfile | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index e4c7434..6a89d5b 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -35,7 +35,10 @@ stage("build & SonarQube analysis") {
branch 'QA'
}
steps {
- sh 'echo hello'
+ sh '/opt/maven/bin/mvn cobertura:cobertura -Pmetrics -Dcobertura.report.format=xml'
+ cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: '**/target/site/cobertura/coverage.xml', conditionalCoverageTargets: '70, 0, 0', enableNewApi: true, failNoReports: false, failUnhealthy: false, failUnstable: false, lineCoverageTargets: '80, 0, 0', maxNumberOfBuilds: 0, methodCoverageTargets: '80, 0, 0', onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false
+ sh '/opt/maven/bin/mvn verify'
+ junit allowEmptyResults: true, testResults: '**/target/surefire-reports/*.xml'
}
}
stage ('Notify Dev'){
@@ -89,7 +92,19 @@ echo 'userInput: ' + userInput
}
}
}
-
+ stage ('Notify Dev'){
+ steps {
+ slackSend baseUrl: 'https://hooks.slack.com/services/', channel: 'jenkins_dev', message: 'Your Deployment is completed', teamDomain: '$WORKSPACE', tokenCredentialId: 'slack', username: 'Akash'
+ }
+ }
+ stage ('Notify qa again'){
+ when {
+ branch 'QA'
+ }
+ steps {
+ slackSend baseUrl: 'https://hooks.slack.com/services/', channel: 'jenkins_qa', message: 'Build and Testing completed and status is good , Deployment is pending for approval', teamDomain: '$WORKSPACE', tokenCredentialId: 'slackqa', username: 'Akash'
+ }
+ }
}
}
From 55e5acf88681b09a2e46f499a583cc54bd773a16 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Sun, 31 Oct 2021 17:24:51 +0530
Subject: [PATCH 22/36] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 6a89d5b..4afd400 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -92,7 +92,7 @@ echo 'userInput: ' + userInput
}
}
}
- stage ('Notify Dev'){
+ stage ('Notify Dev again'){
steps {
slackSend baseUrl: 'https://hooks.slack.com/services/', channel: 'jenkins_dev', message: 'Your Deployment is completed', teamDomain: '$WORKSPACE', tokenCredentialId: 'slack', username: 'Akash'
}
From 779c6e1d11c2b5e5cda2aeb3deab98b86c5357b3 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Sun, 31 Oct 2021 18:05:43 +0530
Subject: [PATCH 23/36] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 6cdbaf9..09a2f30 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -103,7 +103,7 @@ echo 'userInput: ' + userInput
branch 'QA'
}
steps {
- slackSend baseUrl: 'https://hooks.slack.com/services/', channel: 'jenkins_qa', message: 'Build and Testing completed and status is good , Deployment is pending for approval', teamDomain: '$WORKSPACE', tokenCredentialId: 'slackqa', username: 'Akash'
+ slackSend baseUrl: 'https://hooks.slack.com/services/', channel: 'jenkins_qa', message: 'Your Deployment is successfully completed !!', teamDomain: '$WORKSPACE', tokenCredentialId: 'slackqa', username: 'Akash'
}
}
From 2e1f6692e7c920c17257787efc46621643fd5a73 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Sun, 31 Oct 2021 18:21:28 +0530
Subject: [PATCH 24/36] update jenkins file to check webhook
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 09a2f30..933fec0 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -95,7 +95,7 @@ echo 'userInput: ' + userInput
}
stage ('Notify Dev again'){
steps {
- slackSend baseUrl: 'https://hooks.slack.com/services/', channel: 'jenkins_dev', message: 'Your Deployment is completed', teamDomain: '$WORKSPACE', tokenCredentialId: 'slack', username: 'Akash'
+ slackSend baseUrl: 'https://hooks.slack.com/services/', channel: 'jenkins_dev', message: 'Your Deployment is completed :-)', teamDomain: '$WORKSPACE', tokenCredentialId: 'slack', username: 'Akash'
}
}
stage ('Notify qa again'){
From 360f8853b2b4eccb93186bc74db83301a1d937cb Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Sun, 31 Oct 2021 18:23:46 +0530
Subject: [PATCH 25/36] to check webhook
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 933fec0..c1ff861 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -17,7 +17,7 @@ stage('SCM Checkout') {
stage('Build') {
steps {
- sh"/opt/maven/bin/mvn clean package -Dmaven.test.skip=true"
+ sh"/opt/maven/bin/mvn clean package "
}
}
stage("build & SonarQube analysis") {
From 1936132e6eae01662e9c330f8dd5e2a29e1ed219 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Mon, 1 Nov 2021 12:47:43 +0530
Subject: [PATCH 26/36] Update Jenkinsfile
---
Jenkinsfile | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index c1ff861..30d40f1 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -28,7 +28,14 @@ stage("build & SonarQube analysis") {
}
}
}
-
+ //stage("Quality Gate") {
+ //steps {
+ //timeout(time: 1, unit: 'MINUTES') {
+ //waitForQualityGate abortPipeline: true
+ //}
+ //}
+ //}
+
stage("testing") {
when {
@@ -106,6 +113,13 @@ echo 'userInput: ' + userInput
slackSend baseUrl: 'https://hooks.slack.com/services/', channel: 'jenkins_qa', message: 'Your Deployment is successfully completed !!', teamDomain: '$WORKSPACE', tokenCredentialId: 'slackqa', username: 'Akash'
}
}
+ stage ('email notification'){
+ steps {
+ emailext body: '''Hello Dev Team
+ Your deployment is successful !!''', subject: 'Jenkins Job status', to: 'snarang601@gmail.com'
+
+ }
+ }
}
}
From 78df0236c803beec4e49540d89ea938ecc35b100 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Mon, 1 Nov 2021 13:46:45 +0530
Subject: [PATCH 27/36] Update Jenkinsfile
---
Jenkinsfile | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 30d40f1..e58abac 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -115,8 +115,9 @@ echo 'userInput: ' + userInput
}
stage ('email notification'){
steps {
- emailext body: '''Hello Dev Team
- Your deployment is successful !!''', subject: 'Jenkins Job status', to: 'snarang601@gmail.com'
+ emailext body: "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\n More info at: ${env.BUILD_URL}", recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']], subject: 'Your Deployment is successful'
+ //emailext body: '''Hello Dev Team
+ //Your deployment is successful !!''', subject: 'Jenkins Job status', to: 'snarang601@gmail.com'
}
}
From 5b922e7b84f895d90088ff43a945eaeea79d92e1 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Mon, 1 Nov 2021 13:50:09 +0530
Subject: [PATCH 28/36] Update Jenkinsfile
---
Jenkinsfile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index e58abac..dc5ce79 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -115,9 +115,9 @@ echo 'userInput: ' + userInput
}
stage ('email notification'){
steps {
- emailext body: "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\n More info at: ${env.BUILD_URL}", recipientProviders: [[$class: 'DevelopersRecipientProvider'], [$class: 'RequesterRecipientProvider']], subject: 'Your Deployment is successful'
- //emailext body: '''Hello Dev Team
- //Your deployment is successful !!''', subject: 'Jenkins Job status', to: 'snarang601@gmail.com'
+
+ emailext body: '''Hello Dev Team
+ Your deployment is successful !! ${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\n More info at: ${env.BUILD_URL}''', subject: 'Jenkins Job status', to: 'snarang601@gmail.com'
}
}
From 80787c1a23759bc6586d926ff489a8ac77f68451 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Mon, 1 Nov 2021 13:51:43 +0530
Subject: [PATCH 29/36] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index dc5ce79..4f63712 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -117,7 +117,7 @@ echo 'userInput: ' + userInput
steps {
emailext body: '''Hello Dev Team
- Your deployment is successful !! ${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\n More info at: ${env.BUILD_URL}''', subject: 'Jenkins Job status', to: 'snarang601@gmail.com'
+ Your deployment is successful !! "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\n More info at: ${env.BUILD_URL}" ''', subject: 'Jenkins Job status', to: 'snarang601@gmail.com'
}
}
From b95dd5ae778988e693749a020365b6bd77be3bf4 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Mon, 1 Nov 2021 13:53:57 +0530
Subject: [PATCH 30/36] Update Jenkinsfile
---
Jenkinsfile | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 4f63712..50ab49c 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -113,11 +113,16 @@ echo 'userInput: ' + userInput
slackSend baseUrl: 'https://hooks.slack.com/services/', channel: 'jenkins_qa', message: 'Your Deployment is successfully completed !!', teamDomain: '$WORKSPACE', tokenCredentialId: 'slackqa', username: 'Akash'
}
}
- stage ('email notification'){
+ stage ('email notification'){
+ when {
+ branch 'Dev'
+ }
steps {
emailext body: '''Hello Dev Team
- Your deployment is successful !! "${currentBuild.currentResult}: Job ${env.JOB_NAME} build ${env.BUILD_NUMBER}\n More info at: ${env.BUILD_URL}" ''', subject: 'Jenkins Job status', to: 'snarang601@gmail.com'
+ Your deployment is successful !!
+ Regards
+ QA Team ''', subject: 'Jenkins Job status', to: 'snarang601@gmail.com'
}
}
From 286ec71e69311ecbb5f5f360720ead19d46825f6 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Mon, 1 Nov 2021 16:42:00 +0530
Subject: [PATCH 31/36] Update Dockerfile
---
Dockerfile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Dockerfile b/Dockerfile
index e39ef3a..1012ddc 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
FROM openjdk
-COPY target/*.jar /
-EXPOSE 8080
-ENTRYPOINT ["java","-jar","/my-app-1.0-SNAPSHOT.jar"]
\ No newline at end of file
+COPY target/*.jar .
+EXPOSE 9000
+ENTRYPOINT ["java","-jar","/my-app-1.0-SNAPSHOT.jar"]
From 4b15c5be039b42e494c070f48e2b3d9ba700c349 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Mon, 1 Nov 2021 16:43:48 +0530
Subject: [PATCH 32/36] Update Dockerfile
---
Dockerfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Dockerfile b/Dockerfile
index 1012ddc..e3bb8b5 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
FROM openjdk
COPY target/*.jar .
EXPOSE 9000
-ENTRYPOINT ["java","-jar","/my-app-1.0-SNAPSHOT.jar"]
+ENTRYPOINT ["java","-cp","/my-app-1.0-SNAPSHOT.jar","com.mycompany.app.App"]
From 3a29b034961bcdc52753d3f7c089803183e5c959 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Mon, 1 Nov 2021 16:51:14 +0530
Subject: [PATCH 33/36] Update Jenkinsfile
---
Jenkinsfile | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 50ab49c..ee68361 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -125,7 +125,21 @@ echo 'userInput: ' + userInput
QA Team ''', subject: 'Jenkins Job status', to: 'snarang601@gmail.com'
}
- }
+ }
+ stage('stop previous containers') {
+ steps {
+ sh 'docker ps -f name=myapp -q | xargs --no-run-if-empty docker container stop'
+ sh 'docker container ls -a -fname=myapp -q | xargs -r docker container rm'
+ }
+ }
+
+ stage('Docker Run') {
+ steps{
+ script {
+ sh 'docker run -d --name=myapp -p 9005:8888 akash64574/myapp-1.0:latest'
+
+ }
+ }
}
}
From 0cf297e007b2d59a89511fd3e94a254b8994a1e8 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Mon, 1 Nov 2021 16:52:54 +0530
Subject: [PATCH 34/36] Update Jenkinsfile
---
Jenkinsfile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index ee68361..768578b 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -134,9 +134,10 @@ echo 'userInput: ' + userInput
}
stage('Docker Run') {
- steps{
+ steps{
script {
sh 'docker run -d --name=myapp -p 9005:8888 akash64574/myapp-1.0:latest'
+ }
}
}
From 95ce2d389e9077d54d60f8d992871f0fb06d9081 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Mon, 1 Nov 2021 16:54:16 +0530
Subject: [PATCH 35/36] Update Jenkinsfile
---
Jenkinsfile | 16 +---------------
1 file changed, 1 insertion(+), 15 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 768578b..b52a3bc 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -126,21 +126,7 @@ echo 'userInput: ' + userInput
}
}
- stage('stop previous containers') {
- steps {
- sh 'docker ps -f name=myapp -q | xargs --no-run-if-empty docker container stop'
- sh 'docker container ls -a -fname=myapp -q | xargs -r docker container rm'
- }
- }
-
- stage('Docker Run') {
- steps{
- script {
- sh 'docker run -d --name=myapp -p 9005:8888 akash64574/myapp-1.0:latest'
- }
-
- }
- }
+
}
}
From 33db787a1197d15e9e81fdd535406aff8b9e8365 Mon Sep 17 00:00:00 2001
From: akash64574 <59645011+akash64574@users.noreply.github.com>
Date: Mon, 1 Nov 2021 17:20:18 +0530
Subject: [PATCH 36/36] Update Jenkinsfile
---
Jenkinsfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index b52a3bc..8e2eb5b 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -119,7 +119,7 @@ echo 'userInput: ' + userInput
}
steps {
- emailext body: '''Hello Dev Team
+ emailext body: '''Hi Dev Team
Your deployment is successful !!
Regards
QA Team ''', subject: 'Jenkins Job status', to: 'snarang601@gmail.com'