-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathJenkinsfile
More file actions
50 lines (46 loc) · 1.33 KB
/
Jenkinsfile
File metadata and controls
50 lines (46 loc) · 1.33 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
47
48
49
50
pipeline {
agent any
environment {
RUN_PROFILES="prod"
RUN_PORT=8081
POM_VERSION="0.7"
SERVICE_NAME="wirerest"
RUN_ARGS="--spring.profiles.active=${RUN_PROFILES} " +
"--server.port=${RUN_PORT} " +
"--wg.interface.name=server " +
"--debug "
}
stages {
stage('Build') {
steps {
sh 'JAVA_HOME=/usr/lib/jvm/jdk-20 mvn clean validate compile'
}
}
stage('Test/Package') {
steps {
sh 'JAVA_HOME=/usr/lib/jvm/jdk-20 mvn package'
jacoco(execPattern: '**/target/*.exec')
recordCoverage(tools: [[parser: 'JACOCO']])
}
}
stage('Run'){
steps {
sh 'echo ARGS=${RUN_ARGS} > env'
sh 'echo JAR_PATH=`pwd`/target/${SERVICE_NAME}-${POM_VERSION}.jar >> env'
sh 'sudo cp env /etc/default/${SERVICE_NAME}'
sh 'sudo systemctl restart ${SERVICE_NAME}'
}
}
stage('Check'){
steps {
sleep 20
sh 'curl -s http://127.0.0.1:${RUN_PORT}/interface > /dev/null'
}
}
}
post {
failure {
sh 'sudo journalctl -u wirerest.service --no-pager -n 250'
}
}
}