forked from Cytomine-ULiege/pims
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Jenkinsfile
executable file
·36 lines (31 loc) · 1.12 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
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/ciCreateDependencyImage.sh'
stage 'Run tests'
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
sh 'scripts/ciTest.sh'
}
stage 'Publish tests'
step([$class: 'JUnitResultArchiver', testResults: '**/ci/test-reports/*.xml'])
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'
}
}
}