Skip to content

Commit 1f0f2b8

Browse files
authored
ci: update Jenkinsfile (#1382)
1 parent f391665 commit 1f0f2b8

1 file changed

Lines changed: 61 additions & 16 deletions

File tree

Jenkinsfile

Lines changed: 61 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,81 @@
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
13
pipeline {
4+
agent {
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'
9+
}
10+
11+
// https://www.jenkins.io/doc/book/pipeline/syntax/#triggers
12+
// https://www.jenkins.io/doc/pipeline/steps/params/pipelinetriggers/
13+
triggers {
14+
githubPush()
15+
}
16+
17+
// https://www.jenkins.io/doc/book/pipeline/syntax/#options
218
options {
3-
timeout(time: 15, unit: 'MINUTES')
19+
timeout(time: 20, unit: 'MINUTES')
420
buildDiscarder(logRotator(numToKeepStr: '10'))
521
disableConcurrentBuilds(abortPrevious: true)
622
}
723

8-
agent {
9-
label 'centos-latest'
10-
}
11-
1224
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
1331
jdk 'temurin-jdk21-latest'
1432
}
1533

1634
stages {
1735

1836
stage('Build') {
1937
steps {
20-
wrap([$class: 'Xvnc', useXauthority: true]) {
21-
sh """
22-
./mvnw clean verify \
23-
org.eclipse.dash:license-tool-plugin:license-check \
24-
-B ${env.BRANCH_NAME=='main' ? '-Psign': ''} \
25-
-Dmaven.test.failure.ignore=true \
26-
-Ddash.fail=false \
27-
-Dsurefire.rerunFailingTestsCount=3
28-
"""
38+
// https://github.com/eclipse-cbi/jiro/wiki/FAQ#how-do-i-run-ui-tests-on-the-cluster-based-infrastructure
39+
wrap([$class: 'Xvnc', takeScreenshot: false, useXauthority: true]) {
40+
script {
41+
def maven_opts = (env.MAVEN_OPTS ?: '')
42+
43+
if (isUnix()) {
44+
// https://www.baeldung.com/java-security-egd#bd-testing-the-effect-of-javasecurityegd
45+
maven_opts += ' -Djava.security.egd=file:/dev/./urandom'
46+
} else {
47+
// https://stackoverflow.com/questions/58991966/what-java-security-egd-option-is-for/59097932#59097932
48+
maven_opts += ' -Djava.security.egd=file:/dev/urandom'
49+
}
50+
51+
// https://stackoverflow.com/questions/5120470/how-to-time-the-different-stages-of-maven-execution/49494561#49494561
52+
maven_opts += ' -Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss,SSS'
53+
54+
maven_opts += ' -Xmx1024m -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dhttps.protocols=TLSv1.3,TLSv1.2'
55+
56+
def maven_args = [
57+
'--no-transfer-progress',
58+
'--errors',
59+
'--update-snapshots',
60+
'--batch-mode',
61+
'--show-version',
62+
'-Declipse.p2.mirrors=false',
63+
'-Dsurefire.rerunFailingTestsCount=3',
64+
].join(' ')
65+
66+
withEnv(["MAVEN_OPTS=${maven_opts}"]) {
67+
echo "MAVEN_OPTS: ${env.MAVEN_OPTS}"
68+
69+
sh "./mvnw ${maven_args} ${env.BRANCH_NAME=='main' ? '-Psign': ''} clean verify"
70+
}
71+
}
2972
}
3073
}
74+
3175
post {
3276
always {
3377
archiveArtifacts artifacts: 'repository/target/repository/**/*,repository/target/*.zip,*/target/work/data/.metadata/.log'
34-
junit '*/target/surefire-reports/TEST-*.xml'
78+
junit '**/target/surefire-reports/TEST-*.xml'
3579
}
3680
}
3781
}
@@ -41,6 +85,7 @@ pipeline {
4185
branch 'main'
4286
}
4387
steps {
88+
// https://github.com/eclipse-cbi/jiro/wiki/FAQ#how-do-i-deploy-artifacts-to-downloadeclipseorg
4489
sshagent (['projects-storage.eclipse.org-bot-ssh']) {
4590
sh '''
4691
DOWNLOAD_AREA=/home/data/httpd/download.eclipse.org/lsp4e/snapshots/
@@ -49,10 +94,10 @@ pipeline {
4994
rm -rf ${DOWNLOAD_AREA}/* && \
5095
mkdir -p ${DOWNLOAD_AREA}"
5196
scp -r repository/target/repository/* genie.lsp4e@projects-storage.eclipse.org:${DOWNLOAD_AREA}
97+
scp repository/target/repository-*-SNAPSHOT.zip genie.lsp4e@projects-storage.eclipse.org:${DOWNLOAD_AREA}/repository.zip
5298
'''
5399
}
54100
}
55101
}
56-
57102
}
58103
}

0 commit comments

Comments
 (0)