Skip to content

Commit

Permalink
[Build] Further simplify and unify I/Y-build test job configurations
Browse files Browse the repository at this point in the history
- Simplify custom JDK download in I-builds on Linux with Java-23 by
using the same approach like for Y-builds
- Remove unnecessary '-Dargs=all' property definition for Windows and
unnecessary environment variable resets on Mac.
  • Loading branch information
HannesWell committed Dec 6, 2024
1 parent 59e6138 commit 768f042
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 37 deletions.
39 changes: 22 additions & 17 deletions JenkinsJobs/AutomatedTests/I_unit_linux.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@ def config = new groovy.json.JsonSlurper().parseText(readFileFromWorkspace('Jenk
def STREAMS = config.Streams
def JAVA_VERSIONS = ['17', '21', '23']

def BUILD_CONFIGURATIONS = [
[javaVersion: 17, javaHome: "tool(type:'jdk', name:'openjdk-jdk17-latest')" ],
[javaVersion: 21, javaHome: "tool(type:'jdk', name:'openjdk-jdk21-latest')" ],
[javaVersion: 23, javaHome: "installJDK('23', 'linux', 'x86_64', 'ea')" ]
]

for (STREAM in STREAMS){
for (JAVA_VERSION in JAVA_VERSIONS){
def MAJOR = STREAM.split('\\.')[0]
def MINOR = STREAM.split('\\.')[1]
for (BUILD_CONFIG in BUILD_CONFIGURATIONS){

pipelineJob('AutomatedTests/ep' + MAJOR + MINOR + 'I-unit-linux-x86_64-java' + JAVA_VERSION){
pipelineJob('AutomatedTests/ep' + MAJOR + MINOR + 'I-unit-linux-x86_64-java' + BUILD_CONFIG.javaVersion){
description('Run Eclipse SDK Tests for the platform implied by this job\'s name')
parameters { // Define parameters in job configuration to make them available from the very first build onwards
stringParam('buildId', null, 'Build Id to test (such as I20240611-1800, N20120716-0800).')
Expand All @@ -27,23 +33,11 @@ pipeline {
label 'ubuntu-2404'
}
stages {''' + (JAVA_VERSION != '23' ? '' : '''
stage('Download latest JDK-23 EA') {
steps {
script{
def path = "${WORKSPACE}/tools"
dir(path) {
sh 'curl -L https://staging-api.adoptium.net/v3/binary/latest/23/ea/linux/x64/jdk/hotspot/normal/eclipse?project=jdk | tar -xzf -'
JAVA_23_HOME = path + '/' + sh(script: 'find -name "jdk-23+*"', returnStdout: true).substring(2).trim()
}
}
}
}
''') + '''
stages {
stage('Run tests'){
environment {
// Declaring a jdk and ant the usual way in the 'tools' section, because of unknown reasons, breaks the usage of system commands like xvnc, pkill and sh
JAVA_HOME = ''' + (JAVA_VERSION != '23' ? "tool(type:'jdk', name:'openjdk-jdk${JAVA_VERSION}-latest')" : '"${JAVA_23_HOME}"') + '''
JAVA_HOME = ''' + BUILD_CONFIG.javaHome + '''
ANT_HOME = tool(type:'ant', name:'apache-ant-latest')
PATH = "${JAVA_HOME}/bin:${ANT_HOME}/bin:${PATH}"
ANT_OPTS = "-Djava.io.tmpdir=${WORKSPACE}/tmp -Djava.security.manager=allow"
Expand Down Expand Up @@ -98,7 +92,18 @@ pipeline {
}
}
}
''')
def installJDK(String version, String os, String arch, String releaseType='ga') {
// Translate os/arch names that are different in the Adoptium API
if (arch == 'x86_64') {
arch == 'x64'
}
dir ("${WORKSPACE}/java") {
sh "curl -L https://api.adoptium.net/v3/binary/latest/${version}/${releaseType}/${os}/${arch}/jdk/hotspot/normal/eclipse | tar -xzf -"
return "${pwd()}/" + sh(script: 'ls', returnStdout: true).strip()
}
}
''')
}
}
}
Expand Down
5 changes: 0 additions & 5 deletions JenkinsJobs/AutomatedTests/I_unit_mac.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ pipeline {
echo " whoami: $(whoami)"
echo " uname -a: $(uname -a)"
# unset commonly defined system variables, which we either do not need, or want to set ourselves.
# (this is to improve consistency running on one machine versus another)
echo "Unsetting variables: JAVA_BINDIR JAVA_ROOT JDK_HOME JRE_HOME CLASSPATH"
unset -v JAVA_BINDIR JAVA_ROOT JDK_HOME JRE_HOME CLASSPATH
# 0002 is often the default for shell users, but it is not when ran from
# a cron job, so we set it explicitly, to be sure of value, so releng group has write access to anything
# we create on shared area.
Expand Down
6 changes: 1 addition & 5 deletions JenkinsJobs/AutomatedTests/I_unit_win32.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ pipeline {
steps {
cleanWs() // workspace not cleaned by default
bat \'\'\'
@REM May want to try and restrict path, as we do on cron jobs, so we
@REM have more consistent conditions.
@REM export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:~/bin
@REM tmp must already exist, for Java to make use of it, in subsequent steps
@REM no -p (or /p) needed on Windows. It creates
mkdir tmp
Expand All @@ -65,7 +61,7 @@ java -XshowSettings -version 1>javaSettings.txt 2>&1
ant -f getEBuilder.xml -DbuildId=%buildId% -DeclipseStream=%STREAM% -DEBUILDER_HASH=%EBUILDER_HASH% ^
-DdownloadURL="https://download.eclipse.org/eclipse/downloads/drops4/%buildId%" ^
-Dargs=all -Dosgi.os=win32 -Dosgi.ws=win32 -Dosgi.arch=x86_64 ^
-Dosgi.os=win32 -Dosgi.ws=win32 -Dosgi.arch=x86_64 ^
-DtestSuite=all
@REM For smaller test-suites see: https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/blob/be721e33c916b03c342e7b6f334220c6124946f8/production/testScripts/configuration/sdk.tests/testScripts/test.xml#L1893-L1903
\'\'\'
Expand Down
5 changes: 0 additions & 5 deletions JenkinsJobs/YBuilds/Y_unit_mac.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ pipeline {
echo "whoami: $(whoami)"
echo "uname -a: $(uname -a)"
# unset commonly defined system variables, which we either do not need, or want to set ourselves.
# (this is to improve consistency running on one machine versus another)
echo -e "Unsetting variables: JAVA_BINDIR JAVA_HOME JAVA_ROOT JDK_HOME JRE_HOME CLASSPATH ANT_HOME\\n"
unset -v JAVA_BINDIR JAVA_HOME JAVA_ROOT JDK_HOME JRE_HOME CLASSPATH ANT_HOME
# 0002 is often the default for shell users, but it is not when ran from
# a cron job, so we set it explicitly, to be sure of value, so releng group has write access to anything
# we create on shared area.
Expand Down
6 changes: 1 addition & 5 deletions JenkinsJobs/YBuilds/Y_unit_win32.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ pipeline {
steps {
cleanWs() // workspace not cleaned by default
bat \'\'\'
rem May want to try and restrict path, as we do on cron jobs, so we
rem have more consistent conditions.
rem export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:~/bin
rem tmp must already exist, for Java to make use of it, in subsequent steps
rem no -p (or /p) needed on Windows. It creates
mkdir tmp
Expand Down Expand Up @@ -67,7 +63,7 @@ java -XshowSettings -version 1>javaSettings.txt 2>&1
ant -f getEBuilder.xml -DbuildId=%buildId% ^
-DeclipseStream=%STREAM% -DEBUILDER_HASH=%EBUILDER_HASH% ^
-DdownloadURL="https://download.eclipse.org/eclipse/downloads/drops4/%buildId%" ^
-Dargs=all -Dosgi.os=win32 -Dosgi.ws=win32 -Dosgi.arch=x86_64 ^
-Dosgi.os=win32 -Dosgi.ws=win32 -Dosgi.arch=x86_64 ^
-DtestSuite=all
\'\'\'
archiveArtifacts '**/eclipse-testing/results/**, **/eclipse-testing/directorLogs/**, *.properties, *.txt'
Expand Down

0 comments on commit 768f042

Please sign in to comment.