forked from javahometech/myweb
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
Jenkins-decnew
35 lines (30 loc) · 1.01 KB
/
Jenkins-decnew
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
pipeline{
agent any
environment{
PATH = "/opt/maven3/bin:$PATH"
}
stages{
stage("Git Checkout"){
steps{
git credentialsId: 'javahome2', url: 'https://github.com/srinivas1987devops/myweb.git'
}
}
stage("Maven Build"){
steps{
sh "mvn clean package"
sh "mv target/*.war target/myweb.war"
}
}
stage("deploy-dev"){
steps{
sshagent(['tomcat-new']) {
sh """
scp -o StrictHostKeyChecking=no target/myweb.war [email protected]:/home/ec2-user/apache-tomcat-9.0.64/webapps/
ssh [email protected] /home/ec2-user/apache-tomcat-9.0.64/bin/shutdown.sh
ssh [email protected] /home/ec2-user/apache-tomcat-9.0.64/bin/startup.sh
"""
}
}
}
}
}