-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
82 lines (75 loc) · 2.96 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
pipeline {
agent {
label 'master'
}
options {
gitLabConnection('Gitlab')
gitlabBuilds(builds: ['setup', 'build'])
}
stages {
stage('prepare') {
steps {
script{
try {
sh '''
containerId=$( head -1 /proc/self/cgroup|cut -d/ -f3 )
docker network create neo4jtest
docker network connect neo4jtest $containerId
docker container run --rm --network neo4jtest --name neo4j-graph-db -d aist.fh-hagenberg.at:18444/repository/docker-util/aist-neo4j-with-apoc
'''
} catch(ex) {
echo 'could not start docker container, trying to reboot it...'
sh '''
containerId=$( head -1 /proc/self/cgroup|cut -d/ -f3 )
docker network disconnect neo4jtest $containerId
docker network rm neo4jtest
docker container stop neo4j-graph-db
docker container run --rm --name neo4j-graph-db -d aist.fh-hagenberg.at:18444/repository/docker-util/aist-neo4j-with-apoc
'''
currentBuild.result = 'SUCCESS' // If we get this far, override the FAILURE build result from the exception
} finally {
sh 'sleep 30s'
}
}
}
post {
failure {
updateGitlabCommitStatus name: 'setup', state: 'failed'
}
success {
updateGitlabCommitStatus name: 'setup', state: 'success'
}
unstable {
updateGitlabCommitStatus name: 'setup', state: 'failed'
}
}
}
stage('build') {
steps {
sh '''
mvn -Dmaven.javadoc.skip=true -Pjenkins -Psonar-coverage clean install sonar:sonar -Dsonar.scm.disabled=true
'''
}
post {
always {
junit '**/target/surefire-reports/TEST-*.xml'
sh '''
containerId=$( head -1 /proc/self/cgroup|cut -d/ -f3 )
docker network disconnect neo4jtest $containerId
docker container stop neo4j-graph-db
docker network rm neo4jtest
'''
}
failure {
updateGitlabCommitStatus name: 'build', state: 'failed'
}
success {
updateGitlabCommitStatus name: 'build', state: 'success'
}
unstable {
updateGitlabCommitStatus name: 'build', state: 'failed'
}
}
}
}
}