-
Notifications
You must be signed in to change notification settings - Fork 309
/
Jenkinsfile
82 lines (75 loc) · 3.37 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
79
80
81
82
node {
properties([
disableConcurrentBuilds(abortPrevious: true),
buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '2', daysToKeepStr: '', numToKeepStr: '5')),
gitLabConnection('gitlab.eclipse.org'),
[$class: 'RebuildSettings', autoRebuild: false, rebuildDisabled: false],
[$class: 'JobLocalConfiguration', changeReasonComment: '']
])
deleteDir()
stage('Preparation') {
dir("kura") {
checkout scm
}
}
stage('Build') {
timeout(time: 2, unit: 'HOURS') {
dir("kura") {
withMaven(jdk: 'adoptopenjdk-hotspot-jdk8-latest', maven: 'apache-maven-3.9.6') {
sh "touch /tmp/isJenkins.txt"
sh "mvn -f target-platform/pom.xml clean install -Pno-mirror -Pcheck-exists-plugin"
sh "mvn -f kura/pom.xml clean install -Pcheck-exists-plugin"
sh "mvn -f kura/distrib/pom.xml clean install -DbuildAll"
sh "mvn -f kura/examples/pom.xml clean install -Pcheck-exists-plugin"
}
}
}
}
stage('Generate test reports') {
dir("kura") {
junit 'kura/test/*/target/surefire-reports/*.xml,kura/examples/test/*/target/surefire-reports/*.xml'
}
}
stage('Archive .deb artifacts') {
dir("kura") {
archiveArtifacts artifacts: 'kura/distrib/target/*.deb', onlyIfSuccessful: true
}
}
stage('Sonar') {
timeout(time: 2, unit: 'HOURS') {
dir("kura") {
withMaven(jdk: 'temurin-jdk17-latest', maven: 'apache-maven-3.9.6') {
withCredentials([string(credentialsId: 'sonarcloud-token', variable: 'SONARCLOUD_TOKEN')]) {
withSonarQubeEnv {
sh '''
mvn -f kura/pom.xml sonar:sonar \
-Dmaven.test.failure.ignore=true \
-Dsonar.organization=eclipse \
-Dsonar.host.url=${SONAR_HOST_URL} \
-Dsonar.token=${SONARCLOUD_TOKEN} \
-Dsonar.branch.name=${BRANCH_NAME} \
-Dsonar.branch.target=${CHANGE_TARGET} \
-Dsonar.java.source=8 \
-Dsonar.java.binaries='target/' \
-Dsonar.core.codeCoveragePlugin=jacoco \
-Dsonar.projectKey=org.eclipse.kura:kura \
-Dsonar.exclusions=test/**/*.java,test-util/**/*.java,org.eclipse.kura.web2/**/*.java,org.eclipse.kura.nm/src/main/java/org/freedesktop/**/*,org.eclipse.kura.nm/src/main/java/fi/w1/**/*
'''
}
}
}
}
}
}
stage('quality-gate') {
// Sonar quality gate
timeout(time: 30, unit: 'MINUTES') {
withCredentials([string(credentialsId: 'sonarcloud-token', variable: 'SONARCLOUD_TOKEN')]) {
def qg = waitForQualityGate()
if (qg.status != 'OK') {
error "Pipeline aborted due to sonar quality gate failure: ${qg.status}"
}
}
}
}
}