From 0611b4bac2ad8d508af561336057ae7c65b25537 Mon Sep 17 00:00:00 2001 From: prabaharan0312126 Date: Sun, 17 Feb 2019 20:17:48 +0530 Subject: [PATCH 01/24] removed slack notification --- Jenkinsfile | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ed1bb2e0a50..e244beac9be 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,15 +10,7 @@ stage('Email Notification'){ mail bcc: '', body: '''Hi Welcome to jenkins email alerts Thanks - Hari''', cc: '', from: '', replyTo: '', subject: 'Jenkins Job', to: 'hari.kammana@gmail.com' - } - stage('Slack Notification'){ - slackSend baseUrl: 'https://hooks.slack.com/services/', - channel: '#jenkins-pipeline-demo', - color: 'good', - message: 'Welcome to Jenkins, Slack!', - teamDomain: 'javahomecloud', - tokenCredentialId: 'slack-demo' + Hari''', cc: '', from: '', replyTo: '', subject: 'Jenkins Job', to: 'prabaharanirlearn@gmail.com' } } From f779649cb598bb5b3bfa7394451e1264c57c0e84 Mon Sep 17 00:00:00 2001 From: prabaharan0312126 Date: Sun, 17 Feb 2019 20:20:58 +0530 Subject: [PATCH 02/24] commit git changes --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index e244beac9be..7944be004ba 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,6 +1,6 @@ node{ stage('SCM Checkout'){ - git 'https://github.com/javahometech/my-app' + git 'https://github.com/prabaharan0312126/starter-web' } stage('Compile-Package'){ From 342faf8401c3b30c9862af00965da21f79ab9127 Mon Sep 17 00:00:00 2001 From: prabaharan0312126 Date: Sun, 17 Feb 2019 20:23:16 +0530 Subject: [PATCH 03/24] update jenkins file --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7944be004ba..7b7dd3f8655 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,6 +1,6 @@ node{ stage('SCM Checkout'){ - git 'https://github.com/prabaharan0312126/starter-web' + git 'https://github.com/prabaharan0312126/my-app.git' } stage('Compile-Package'){ From 023da77986307390f333405553551dffea50ff70 Mon Sep 17 00:00:00 2001 From: prabaharan0312126 Date: Sun, 17 Feb 2019 20:26:12 +0530 Subject: [PATCH 04/24] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7b7dd3f8655..805f2fccd41 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,7 +4,7 @@ } stage('Compile-Package'){ - def mvnHome = tool name: 'maven-3', type: 'maven' + def mvnHome = tool name: 'maven3', type: 'maven' sh "${mvnHome}/bin/mvn package" } stage('Email Notification'){ From ed9df2c39ab5fd1e357b36c452a37f7618e06861 Mon Sep 17 00:00:00 2001 From: prabaharan0312126 Date: Sun, 17 Feb 2019 20:30:07 +0530 Subject: [PATCH 05/24] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 805f2fccd41..33899ed5c53 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,7 +10,7 @@ stage('Email Notification'){ mail bcc: '', body: '''Hi Welcome to jenkins email alerts Thanks - Hari''', cc: '', from: '', replyTo: '', subject: 'Jenkins Job', to: 'prabaharanirlearn@gmail.com' + Hari''', cc: '', from: '', replyTo: '', subject: 'Jenkins Job', to: 'prabaharanitlearn@gmail.com' } } From 2cb1c4da2f26b7cecc5755f9f541039d460fe4fe Mon Sep 17 00:00:00 2001 From: prabaharan0312126 Date: Sun, 17 Feb 2019 22:21:03 +0530 Subject: [PATCH 06/24] Update Jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 33899ed5c53..75ad79526ab 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,9 +8,9 @@ sh "${mvnHome}/bin/mvn package" } stage('Email Notification'){ - mail bcc: '', body: '''Hi Welcome to jenkins email alerts + mail bcc: '', body: '''Build is done Thanks - Hari''', cc: '', from: '', replyTo: '', subject: 'Jenkins Job', to: 'prabaharanitlearn@gmail.com' + prabha''', cc: '', from: '', replyTo: '', subject: 'Jenkins Job', to: 'prabaharanitlearn@gmail.com' } } From 21b1a2f1aaca21fe105d9c2a8f440fd9fb242e6b Mon Sep 17 00:00:00 2001 From: prabaharan0312126 Date: Sun, 17 Feb 2019 22:23:14 +0530 Subject: [PATCH 07/24] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 75ad79526ab..46a015ef511 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,7 +8,7 @@ sh "${mvnHome}/bin/mvn package" } stage('Email Notification'){ - mail bcc: '', body: '''Build is done + mail bcc: '', body: '''dummy Build is done Thanks prabha''', cc: '', from: '', replyTo: '', subject: 'Jenkins Job', to: 'prabaharanitlearn@gmail.com' } From 8def55de527b66c4792e75bcf247f4fb32ea1024 Mon Sep 17 00:00:00 2001 From: prabaharan0312126 Date: Sun, 17 Feb 2019 23:04:28 +0530 Subject: [PATCH 08/24] docker change --- Jenkinsfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 46a015ef511..7af0f3b63e7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,6 +7,9 @@ def mvnHome = tool name: 'maven3', type: 'maven' sh "${mvnHome}/bin/mvn package" } + stage('Build Docker Imager'){ + sh 'docker build -t prabaharanitlearn/myweb:0.0.2 .' + } stage('Email Notification'){ mail bcc: '', body: '''dummy Build is done Thanks From 72811751ce840bf08844a279cf1beee850c2410d Mon Sep 17 00:00:00 2001 From: prabaharan0312126 Date: Mon, 18 Feb 2019 00:04:56 +0530 Subject: [PATCH 09/24] Update Jenkinsfile --- Jenkinsfile | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7af0f3b63e7..093ff56b111 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,20 +1,30 @@ - node{ +node{ stage('SCM Checkout'){ git 'https://github.com/prabaharan0312126/my-app.git' } stage('Compile-Package'){ def mvnHome = tool name: 'maven3', type: 'maven' - sh "${mvnHome}/bin/mvn package" + sh "${mvnHome}/bin/mvn clean package" + sh 'mv target/myweb*.war target/newapp.war' } stage('Build Docker Imager'){ sh 'docker build -t prabaharanitlearn/myweb:0.0.2 .' } - stage('Email Notification'){ - mail bcc: '', body: '''dummy Build is done - Thanks - prabha''', cc: '', from: '', replyTo: '', subject: 'Jenkins Job', to: 'prabaharanitlearn@gmail.com' + stage('Docker Image Push'){ + withCredentials([string(credentialsId: 'dockerPass', variable: 'dockerPassword')]) { + sh "docker login -u prabaharanitlearn -p ${dockerPassword}" + } + sh 'docker push prabaharanitlearn/myweb:0.0.2' + } + stage('Remove Previous Container'){ + try{ + sh 'docker rm -f tomcattest' + }catch(error){ + // do nothing if there is an exception + } + stage('Docker deployment'){ + sh 'docker run -d -p 8090:8080 --name tomcattest prabaharanitlearn/myweb:0.0.2' } -} - + } From 9a5860faaf5f0d5ccf42adabd103b27ad4b23fa4 Mon Sep 17 00:00:00 2001 From: prabaharan0312126 Date: Mon, 18 Feb 2019 00:05:15 +0530 Subject: [PATCH 10/24] Update Jenkinsfile From 4735d47beaf91c424ab639ffedb80c562606c608 Mon Sep 17 00:00:00 2001 From: prabaharan0312126 Date: Mon, 18 Feb 2019 00:08:31 +0530 Subject: [PATCH 11/24] Update index.html --- src/main/webapp/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/webapp/index.html b/src/main/webapp/index.html index c4852a69b13..8c42763535d 100755 --- a/src/main/webapp/index.html +++ b/src/main/webapp/index.html @@ -11,7 +11,7 @@
-

Javahome App - 0.0.5 - Deployed in Swarm

+

Hi this is my first work

From 857bc473d64d50be48c09c684b6386dd9c190f10 Mon Sep 17 00:00:00 2001 From: prabaharan0312126 Date: Mon, 25 Feb 2019 19:58:09 -0600 Subject: [PATCH 12/24] Delete nov-2018-7am-devops --- nov-2018-7am-devops | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 nov-2018-7am-devops diff --git a/nov-2018-7am-devops b/nov-2018-7am-devops deleted file mode 100644 index 31fe3e60aad..00000000000 --- a/nov-2018-7am-devops +++ /dev/null @@ -1,31 +0,0 @@ -node{ - def mvnHome = tool name: 'maven-3', type: 'maven' - def mvn = "${mvnHome}/bin/mvn" - def tomcatUsr = 'ec2-user' - stage('Git Checkout'){ - git branch: 'master', - credentialsId: 'github', - url: 'https://github.com/javahometech/my-app' - } - - stage('Build'){ - sh "${mvn} clean package" - } - stage('deploy-to-dev'){ - sh 'mv target/myweb*.war target/myweb.war' - sshagent(['tomcat-dev']) { - sh "ssh -o StrictHostKeyChecking=no ${tomcatUsr}@172.31.12.253 /opt/tomcat8/bin/shutdown.sh" - sh "ssh ${tomcatUsr}@172.31.12.253 rm -rf /opt/tomcat8/webapps/myweb*" - sh "scp target/myweb.war ${tomcatUsr}@172.31.12.253:/opt/tomcat8/webapps/" - sh "ssh ${tomcatUsr}@172.31.12.253 /opt/tomcat8/bin/startup.sh" - mail bcc: '', - body: '''myweb app deployed to Dev - Thanks - DevOps''', - cc: '', - from: '', replyTo: '', - subject: 'myweb app deployed to Dev', - to: 'hari.kammana@gmail.com' - } - } -} From 2338a2afe41949bab5c34430d3527ca5158ab8ed Mon Sep 17 00:00:00 2001 From: prabaharan0312126 Date: Mon, 25 Feb 2019 19:58:21 -0600 Subject: [PATCH 13/24] Delete sonarqube-analysis --- sonarqube-analysis | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 sonarqube-analysis diff --git a/sonarqube-analysis b/sonarqube-analysis deleted file mode 100644 index 5c0c50a12ad..00000000000 --- a/sonarqube-analysis +++ /dev/null @@ -1,32 +0,0 @@ -node{ - stage('SCM Checkout'){ - git 'https://github.com/javahometech/my-app' - } - stage('Compile-Package'){ - // Get maven home path - def mvnHome = tool name: 'maven-3', type: 'maven' - sh "${mvnHome}/bin/mvn package" - } - - stage('SonarQube Analysis') { - def mvnHome = tool name: 'maven-3', type: 'maven' - withSonarQubeEnv('sonar-6') { - sh "${mvnHome}/bin/mvn sonar:sonar" - } - } - - stage('Email Notification'){ - mail bcc: '', body: '''Hi Welcome to jenkins email alerts - Thanks - Hari''', cc: '', from: '', replyTo: '', subject: 'Jenkins Job', to: 'hari.kammana@gmail.com' - } - stage('Slack Notification'){ - slackSend baseUrl: 'https://hooks.slack.com/services/', - channel: '#jenkins-pipeline-demo', - color: 'good', - message: 'Welcome to Jenkins, Slack!', - teamDomain: 'javahomecloud', - tokenCredentialId: 'slack-demo' - } - -} From 1ecee78ee20ea5f96fbf58a0cc2001896e742d84 Mon Sep 17 00:00:00 2001 From: prabaharan0312126 Date: Mon, 25 Feb 2019 19:59:31 -0600 Subject: [PATCH 14/24] Delete sonar-status-check --- sonar-status-check | 47 ---------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 sonar-status-check diff --git a/sonar-status-check b/sonar-status-check deleted file mode 100644 index 8f82dc44a33..00000000000 --- a/sonar-status-check +++ /dev/null @@ -1,47 +0,0 @@ -node{ - stage('SCM Checkout'){ - git 'https://github.com/javahometech/my-app' - } - stage('Compile-Package'){ - // Get maven home path - def mvnHome = tool name: 'maven-3', type: 'maven' - sh "${mvnHome}/bin/mvn package" - } - - stage('SonarQube Analysis') { - def mvnHome = tool name: 'maven-3', type: 'maven' - withSonarQubeEnv('sonar-6') { - sh "${mvnHome}/bin/mvn sonar:sonar" - } - } - - stage("Quality Gate Statuc Check"){ - timeout(time: 1, unit: 'HOURS') { - def qg = waitForQualityGate() - if (qg.status != 'OK') { - slackSend baseUrl: 'https://hooks.slack.com/services/', - channel: '#jenkins-pipeline-demo', - color: 'danger', - message: 'SonarQube Analysis Failed', - teamDomain: 'javahomecloud', - tokenCredentialId: 'slack-demo' - error "Pipeline aborted due to quality gate failure: ${qg.status}" - } - } - } - - stage('Email Notification'){ - mail bcc: '', body: '''Hi Welcome to jenkins email alerts - Thanks - Hari''', cc: '', from: '', replyTo: '', subject: 'Jenkins Job', to: 'hari.kammana@gmail.com' - } - stage('Slack Notification'){ - slackSend baseUrl: 'https://hooks.slack.com/services/', - channel: '#jenkins-pipeline-demo', - color: 'good', - message: 'Welcome to Jenkins, Slack!', - teamDomain: 'javahomecloud', - tokenCredentialId: 'slack-demo' - } - -} From f927515adc2c4d08f7d15ac89e230335f69ee749 Mon Sep 17 00:00:00 2001 From: prabaharan0312126 Date: Mon, 25 Feb 2019 19:58:41 -0600 Subject: [PATCH 15/24] Delete scm_demo --- scm_demo | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 scm_demo diff --git a/scm_demo b/scm_demo deleted file mode 100644 index 8e05d6eaf96..00000000000 --- a/scm_demo +++ /dev/null @@ -1,6 +0,0 @@ -node { - - def scmVars = checkout scm - def commitHash = scmVars.GIT_COMMIT - echo commitHash -} From 6d8da180c081d66bd4e46206deb3cca3a8911079 Mon Sep 17 00:00:00 2001 From: prabaharan0312126 Date: Mon, 25 Feb 2019 19:58:55 -0600 Subject: [PATCH 16/24] Delete jenkins-pipeline-9am-sep-2018 --- jenkins-pipeline-9am-sep-2018 | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 jenkins-pipeline-9am-sep-2018 diff --git a/jenkins-pipeline-9am-sep-2018 b/jenkins-pipeline-9am-sep-2018 deleted file mode 100644 index 8c96ff7c9d2..00000000000 --- a/jenkins-pipeline-9am-sep-2018 +++ /dev/null @@ -1,32 +0,0 @@ -try{ - node{ - stage('Git Checkout'){ - git credentialsId: 'github', - url: 'https://github.com/javahometech/my-app', - branch: "${params.gitBranch}" - } - - stage('Maven Build'){ - sh 'mvn clean package' - } - stage('Deploy to Dev'){ - sh 'mv target/*.war target/myweb.war' - sshagent(['tomcat-dev']) { - sh 'ssh ec2-user@172.31.17.196 rm -rf /opt/tomcat8/webapps/myweb*' - sh 'scp target/myweb.war ec2-user@172.31.17.196:/opt/tomcat8/webapps/' - sh 'ssh ec2-user@172.31.17.196 sudo service tomcat restart' - } - slackSend channel: '#devops-2', - color: 'good', - message: "Job - ${env.JOB_NAME}, Completed successfully Build URL is ${env.BUILD_URL}" - - - } -} - -}catch(error){ - slackSend channel: '#devops-2', - color: 'danger', - message: "Job - ${env.JOB_NAME}, Failed, Build URL is ${env.BUILD_URL}" - error 'Something wrong' -} From 4c15d348c33998cfd9f8451a94168e62662af9b8 Mon Sep 17 00:00:00 2001 From: prabaharan0312126 Date: Mon, 25 Feb 2019 19:59:13 -0600 Subject: [PATCH 17/24] Delete docker-ci-cd-youtube --- docker-ci-cd-youtube | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 docker-ci-cd-youtube diff --git a/docker-ci-cd-youtube b/docker-ci-cd-youtube deleted file mode 100644 index 1d7d6482929..00000000000 --- a/docker-ci-cd-youtube +++ /dev/null @@ -1,25 +0,0 @@ -node{ - stage('SCM Checkout'){ - git credentialsId: 'git-creds', url: 'https://github.com/javahometech/my-app' - } - stage('Mvn Package'){ - def mvnHome = tool name: 'maven-3', type: 'maven' - def mvnCMD = "${mvnHome}/bin/mvn" - sh "${mvnCMD} clean package" - } - stage('Build Docker Image'){ - sh 'docker build -t kammana/my-app:2.0.0 .' - } - stage('Push Docker Image'){ - withCredentials([string(credentialsId: 'docker-pwd', variable: 'dockerHubPwd')]) { - sh "docker login -u kammana -p ${dockerHubPwd}" - } - sh 'docker push kammana/my-app:2.0.0' - } - stage('Run Container on Dev Server'){ - def dockerRun = 'docker run -p 8080:8080 -d --name my-app kammana/my-app:2.0.0' - sshagent(['dev-server']) { - sh "ssh -o StrictHostKeyChecking=no ec2-user@172.31.18.198 ${dockerRun}" - } - } -} From 98837b160a3c36ad1433ab9bea97d3afc71c2ac5 Mon Sep 17 00:00:00 2001 From: prabaharan0312126 Date: Mon, 25 Feb 2019 20:00:31 -0600 Subject: [PATCH 18/24] Delete pipeline-docker-ci-cd --- pipeline-docker-ci-cd | 41 ----------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 pipeline-docker-ci-cd diff --git a/pipeline-docker-ci-cd b/pipeline-docker-ci-cd deleted file mode 100644 index 0b5800bb292..00000000000 --- a/pipeline-docker-ci-cd +++ /dev/null @@ -1,41 +0,0 @@ - - -node{ - stage('Git Checkout'){ - git url: 'https://github.com/javahometech/my-app', - branch:'master' - } - stage('MVN Package'){ - def mvnHome = tool name: 'maven-3', type: 'maven' - sh "${mvnHome}/bin/mvn clean package" - } - stage('Build Docker Image'){ - sh 'docker build -t kammana/my-app:0.0.1 .' - } - - stage('Upload Image to DockerHub'){ - withCredentials([string(credentialsId: 'docker-hub', variable: 'password')]) { - sh "docker login -u kammana -p ${password}" - } - sh 'docker push kammana/my-app:0.0.1' - } - stage('Remove Old Containers'){ - sshagent(['my-app-dev']) { - try{ - def sshCmd = 'ssh -o StrictHostKeyChecking=no ec2-user@172.31.18.198' - def dockerRM = 'docker rm -f my-app' - sh "${sshCmd} ${dockerRM}" - }catch(error){ - - } - } - } - stage('Deploy-Dev'){ - sshagent(['my-app-dev']) { - input 'Deploy to Dev?' - def sshCmd = 'ssh -o StrictHostKeyChecking=no ec2-user@172.31.18.198' - def dockerRun = 'docker run -d -p 8080:8080 --name my-app kammana/my-app:0.0.1' - sh "${sshCmd} ${dockerRun}" - } - } -} From 9c1b17e14a8ccdcfd307741dde9c06497096109e Mon Sep 17 00:00:00 2001 From: prabaharan0312126 Date: Mon, 25 Feb 2019 20:01:32 -0600 Subject: [PATCH 19/24] Delete docker-ci-cd --- docker-ci-cd | 39 --------------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 docker-ci-cd diff --git a/docker-ci-cd b/docker-ci-cd deleted file mode 100644 index a4d09c3dcc1..00000000000 --- a/docker-ci-cd +++ /dev/null @@ -1,39 +0,0 @@ -node{ - stage('Git Checkout'){ - git 'https://github.com/javahometech/my-app' - } - stage('Maven Package'){ - sh 'mvn clean package' - sh 'mv target/myweb*.war target/myweb.war' - } - - stage('Build Docker Imager'){ - sh 'docker build -t kammana/myweb:0.0.1 .' - } - - stage('Push to Docker Hub'){ - - withCredentials([string(credentialsId: 'github-pwd', variable: 'dockerHubPwd')]) { - sh "docker login -u kammana -p ${dockerHubPwd}" - } - sh 'docker push kammana/myweb:0.0.1' - } - stage('Remove Previous Container'){ - try{ - def dockerRm = 'docker rm -f myweb' - sshagent(['docker-dev']) { - sh "ssh -o StrictHostKeyChecking=no ec2-user@172.31.17.196 ${dockerRm}" - } - }catch(error){ - // do nothing if there is an exception - } - } - stage('Deploy to Dev Environment'){ - def dockerRun = 'docker run -d -p 8080:8080 --name myweb kammana/myweb:0.0.1 ' - sshagent(['docker-dev']) { - sh "ssh -o StrictHostKeyChecking=no ec2-user@172.31.17.196 ${dockerRun}" - } - - } - -} From f167225c99ed5da0f7ede13ebe887a4f0d8b88a1 Mon Sep 17 00:00:00 2001 From: prabaharan0312126 Date: Mon, 25 Feb 2019 20:02:17 -0600 Subject: [PATCH 20/24] Delete docker-swarm-ci-cd --- docker-swarm-ci-cd | 41 ----------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 docker-swarm-ci-cd diff --git a/docker-swarm-ci-cd b/docker-swarm-ci-cd deleted file mode 100644 index 61c27747f7a..00000000000 --- a/docker-swarm-ci-cd +++ /dev/null @@ -1,41 +0,0 @@ -node{ - def pom = readMavenPom file: 'pom.xml' - def version = pom.version - def nexus_tag = "172.31.24.222:8083/myweb:${version}" - def mvnHome = tool name: 'maven-3', type: 'maven' - def mvn = "${mvnHome}/bin/mvn" - stage('SCM Checkout'){ - git 'https://github.com/javahometech/my-app' - } - stage('Maven Build'){ - sh "${mvn} clean package" - sh 'mv target/myweb*.war target/myweb.war' - } - - stage('Docker Build'){ - - sh "docker build -t ${nexus_tag} ." - } - - stage('Push to Nexus'){ - sh "docker login 172.31.24.222:8083 -u admin -p admin123" - sh "docker push ${nexus_tag}" - } - - stage('Deploy to swarm'){ - try{ - def service = "docker service create -d -p 90:8080 --replicas=7 --name=myweb ${nexus_tag}" - sshagent (credentials: ['docker-swarm-manager']) { - def svs = "ec2-user@13.233.223.243 ${service}" - sh "ssh -o StrictHostKeyChecking=no ${svs}" - } - }catch(e){ - def service = "docker service update --image=${nexus_tag} myweb" - sshagent (credentials: ['docker-swarm-manager']) { - def svs = "ec2-user@13.233.223.243 ${service}" - sh "ssh -o StrictHostKeyChecking=no ${svs}" - - } - } - } -} From 4a923a444028c0cec837c0802fa779eae9ae9cd6 Mon Sep 17 00:00:00 2001 From: prabaharan0312126 Date: Tue, 26 Feb 2019 23:23:48 +0530 Subject: [PATCH 21/24] Create sonar --- sonar | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 sonar diff --git a/sonar b/sonar new file mode 100644 index 00000000000..166c3c25968 --- /dev/null +++ b/sonar @@ -0,0 +1,17 @@ + +node{ + stage('SCM Checkout'){ + git 'https://github.com/prabaharan0312126/my-app.git' + } + stage('Compile-Package'){ + + def mvnHome = tool name: 'maven3', type: 'maven' + sh "${mvnHome}/bin/mvn clean package" + sh 'mv target/myweb*.war target/newapp.war' + } + stage('SonarQube Analysis') { + def mvnHome = tool name: 'maven-3', type: 'maven' + withSonarQubeEnv('sonar') { + sh "${mvnHome}/bin/mvn sonar:sonar" + } + } From b05530459fba93b4e9440136e739fe576ba9ffaa Mon Sep 17 00:00:00 2001 From: prabaharan0312126 Date: Tue, 26 Feb 2019 23:27:48 +0530 Subject: [PATCH 22/24] Update index.html --- src/main/webapp/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/webapp/index.html b/src/main/webapp/index.html index 8c42763535d..f4945ed111b 100755 --- a/src/main/webapp/index.html +++ b/src/main/webapp/index.html @@ -11,7 +11,7 @@
-

Hi this is my first work

+

Hi sonarqube is onboarded

From 94409cd52bbe1ff15d3f597e6d48147a6083795e Mon Sep 17 00:00:00 2001 From: prabaharan0312126 Date: Sun, 31 Oct 2021 16:55:28 +0530 Subject: [PATCH 23/24] Update Jenkinsfile --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index 093ff56b111..651d32ea18e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -28,3 +28,4 @@ node{ } } +} From 66e96df043ee4537b448234c68795694cf4b6742 Mon Sep 17 00:00:00 2001 From: prabaharan0312126 Date: Wed, 16 Nov 2022 22:33:42 +0530 Subject: [PATCH 24/24] Set up CI with Azure Pipelines [skip ci] --- azure-pipelines.yml | 68 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 00000000000..47da5907347 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,68 @@ +# Maven package Java project Web App to Linux on Azure +# Build your Java project and deploy it to Azure as a Linux web app +# Add steps that analyze code, save build artifacts, deploy, and more: +# https://docs.microsoft.com/azure/devops/pipelines/languages/java + +trigger: +- master + +variables: + + # Azure Resource Manager connection created during pipeline creation + azureSubscription: '9173b8cb-c772-406d-a356-d95d4cc6f96b' + + # Web app name + webAppName: 'prabhaApp1' + + # Environment name + environmentName: 'prabhaApp1' + + # Agent VM image name + vmImageName: 'ubuntu-latest' + +stages: +- stage: Build + displayName: Build stage + jobs: + - job: MavenPackageAndPublishArtifacts + displayName: Maven Package and Publish Artifacts + pool: + vmImage: $(vmImageName) + + steps: + - task: Maven@3 + displayName: 'Maven Package' + inputs: + mavenPomFile: 'webapp/pom.xml' + + - task: CopyFiles@2 + displayName: 'Copy Files to artifact staging directory' + inputs: + SourceFolder: '$(System.DefaultWorkingDirectory)' + Contents: '**/target/*.?(war|jar)' + TargetFolder: $(Build.ArtifactStagingDirectory) + + - upload: $(Build.ArtifactStagingDirectory) + artifact: drop + +- stage: Deploy + displayName: Deploy stage + dependsOn: Build + condition: succeeded() + jobs: + - deployment: DeployLinuxWebApp + displayName: Deploy Linux Web App + environment: $(environmentName) + pool: + vmImage: $(vmImageName) + strategy: + runOnce: + deploy: + steps: + - task: AzureWebApp@1 + displayName: 'Azure Web App Deploy: prabhaApp1' + inputs: + azureSubscription: $(azureSubscription) + appType: webAppLinux + appName: $(webAppName) + package: '$(Pipeline.Workspace)/drop/**/target/*.?(war|jar)'