-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathJenkins_GMT
More file actions
46 lines (40 loc) · 1.26 KB
/
Jenkins_GMT
File metadata and controls
46 lines (40 loc) · 1.26 KB
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
45
46
pipeline{
agent any
environment{
PATH = "/opt/maven3/bin:$PATH"
}
stages{
stage(Mavan Installing){
stpes{
ansiblePlaybook credentialsId: 'private_key', disableHostKeyChecking: true, installation: 'ansible2', inventory: 'myinventory', playbook: 'maven.xml'
}
}
stage(Tomcat Inastalling){
steps{
ansiblePlaybook credentialsId: 'private_key', disableHostKeyChecking: true, installation: 'ansible2', inventory: 'myinventory', playbook: 'tomcat.xml'
}
}
stage(Git Check Out){
steps{
git credentialsId: 'Javahome', url: 'https://github.com/anilkumardevoops/DevOps_Class.git'
}
}
stage(Maven Build){
steps{
sh "mvn clean package"
sh "mv target/*.war target/Sample.web"
}
}
stage(Deployment){
steps{
sshagent(['tomcat']) {
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
"""
}
}
}
}
}