@@ -11,118 +11,132 @@ def boolean onlyDocumentationFilesChangedIn(String workDirectory) {
1111 return changedFiles && changedFiles. every { it. endsWith(" .md" ) || it. endsWith(" .txt" ) }
1212}
1313
14- node {
15- properties([
16- disableConcurrentBuilds(abortPrevious : true ),
17- buildDiscarder(logRotator(artifactDaysToKeepStr : ' ' , artifactNumToKeepStr : ' 2' , daysToKeepStr : ' ' , numToKeepStr : ' 5' )),
18- gitLabConnection(' gitlab.eclipse.org' ),
19- [$class : ' RebuildSettings' , autoRebuild : false , rebuildDisabled : false ],
20- [$class : ' JobLocalConfiguration' , changeReasonComment : ' ' ]
21- ])
22-
23- deleteDir()
24-
25- stage(' Preparation' ) {
26- dir(" kura" ) {
27- checkout scm
28- sh " touch /tmp/isJenkins.txt"
14+ podTemplate(inheritFrom : ' basic' , yaml : '''
15+ spec:
16+ containers:
17+ - name: "jnlp"
18+ resources:
19+ limits:
20+ cpu: "2000m"
21+ memory: "5Gi"
22+ requests:
23+ cpu: "1000m"
24+ memory: "3Gi"
25+ ''' ) {
26+ node(POD_LABEL ) {
27+
28+ properties([
29+ disableConcurrentBuilds(abortPrevious : true ),
30+ buildDiscarder(logRotator(artifactDaysToKeepStr : ' ' , artifactNumToKeepStr : ' 2' , daysToKeepStr : ' ' , numToKeepStr : ' 5' )),
31+ gitLabConnection(' gitlab.eclipse.org' ),
32+ [$class : ' RebuildSettings' , autoRebuild : false , rebuildDisabled : false ],
33+ [$class : ' JobLocalConfiguration' , changeReasonComment : ' ' ]
34+ ])
35+
36+ deleteDir()
37+
38+ stage(' Preparation' ) {
39+ dir(" kura" ) {
40+ checkout scm
41+ sh " touch /tmp/isJenkins.txt"
42+ }
2943 }
30- }
3144
32- // Skip build if only documentation files (i.e. *.md and *.txt) have changed
33- if (onlyDocumentationFilesChangedIn(" kura" )) {
34- echo " Skipping build for documentation changes"
35- currentBuild. result = ' SUCCESS'
36- return
37- }
45+ // Skip build if only documentation files (i.e. *.md and *.txt) have changed
46+ if (onlyDocumentationFilesChangedIn(" kura" )) {
47+ echo " Skipping build for documentation changes"
48+ currentBuild. result = ' SUCCESS'
49+ return
50+ }
3851
39- stage(' Build target-platform' ) {
40- timeout(time : 1 , unit : ' HOURS' ) {
41- dir(" kura" ) {
42- withMaven(jdk : ' temurin-jdk17-latest' , maven : ' apache-maven-3.9.6' ) {
43- sh " mvn -f target-platform/pom.xml clean install -Pno-mirror -Pcheck-exists-plugin"
52+ stage(' Build target-platform' ) {
53+ timeout(time : 1 , unit : ' HOURS' ) {
54+ dir(" kura" ) {
55+ withMaven(jdk : ' temurin-jdk17-latest' , maven : ' apache-maven-3.9.6' ) {
56+ sh " mvn -f target-platform/pom.xml clean install -Pno-mirror -Pcheck-exists-plugin"
57+ }
4458 }
4559 }
4660 }
47- }
4861
49- stage(' Build core' ) {
50- timeout(time : 2 , unit : ' HOURS' ) {
51- dir(" kura" ) {
52- withMaven(jdk : ' temurin-jdk17-latest' , maven : ' apache-maven-3.9.6' ) {
53- sh " mvn -f kura/pom.xml -Dsurefire.rerunFailingTestsCount=3 clean install -Pcheck-exists-plugin"
62+ stage(' Build core' ) {
63+ timeout(time : 2 , unit : ' HOURS' ) {
64+ dir(" kura" ) {
65+ withMaven(jdk : ' temurin-jdk17-latest' , maven : ' apache-maven-3.9.6' ) {
66+ sh " mvn -f kura/pom.xml -Dsurefire.rerunFailingTestsCount=3 clean install -Pcheck-exists-plugin"
67+ }
5468 }
5569 }
5670 }
57- }
5871
59- stage(' Build distrib' ) {
60- timeout(time : 1 , unit : ' HOURS' ) {
61- dir(" kura" ) {
62- withMaven(jdk : ' temurin-jdk17-latest' , maven : ' apache-maven-3.9.6' ) {
63- sh " mvn -f kura/distrib/pom.xml clean install -DbuildAll"
72+ stage(' Build distrib' ) {
73+ timeout(time : 1 , unit : ' HOURS' ) {
74+ dir(" kura" ) {
75+ withMaven(jdk : ' temurin-jdk17-latest' , maven : ' apache-maven-3.9.6' ) {
76+ sh " mvn -f kura/distrib/pom.xml clean install -DbuildAll"
77+ }
6478 }
6579 }
6680 }
67- }
6881
69- stage(' Build examples' ) {
70- timeout(time : 1 , unit : ' HOURS' ) {
71- dir(" kura" ) {
72- withMaven(jdk : ' temurin-jdk17-latest' , maven : ' apache-maven-3.9.6' ) {
73- sh " mvn -f kura/examples/pom.xml clean install -Pcheck-exists-plugin"
82+ stage(' Build examples' ) {
83+ timeout(time : 1 , unit : ' HOURS' ) {
84+ dir(" kura" ) {
85+ withMaven(jdk : ' temurin-jdk17-latest' , maven : ' apache-maven-3.9.6' ) {
86+ sh " mvn -f kura/examples/pom.xml clean install -Pcheck-exists-plugin"
87+ }
7488 }
7589 }
7690 }
77- }
7891
7992
80- stage(' Generate test reports' ) {
81- dir(" kura" ) {
82- junit ' kura/test/*/target/surefire-reports/*.xml,kura/examples/test/*/target/surefire-reports/*.xml'
93+ stage(' Generate test reports' ) {
94+ dir(" kura" ) {
95+ junit ' kura/test/*/target/surefire-reports/*.xml,kura/examples/test/*/target/surefire-reports/*.xml'
96+ }
8397 }
84- }
8598
86- stage(' Archive .deb artifacts' ) {
87- dir(" kura" ) {
88- archiveArtifacts artifacts : ' kura/distrib/target/*.deb' , onlyIfSuccessful : true
99+ stage(' Archive .deb artifacts' ) {
100+ dir(" kura" ) {
101+ archiveArtifacts artifacts : ' kura/distrib/target/*.deb' , onlyIfSuccessful : true
102+ }
89103 }
90- }
91104
92- stage(' Sonar' ) {
93- timeout(time : 2 , unit : ' HOURS' ) {
94- dir(" kura" ) {
95- withMaven(jdk : ' temurin-jdk17-latest' , maven : ' apache-maven-3.9.6' ) {
96- withCredentials([string(credentialsId : ' sonarcloud-token' , variable : ' SONARCLOUD_TOKEN' )]) {
97- withSonarQubeEnv {
98- sh '''
99- mvn -f kura/pom.xml sonar:sonar \
100- -Dmaven.test.failure.ignore=true \
101- -Dsonar.organization=eclipse \
102- -Dsonar.host.url=${SONAR_HOST_URL} \
103- -Dsonar.token=${SONARCLOUD_TOKEN} \
104- -Dsonar.branch.name=${BRANCH_NAME} \
105- -Dsonar.branch.target=${CHANGE_TARGET} \
106- -Dsonar.java.source=8 \
107- -Dsonar.java.binaries='target/' \
108- -Dsonar.core.codeCoveragePlugin=jacoco \
109- -Dsonar.projectKey=org.eclipse.kura:kura \
110- -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/**/*
111- '''
105+ stage(' Sonar' ) {
106+ timeout(time : 2 , unit : ' HOURS' ) {
107+ dir(" kura" ) {
108+ withMaven(jdk : ' temurin-jdk17-latest' , maven : ' apache-maven-3.9.6' ) {
109+ withCredentials([string(credentialsId : ' sonarcloud-token' , variable : ' SONARCLOUD_TOKEN' )]) {
110+ withSonarQubeEnv {
111+ sh '''
112+ mvn -f kura/pom.xml sonar:sonar \
113+ -Dmaven.test.failure.ignore=true \
114+ -Dsonar.organization=eclipse \
115+ -Dsonar.host.url=${SONAR_HOST_URL} \
116+ -Dsonar.token=${SONARCLOUD_TOKEN} \
117+ -Dsonar.branch.name=${BRANCH_NAME} \
118+ -Dsonar.branch.target=${CHANGE_TARGET} \
119+ -Dsonar.java.source=8 \
120+ -Dsonar.java.binaries='target/' \
121+ -Dsonar.core.codeCoveragePlugin=jacoco \
122+ -Dsonar.projectKey=org.eclipse.kura:kura \
123+ -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/**/*
124+ '''
125+ }
112126 }
113127 }
114128 }
115129 }
116130 }
117- }
118131
119- stage(' quality-gate' ) {
120- // Sonar quality gate
121- timeout(time : 30 , unit : ' MINUTES' ) {
122- withCredentials([string(credentialsId : ' sonarcloud-token' , variable : ' SONARCLOUD_TOKEN' )]) {
123- def qg = waitForQualityGate()
124- if (qg. status != ' OK' ) {
125- error " Pipeline aborted due to sonar quality gate failure: ${ qg.status} "
132+ stage(' quality-gate' ) {
133+ // Sonar quality gate
134+ timeout(time : 30 , unit : ' MINUTES' ) {
135+ withCredentials([string(credentialsId : ' sonarcloud-token' , variable : ' SONARCLOUD_TOKEN' )]) {
136+ def qg = waitForQualityGate()
137+ if (qg. status != ' OK' ) {
138+ error " Pipeline aborted due to sonar quality gate failure: ${ qg.status} "
139+ }
126140 }
127141 }
128142 }
0 commit comments