forked from javahometech/my-app
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
javahometech
authored
Jan 19, 2019
1 parent
6bf0055
commit 3e6bb77
Showing
1 changed file
with
22 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,26 @@ | ||
node{ | ||
|
||
def tomcatIp = '172.31.14.131' | ||
def tomcatUser = 'ec2-user' | ||
def stopTomcat = "ssh ${tomcatUser}@${tomcatIp} /opt/tomcat8/bin/shutdown.sh" | ||
def startTomcat = "ssh ${tomcatUser}@${tomcatIp} /opt/tomcat8/bin/startup.sh" | ||
def copyWar = "scp -o StrictHostKeyChecking=no target/myweb.war ${tomcatUser}@${tomcatIp}:/opt/tomcat8/webapps/" | ||
stage('SCM Checkout'){ | ||
git 'https://github.com/javahometech/my-app' | ||
git branch: 'master', | ||
credentialsId: 'javahometech', | ||
url: 'https://github.com/javahometech/myweb' | ||
} | ||
stage('Maven Build'){ | ||
def mvnHome = tool name: 'maven3', type: 'maven' | ||
sh "${mvnHome}/bin/mvn clean package" | ||
} | ||
|
||
stage('Deploy Dev'){ | ||
sh 'mv target/myweb*.war target/myweb.war' | ||
|
||
sshagent(['tomcat-dev']) { | ||
sh "${stopTomcat}" | ||
sh "${copyWar}" | ||
sh "${startTomcat}" | ||
} | ||
} | ||
stage('Compile-Package'){ | ||
// Get maven home path | ||
def mvnHome = tool name: 'maven-3', type: 'maven' | ||
sh "${mvnHome}/bin/mvn package" | ||
} | ||
|
||
} |