forked from javahometech/my-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
44 lines (30 loc) · 971 Bytes
/
Jenkinsfile
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
38
39
40
41
42
43
44
pipeline{
agent any
environment{
PATH = "/opt/apache-maven-3.6.3/bin:$PATH"
}
stages{
stage('Git Checkout'){
steps{
git 'https://github.com/sudheer5561/my-app.git'
}
}
stage('Build'){
steps{
sh 'mvn clean package'
sh 'mv target/*.war target/myapp.war'
}
}
stage('Deploy'){
steps{
sshagent(['tomcat-root-ID']) {
sh """
scp -o StrictHostKeyChecking=no target/myapp.war [email protected]:/opt/apache-tomcat-9.0.31/webapps/
ssh [email protected] '/opt/apache-tomcat-9.0.31/bin/shutdown.sh'
ssh [email protected] '/opt/apache-tomcat-9.0.31/bin/startup.sh'
"""
}
}
}
}
}