-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
34 lines (28 loc) · 745 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
pipeline {
agent { label 'node01' }
parameters {
string defaultValue: '172.31.45.161', name: 'TOMCAT_SERVER'
string defaultValue: '/var/lib/tomcat9/webapps', name: 'TOMCAT_ROOT'
string defaultValue: 'ubuntu', name: 'TOMCAT_USER'
}
triggers {
pollSCM '* * * * *'
}
stages {
stage('Checkout') {
steps {
git branch: 'main', url: 'https://github.com/kogo28/source-maven-java-spring-hello-webapp.git'
}
}
stage('Maven Build') {
steps {
sh 'mvn clean package'
}
}
stage('Deploy to Tomcat') {
steps {
sh "scp ${env.WORKSPACE}/target/hello-world.war ${params.TOMCAT_USER}@${params.TOMCAT_SERVER}:${params.TOMCAT_ROOT}"
}
}
}
}