1+ // https://github.com/eclipse-cbi/jiro/wiki/CI-Best-Practices
2+ // https://github.com/eclipse-cbi/jiro/wiki/FAQ#how-do-i-run-a-javamaven-build-on-the-cluster-based-infrastructure
13pipeline {
24 agent {
3- label ' centos-latest'
5+ // https://eclipse.dev/cbi/jiro-agent/
6+ // https://github.com/eclipse-cbi/jiro-agents/
7+ // https://github.com/eclipse-cbi/jiro-agents/tree/master/ubuntu
8+ label ' ubuntu-latest'
49 }
510
11+ // https://www.jenkins.io/doc/book/pipeline/syntax/#triggers
12+ // https://www.jenkins.io/doc/pipeline/steps/params/pipelinetriggers/
613 triggers {
714 githubPush()
815 }
916
17+ // https://www.jenkins.io/doc/book/pipeline/syntax/#options
1018 options {
1119 timeout(time : 20 , unit : ' MINUTES' )
1220 buildDiscarder(logRotator(numToKeepStr : ' 10' ))
1321 disableConcurrentBuilds(abortPrevious : false )
1422 }
1523
1624 tools {
25+ // https://github.com/eclipse-cbi/jiro/wiki/Tools-(JDK,-Maven,-Ant)#apache-maven
26+ // https://eclipse.dev/cbi/jiro/Tools/#apache-maven
27+ maven ' apache-maven-latest'
28+
29+ // https://github.com/eclipse-cbi/jiro/wiki/Tools-(JDK,-Maven,-Ant)#eclipse-temurin
30+ // https://eclipse.dev/cbi/jiro/Tools/#eclipse-temurin
1731 jdk ' temurin-jdk21-latest'
1832 }
1933
@@ -60,23 +74,45 @@ pipeline {
6074
6175 stage(' Build' ) {
6276 steps {
63- wrap([$class : ' Xvnc' , useXauthority : true ]) {
77+ // https://github.com/eclipse-cbi/jiro/wiki/FAQ#how-do-i-run-ui-tests-on-the-cluster-based-infrastructure
78+ wrap([$class : ' Xvnc' , takeScreenshot : false , useXauthority : true ]) {
6479 script {
65- if (env. BRANCH_NAME == ' main' ) {
66- withCredentials([string(credentialsId : ' gpg-passphrase' , variable : ' KEYRING_PASSPHRASE' )]) {
67- sh ''' ./mvnw clean deploy -B \
68- -t /tmp/toolchains.xml \
69- -Dmaven.test.failure.ignore=true \
70- -Dsurefire.rerunFailingTestsCount=3 \
71- -Psign -Dgpg.passphrase="${KEYRING_PASSPHRASE}"
72- '''
73- }
80+ def maven_opts = (env. MAVEN_OPTS ?: ' ' )
81+
82+ if (isUnix()) {
83+ // https://www.baeldung.com/java-security-egd#bd-testing-the-effect-of-javasecurityegd
84+ maven_opts + = ' -Djava.security.egd=file:/dev/./urandom'
7485 } else {
75- sh ''' ./mvnw clean verify -B \
76- -t /tmp/toolchains.xml \
77- -Dmaven.test.failure.ignore=true \
78- -Dsurefire.rerunFailingTestsCount=3
79- '''
86+ // https://stackoverflow.com/questions/58991966/what-java-security-egd-option-is-for/59097932#59097932
87+ maven_opts + = ' -Djava.security.egd=file:/dev/urandom'
88+ }
89+
90+ // https://stackoverflow.com/questions/5120470/how-to-time-the-different-stages-of-maven-execution/49494561#49494561
91+ maven_opts + = ' -Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss,SSS'
92+
93+ maven_opts + = ' -Xmx1024m -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dhttps.protocols=TLSv1.3,TLSv1.2'
94+
95+ def maven_args = [
96+ ' --no-transfer-progress' ,
97+ ' --errors' ,
98+ ' --update-snapshots' ,
99+ ' --batch-mode' ,
100+ ' --show-version' ,
101+ ' -Declipse.p2.mirrors=false' ,
102+ ' -Dsurefire.rerunFailingTestsCount=3' ,
103+ ' -t /tmp/toolchains.xml'
104+ ]. join(' ' )
105+
106+ withEnv([" MAVEN_OPTS=${ maven_opts} " ]) {
107+ echo " MAVEN_OPTS: ${ env.MAVEN_OPTS} "
108+
109+ if (env. BRANCH_NAME == ' main' ) {
110+ withCredentials([string(credentialsId : ' gpg-passphrase' , variable : ' KEYRING_PASSPHRASE' )]) {
111+ sh " ./mvnw ${ maven_args} -Psign -Dgpg.passphrase=" ${KEYRING_PASSPHRASE }" clean deploy"
112+ }
113+ } else {
114+ sh " ./mvnw ${ maven_args} clean verify"
115+ }
80116 }
81117 }
82118 }
@@ -94,6 +130,7 @@ pipeline {
94130 branch ' main'
95131 }
96132 steps {
133+ // https://github.com/eclipse-cbi/jiro/wiki/FAQ#how-do-i-deploy-artifacts-to-downloadeclipseorg
97134 sshagent ([' projects-storage.eclipse.org-bot-ssh' ]) {
98135 sh '''
99136 DOWNLOAD_AREA=/home/data/httpd/download.eclipse.org/tm4e/snapshots/
@@ -107,6 +144,5 @@ pipeline {
107144 }
108145 }
109146 }
110-
111147 }
112148}
0 commit comments