forked from openaire/iis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
58 lines (53 loc) · 2.32 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
pipeline {
agent any
triggers {
cron("H H(20-23) * * 1-5")
}
options {
buildDiscarder(logRotator(numToKeepStr: "5"))
timeout time: 60, unit: "MINUTES"
}
stages {
stage("Package") {
steps {
configFileProvider([configFile(fileId: "iis-build-properties", variable: 'BUILD_PROPERTIES')]) {
load "${BUILD_PROPERTIES}"
withEnv(["JAVA_HOME=${ tool type: 'jdk', name: "$JDK_VERSION" }",
"PATH+MAVEN=${tool type: 'maven', name: "$MAVEN_VERSION"}/bin:${env.JAVA_HOME}/bin"]) {
withSonarQubeEnv('sonar.ceon.pl') {
//NOTE: sonar scan is only done for master branch because current Sonar instance does not support branching
sh '''
if [ $GIT_BRANCH = "master" ]; then
mvn clean package \
-DskipITs \
-Djava.net.preferIPv4Stack=true \
$SONAR_MAVEN_GOAL \
-Dsonar.host.url=$SONAR_HOST_URL
else
mvn clean package \
-DskipITs \
-Djava.net.preferIPv4Stack=true
fi
'''
}
}
}
}
}
}
post {
always {
warnings canComputeNew: false, canResolveRelativePaths: false, categoriesPattern: '', consoleParsers: [[parserName: 'Maven'], [parserName: 'Java Compiler (javac)']], defaultEncoding: '', excludePattern: '', healthy: '', includePattern: '', messagesPattern: '', unHealthy: ''
junit "**/target/surefire-reports/*.xml"
jacoco()
cleanWs()
}
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()]
)
}
}
}