From 6d980fe406d23d6093b54ff51d057b3bc53fad0a Mon Sep 17 00:00:00 2001 From: new srre <91159068+sree141@users.noreply.github.com> Date: Mon, 1 Nov 2021 17:32:59 +0530 Subject: [PATCH 01/14] Create jenkins --- jenkins | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 jenkins diff --git a/jenkins b/jenkins new file mode 100644 index 00000000..8221bbca --- /dev/null +++ b/jenkins @@ -0,0 +1,28 @@ +pipeline{ + agent any + stages{ + stage("Git Checkout"){ + steps{ + git credentialsId: 'github', url: 'https://github.com/aditya-malviya/myweb.git' + } + } + stage("Maven Build"){ + steps{ + sh "mvn clean package" + sh "mv target/*.war target/myweb.war" + } + } + stage("deploy-dev"){ + steps{ + sshagent(['tomcat-dev1']) { + sh """ + scp -o StrictHostKeyChecking=no target/myweb.war + ubuntu@yourip:/opt/tomcat/webapps/ + ssh ubuntu@yourip /opt/tomcat/bin/shutdown.sh + ssh ubuntu@yourip /opt/tomcat/bin/startup.sh + """ + } + } + } + } + } From fe3f762a9028dccff8bdfb31344b24d38b81514b Mon Sep 17 00:00:00 2001 From: new srre <91159068+sree141@users.noreply.github.com> Date: Mon, 1 Nov 2021 17:41:27 +0530 Subject: [PATCH 02/14] Update jenkins --- jenkins | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins b/jenkins index 8221bbca..80b87044 100644 --- a/jenkins +++ b/jenkins @@ -3,7 +3,7 @@ pipeline{ stages{ stage("Git Checkout"){ steps{ - git credentialsId: 'github', url: 'https://github.com/aditya-malviya/myweb.git' + git credentialsId: 'github', url: 'https://github.com/sree141/SaiJavaCode.git' } } stage("Maven Build"){ From 4a2841d8a05d80c65b518e6bb1cff9364d6ad2fa Mon Sep 17 00:00:00 2001 From: new srre <91159068+sree141@users.noreply.github.com> Date: Mon, 1 Nov 2021 17:46:48 +0530 Subject: [PATCH 03/14] Update and rename jenkins to Jenkinsfile --- jenkins => Jenkinsfile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) rename jenkins => Jenkinsfile (70%) diff --git a/jenkins b/Jenkinsfile similarity index 70% rename from jenkins rename to Jenkinsfile index 80b87044..cb198b4b 100644 --- a/jenkins +++ b/Jenkinsfile @@ -14,12 +14,13 @@ pipeline{ } stage("deploy-dev"){ steps{ - sshagent(['tomcat-dev1']) { + sshagent(['3.87.15.40']) { + // some block sh """ scp -o StrictHostKeyChecking=no target/myweb.war - ubuntu@yourip:/opt/tomcat/webapps/ - ssh ubuntu@yourip /opt/tomcat/bin/shutdown.sh - ssh ubuntu@yourip /opt/tomcat/bin/startup.sh + ubuntu@3.87.15.40:/opt/tomcat/webapps/ + ssh ubuntu@3.87.15.40 /opt/tomcat/bin/shutdown.sh + ssh ubuntu@3.87.15.40 /opt/tomcat/bin/startup.sh """ } } From d151aebee6aad84eb95be69fee3ac7fd57f1b52c Mon Sep 17 00:00:00 2001 From: new srre <91159068+sree141@users.noreply.github.com> Date: Mon, 1 Nov 2021 17:51:25 +0530 Subject: [PATCH 04/14] Update Jenkinsfile --- Jenkinsfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index cb198b4b..26260cfd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,7 +15,6 @@ pipeline{ stage("deploy-dev"){ steps{ sshagent(['3.87.15.40']) { - // some block sh """ scp -o StrictHostKeyChecking=no target/myweb.war ubuntu@3.87.15.40:/opt/tomcat/webapps/ From 84409c2c0bbb9e934d3de3dd51d2664b1d177b38 Mon Sep 17 00:00:00 2001 From: new srre <91159068+sree141@users.noreply.github.com> Date: Mon, 1 Nov 2021 17:55:42 +0530 Subject: [PATCH 05/14] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 26260cfd..14546b71 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,7 +8,7 @@ pipeline{ } stage("Maven Build"){ steps{ - sh "mvn clean package" + sh "/opt/apache-maven-3.8.3/bin/mvn package" sh "mv target/*.war target/myweb.war" } } From e7775fb29696e6e9b284a0e03caf5d88591afb4a Mon Sep 17 00:00:00 2001 From: new srre <91159068+sree141@users.noreply.github.com> Date: Mon, 1 Nov 2021 18:29:30 +0530 Subject: [PATCH 06/14] Update Jenkinsfile --- Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 14546b71..147ec4f5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,12 +14,12 @@ pipeline{ } stage("deploy-dev"){ steps{ - sshagent(['3.87.15.40']) { + sshagentsshagent(['3.82.186.105']) { sh """ scp -o StrictHostKeyChecking=no target/myweb.war - ubuntu@3.87.15.40:/opt/tomcat/webapps/ - ssh ubuntu@3.87.15.40 /opt/tomcat/bin/shutdown.sh - ssh ubuntu@3.87.15.40 /opt/tomcat/bin/startup.sh + ubuntu@3.82.186.105:/opt/tomcat/webapps/ + ssh ubuntu@3.82.186.105 /opt/tomcat/bin/shutdown.sh + ssh ubuntu@3.82.186.105 /opt/tomcat/bin/startup.sh """ } } From c109759776abae8d0b4e5268fc5353dd1f56deab Mon Sep 17 00:00:00 2001 From: new srre <91159068+sree141@users.noreply.github.com> Date: Mon, 1 Nov 2021 18:35:28 +0530 Subject: [PATCH 07/14] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 147ec4f5..e80c286e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ pipeline{ stage("Maven Build"){ steps{ sh "/opt/apache-maven-3.8.3/bin/mvn package" - sh "mv target/*.war target/myweb.war" + sh "mv target/*.war" } } stage("deploy-dev"){ From 52b2332dc2a9fefa9c5282984a34fb996e1f7caf Mon Sep 17 00:00:00 2001 From: new srre <91159068+sree141@users.noreply.github.com> Date: Mon, 1 Nov 2021 18:39:59 +0530 Subject: [PATCH 08/14] Update Jenkinsfile --- Jenkinsfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e80c286e..9370a374 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,14 +9,13 @@ pipeline{ stage("Maven Build"){ steps{ sh "/opt/apache-maven-3.8.3/bin/mvn package" - sh "mv target/*.war" } } stage("deploy-dev"){ steps{ sshagentsshagent(['3.82.186.105']) { sh """ - scp -o StrictHostKeyChecking=no target/myweb.war + scp -o StrictHostKeyChecking=no target/*.war ubuntu@3.82.186.105:/opt/tomcat/webapps/ ssh ubuntu@3.82.186.105 /opt/tomcat/bin/shutdown.sh ssh ubuntu@3.82.186.105 /opt/tomcat/bin/startup.sh From 091197f4e5db2834dee9e6a56de104b1c1231fc0 Mon Sep 17 00:00:00 2001 From: new srre <91159068+sree141@users.noreply.github.com> Date: Mon, 1 Nov 2021 19:11:15 +0530 Subject: [PATCH 09/14] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9370a374..f2a0e8b8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,7 +13,7 @@ pipeline{ } stage("deploy-dev"){ steps{ - sshagentsshagent(['3.82.186.105']) { + sshagent(['3.82.186.105']) { sh """ scp -o StrictHostKeyChecking=no target/*.war ubuntu@3.82.186.105:/opt/tomcat/webapps/ From 96eaac77fe9ec296dbfb7c2db53d02ea3482be5d Mon Sep 17 00:00:00 2001 From: new srre <91159068+sree141@users.noreply.github.com> Date: Mon, 1 Nov 2021 19:22:11 +0530 Subject: [PATCH 10/14] Update Jenkinsfile --- Jenkinsfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index f2a0e8b8..70b7a169 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,8 +15,7 @@ pipeline{ steps{ sshagent(['3.82.186.105']) { sh """ - scp -o StrictHostKeyChecking=no target/*.war - ubuntu@3.82.186.105:/opt/tomcat/webapps/ + scp -o StrictHostKeyChecking=no target/*.war ubuntu@3.82.186.105:/opt/tomcat/webapps/ ssh ubuntu@3.82.186.105 /opt/tomcat/bin/shutdown.sh ssh ubuntu@3.82.186.105 /opt/tomcat/bin/startup.sh """ From a745effa262dfbb4347f23a5a10d512f12af88a2 Mon Sep 17 00:00:00 2001 From: new srre <91159068+sree141@users.noreply.github.com> Date: Mon, 1 Nov 2021 19:24:57 +0530 Subject: [PATCH 11/14] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 70b7a169..b777e6e1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,7 +15,7 @@ pipeline{ steps{ sshagent(['3.82.186.105']) { sh """ - scp -o StrictHostKeyChecking=no target/*.war ubuntu@3.82.186.105:/opt/tomcat/webapps/ + scp -o StrictHostKeyChecking=no target/webapp.war ubuntu@3.82.186.105:/opt/tomcat/webapps/ ssh ubuntu@3.82.186.105 /opt/tomcat/bin/shutdown.sh ssh ubuntu@3.82.186.105 /opt/tomcat/bin/startup.sh """ From eacc7239f74e8fb43800c0ee7fcbf1455671027d Mon Sep 17 00:00:00 2001 From: new srre <91159068+sree141@users.noreply.github.com> Date: Mon, 1 Nov 2021 19:27:28 +0530 Subject: [PATCH 12/14] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index b777e6e1..e2b9303c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,7 +15,7 @@ pipeline{ steps{ sshagent(['3.82.186.105']) { sh """ - scp -o StrictHostKeyChecking=no target/webapp.war ubuntu@3.82.186.105:/opt/tomcat/webapps/ + scp -o StrictHostKeyChecking=no /var/lib/jenkins/workspace/sree55/webapp/target/webapp.war ubuntu@3.82.186.105:/opt/tomcat/webapps/ ssh ubuntu@3.82.186.105 /opt/tomcat/bin/shutdown.sh ssh ubuntu@3.82.186.105 /opt/tomcat/bin/startup.sh """ From 77fa3343a36875c3ad756f9ce7021ae47fb4cc4c Mon Sep 17 00:00:00 2001 From: new srre <91159068+sree141@users.noreply.github.com> Date: Mon, 1 Nov 2021 19:30:00 +0530 Subject: [PATCH 13/14] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index e2b9303c..bcd7d9ba 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,7 +15,7 @@ pipeline{ steps{ sshagent(['3.82.186.105']) { sh """ - scp -o StrictHostKeyChecking=no /var/lib/jenkins/workspace/sree55/webapp/target/webapp.war ubuntu@3.82.186.105:/opt/tomcat/webapps/ + scp -o StrictHostKeyChecking=no /var/lib/jenkins/workspace/sree55/webapp/target/webapp.war ubuntu@3.82.186.105:/opt/apache-tomcat-9.0.54/webapps ssh ubuntu@3.82.186.105 /opt/tomcat/bin/shutdown.sh ssh ubuntu@3.82.186.105 /opt/tomcat/bin/startup.sh """ From 1b9360ae71a5a637960449c23b4d0187eedb02b0 Mon Sep 17 00:00:00 2001 From: new srre <91159068+sree141@users.noreply.github.com> Date: Mon, 1 Nov 2021 19:34:34 +0530 Subject: [PATCH 14/14] Update Jenkinsfile --- Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bcd7d9ba..4733af2e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,8 +16,8 @@ pipeline{ sshagent(['3.82.186.105']) { sh """ scp -o StrictHostKeyChecking=no /var/lib/jenkins/workspace/sree55/webapp/target/webapp.war ubuntu@3.82.186.105:/opt/apache-tomcat-9.0.54/webapps - ssh ubuntu@3.82.186.105 /opt/tomcat/bin/shutdown.sh - ssh ubuntu@3.82.186.105 /opt/tomcat/bin/startup.sh + ssh ubuntu@3.82.186.105 /opt/apache-tomcat-9.0.54/bin/shutdown.sh + ssh ubuntu@3.82.186.105 /opt/apache-tomcat-9.0.54/bin/startup.sh """ } }