-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
83 lines (83 loc) · 2.14 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
pipeline {
agent any
environment {
PAYARA_PORT='4848'
PAYARA_HOME='/home/student/JavaTools/payara5.2020.5'
PAYARA_HOST='localhost'
APP_NAME='WM'
DERBY_BIN="/home/student/JavaTools/db-derby-10.14.2.0-bin/bin"
}
tools {
maven 'maven'
jdk 'OpenJDK'
}
stages {
stage('pre-build') {
steps {
sh 'mvn clean'
}
post {
success {
echo 'Cleaned up old project'
}
}
}
stage('build') {
steps {
sh 'mvn package -DskipTests'
}
post {
success {
echo 'Built application'
}
}
}
stage('pre-deploy') {
steps {
sh '''
${DERBY_BIN}/ij<<EOF
connect 'jdbc:derby://localhost:1527/WM;create=true;user=WM;password=WM';
exit;
EOF
'''
}
post {
success {
echo 'Pre-deploy application'
}
}
}
stage('deploy') {
steps {
sh '${PAYARA_HOME}/bin/asadmin flush-connection-pool WMCP'
sh '${PAYARA_HOME}/bin/asadmin --host ${PAYARA_HOST} --port ${PAYARA_PORT} deploy --force=true --name=${APP_NAME} ./target/WM-1.1.war'
}
post {
success {
echo 'Deploy application'
}
}
}
stage('post-deploy') {
steps {
sh 'chmod +x ./skrypt.sh'
sh '''./skrypt.sh'''
}
post {
success {
echo 'Initialize application database'
}
}
}
stage('parallel-tests') {
steps {
sh 'mvn test'
}
post {
success {
echo 'Parallel tests done'
}
}
}
}
}