-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile_1.0
45 lines (40 loc) · 1.17 KB
/
Jenkinsfile_1.0
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
pipeline {
agent any
tools {
maven 'localMaven'
}
parameters {
string(name: 'tomcat_stag', defaultValue: '13.59.108.184', description: 'Node1-Remote Staging Server')
string(name: 'tomcat_prod', defaultValue: '18.219.228.98', description: 'Node2-Remote Production Server')
}
triggers {
pollSCM('* * * * *')
}
stages{
stage('Build'){
steps {
sh 'mvn clean package'
}
post {
success {
echo 'Archiving the artifacts'
archiveArtifacts artifacts: '**/target/*.war'
}
}
}
stage ('Deployments'){
parallel{
stage ('Deploy to Staging'){
steps {
sh "scp **/*.war jenkins@${params.tomcat_stag}:/usr/share/tomcat/webapps/"
}
}
stage ("Deploy to Production"){
steps {
sh "scp **/*.war jenkins@${params.tomcat_prod}:/usr/share/tomcat/webapps/"
}
}
}
}
}
}