-
Notifications
You must be signed in to change notification settings - Fork 11
/
Jenkinsfile
78 lines (72 loc) · 2.21 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
def dockerImage = 'docker-registry.ocean.icm.edu.pl/eu.openaire.iis.builder:latest'
def dockerArgs(env) { return "-e JAVA_TOOL_OPTIONS=-Duser.home=${env.WORKSPACE}"; }
pipeline {
agent any
triggers {
cron('H H(20-23) * * 1-5')
pollSCM('H * * * 1-5')
}
options {
buildDiscarder(logRotator(numToKeepStr: '5'))
lock('iis-build')
timeout time: 60, unit: 'MINUTES'
}
environment {
ARTIFACTORY_DEPLOY=credentials('artifactory-deploy')
}
stages {
stage('Build') {
agent {
docker {
image dockerImage
reuseNode true
args dockerArgs(env)
}
}
steps {
sh '''
mvn -B clean install -DskipITs -DotherExcludedGroups=SlowTest \
-Djunit.jupiter.testmethod.order.default=org.junit.jupiter.api.MethodOrderer\\$Random \
-Djunit.jupiter.testclass.order.default=org.junit.jupiter.api.ClassOrderer\\$Random \
-Dmaven.test.failure.ignore
'''
}
post {
always {
recordIssues(tools: [mavenConsole(), java()])
junit "**/target/surefire-reports/*.xml"
jacoco()
}
}
}
stage('Deploy') {
agent {
docker {
image dockerImage
reuseNode true
args dockerArgs(env)
}
}
when { branch 'master' }
steps {
sh 'mvn -B deploy -s deploy-settings.xml -DskipTests'
}
}
}
post {
unstable {
emailext (
subject: "Build unstable in Jenkins: ${env.JOB_NAME} #${env.BUILD_NUMBER}",
body: "Unstable job '${env.JOB_NAME}' #${env.BUILD_NUMBER}: check console output at ${env.BUILD_URL}.",
recipientProviders: [developers()]
)
}
failure {
emailext (
subject: "Build failed in Jenkins: ${env.JOB_NAME} #${env.BUILD_NUMBER}",
body: "Failed job '${env.JOB_NAME}' #${env.BUILD_NUMBER}: check console output at ${env.BUILD_URL}.",
recipientProviders: [developers()]
)
}
}
}