-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile
50 lines (44 loc) · 1.27 KB
/
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
45
46
47
48
49
50
node {
env.JAVA_HOME = tool name: 'OpenJDK 17', type: 'jdk'
def mvnHome = tool name: 'Maven35', type: 'maven'
echo "We are currently working on branch: ${env.BRANCH_NAME}"
echo "JDK installation path is: ${env.JAVA_HOME}"
stage ('Checkout'){
// Checkout code from repository
checkout scm
}
stage ('Build'){
try {
// Build with maven
sh("${mvnHome}/bin/mvn clean install -P env-testing")
}
finally {
// Capture test reports
junit '**/target/surefire-reports/*.xml'
}
}
stage ('Deploy'){
switch (env.BRANCH_NAME){
case 'dev':
echo "deploy to dev";
sshagent(['26045cb2-b6f5-4f07-8261-70a2f2e22860']) {
sh "scp target/imeji.war [email protected]:/srv/web/tomcat9/webapps"
}
break;
case 'qa':
echo "deploy to qa";
sshagent(['26045cb2-b6f5-4f07-8261-70a2f2e22860']) {
sh "scp target/imeji.war [email protected]:/srv/web/tomcat9/webapps"
}
break;
case 'openjdk11':
echo "deploy to dev with tomcat9 / openjdk 11";
sshagent(['26045cb2-b6f5-4f07-8261-70a2f2e22860']) {
sh "scp target/imeji.war [email protected]:/srv/web/tomcat9/webapps"
}
break;
default:
echo "no deployment";
}
}
}