Jenkinsfile 1.74 KB
Newer Older
Peter van 't Hof's avatar
Peter van 't Hof committed
1
2
3
timeout(45) {
    node('local') {
        try {
Peter van 't Hof's avatar
Peter van 't Hof committed
4

Peter van 't Hof's avatar
Peter van 't Hof committed
5
6
7
8
            stage('Init') {
                tool 'JDK 8u102'
                tool 'Apache Maven 3.3.9'
            }
Peter van 't Hof's avatar
Peter van 't Hof committed
9

Peter van 't Hof's avatar
Peter van 't Hof committed
10
11
12
13
            stage('Checkout') {
                checkout scm
                sh 'git submodule update --init --recursive'
            }
Peter van 't Hof's avatar
Peter van 't Hof committed
14

Peter van 't Hof's avatar
Peter van 't Hof committed
15
16
17
18
            stage('Build and Test') {
                withMaven(maven: 'Apache Maven 3.3.9', jdk: 'JDK 8u102') {
                    sh 'mvn -B -T 2 -Dmaven.test.failure.ignore clean package'
                }
Peter van 't Hof's avatar
Peter van 't Hof committed
19
20
            }

Peter van 't Hof's avatar
Peter van 't Hof committed
21
22
23
            stage('Report Tests') {
                junit '*/target/surefire-reports/*.xml'
            }
Peter van 't Hof's avatar
Peter van 't Hof committed
24

Peter van 't Hof's avatar
Peter van 't Hof committed
25
26
27
            stage('Check Documentation') {
                sh 'mkdocs build --clean --strict'
            }
akaljuvee's avatar
akaljuvee committed
28

Peter van 't Hof's avatar
Peter van 't Hof committed
29
30
31
32
33
34
            if (currentBuild.result == null || "SUCCESS".equals(currentBuild.result)) {
                currentBuild.result = "SUCCESS"
                slackSend(color: '#00FF00', message: "${currentBuild.result}: Job '${env.JOB_NAME} #${env.BUILD_NUMBER}' (<${env.BUILD_URL}|Open>)", channel: '#biopet-bot', teamDomain: 'lumc', tokenCredentialId: 'lumc')
            } else {
                slackSend(color: '#FFFF00', message: "${currentBuild.result}: Job '${env.JOB_NAME} #${env.BUILD_NUMBER}' (<${env.BUILD_URL}|Open>)", channel: '#biopet-bot', teamDomain: 'lumc', tokenCredentialId: 'lumc')
            }
Peter van 't Hof's avatar
Peter van 't Hof committed
35

Peter van 't Hof's avatar
Peter van 't Hof committed
36
37
38
39
40
        } catch (e) {
            if (currentBuild.result == null || "FAILED".equals(currentBuild.result)) {
                currentBuild.result = "FAILED"
            }
            slackSend(color: '#FF0000', message: "${currentBuild.result}: Job '${env.JOB_NAME} #${env.BUILD_NUMBER}' (<${env.BUILD_URL}|Open>)", channel: '#biopet-bot', teamDomain: 'lumc', tokenCredentialId: 'lumc')
Peter van 't Hof's avatar
Peter van 't Hof committed
41

Peter van 't Hof's avatar
Peter van 't Hof committed
42
43
            throw e
        }
Peter van 't Hof's avatar
Peter van 't Hof committed
44
    }
Peter van 't Hof's avatar
Peter van 't Hof committed
45
}