forked from cytomine/Cytomine-core-spring
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
executable file
·78 lines (63 loc) · 2.35 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
node {
stage ('Retrieve sources') {
checkout([
$class: 'GitSCM',
branches: [[name: 'refs/heads/'+env.BRANCH_NAME]],
extensions: [[$class: 'CloneOption', noTags: false, shallow: false, depth: 0, reference: '']],
userRemoteConfigs: scm.userRemoteConfigs,
])
}
stage ('Clean') {
sh 'rm -rf ./ci'
sh 'mkdir -p ./ci'
}
stage ('Compute version name') {
sh 'scripts/ciBuildVersion.sh ${BRANCH_NAME}'
}
stage ('Download and cache dependencies') {
sh 'scripts/ciDownloadDependencies.sh'
}
lock('cytomine-instance-test') {
stage ('Run external tools (db, amqp,...)') {
catchError (buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
sh 'docker-compose -f scripts/docker-compose-test.yml down -v'
}
sh 'docker-compose -f scripts/docker-compose-test.yml up -d'
}
stage ('Build and test') {
catchError(buildResult: 'SUCCESS', stageResult: 'UNSTABLE') {
sh 'scripts/ciTest.sh'
}
}
stage ('Publish test') {
step([$class: 'JUnitResultArchiver', testResults: '**/ci/build/test-results/**/*.xml'])
}
stage ('Publish coverage') {
step([$class: 'JacocoPublisher', runAlways: true, execPattern: '**/**.exec',classPattern: '**/classes',sourcePattern: '**/src/main/java',exclusionPattern: '**/src/test*'])
}
stage ('Clear cytomine instance') {
catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') {
sh 'docker-compose -f scripts/docker-compose-test.yml down -v'
}
}
}
stage ('Final') {
sh 'echo finish'
}
stage ('Build jar') {
sh 'scripts/ciBuildJar.sh'
}
stage ('Publish jar') {
sh 'scripts/ciPublishJar.sh'
stage 'Build docker image'
withCredentials(
[
usernamePassword(credentialsId: 'DOCKERHUB_CREDENTIAL', usernameVariable: 'DOCKERHUB_USER', passwordVariable: 'DOCKERHUB_TOKEN')
]
) {
docker.withRegistry('https://index.docker.io/v1/', 'DOCKERHUB_CREDENTIAL') {
sh 'scripts/ciBuildDockerImage.sh'
}
}
}
}