-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathJenkins-Declarative-Git
37 lines (31 loc) · 1016 Bytes
/
Jenkins-Declarative-Git
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
36
37
currentBuild.displayName = "online-shopping-#"+currentBuild.number
pipeline{
agent any
environment{
PATH = "/opt/maven3/bin:$PATH"
}
stages{
stage("Git Checkout"){
steps{
git credentialsId: 'github', url: 'https://github.com/javahometech/myweb'
}
}
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]:/opt/tomcat8/webapps/
ssh [email protected] /opt/tomcat8/bin/shutdown.sh
ssh [email protected] /opt/tomcat8/bin/startup.sh
"""
}
}
}
}
}