Skip to content

Commit

Permalink
[Y-Build-Tests] Simplify and unify job definitions
Browse files Browse the repository at this point in the history
- Simplify environment variable definitions and tool handling
- Remove unnecessary print-outs and whitespace
- Remove unused or unnecessary parameters and property definitions

Part of #2625
  • Loading branch information
HannesWell committed Dec 5, 2024
1 parent 88efdd8 commit 2818030
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 68 deletions.
67 changes: 27 additions & 40 deletions JenkinsJobs/YBuilds/Y_unit_linux.groovy
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
def config = new groovy.json.JsonSlurper().parseText(readFileFromWorkspace('JenkinsJobs/JobDSL.json'))
def STREAMS = config.Streams

def BUILD_CONFIGURATIONS = [
[javaVersion: 17, javaDownload: 'https://download.java.net/java/GA/jdk17.0.2/dfd4a8d0985749f896bed50d7138ee7f/8/GPL/openjdk-17.0.2_linux-x64_bin.tar.gz' ],
[javaVersion: 21, javaDownload: 'https://download.java.net/java/GA/jdk21/fd2272bbf8e04c3dbaee13770090416c/35/GPL/openjdk-21_linux-x64_bin.tar.gz' ],
[javaVersion: 24, javaDownload: 'https://download.java.net/java/early_access/jdk24/18/GPL/openjdk-24-ea+18_linux-x64_bin.tar.gz' ]
def BUILD_CONFIGURATIONS = [
[javaVersion: 17, javaHome: '''installJDK('https://download.java.net/java/GA/jdk17.0.2/dfd4a8d0985749f896bed50d7138ee7f/8/GPL/openjdk-17.0.2_linux-x64_bin.tar.gz')''' ],
[javaVersion: 21, javaHome: '''installJDK('https://download.java.net/java/GA/jdk21/fd2272bbf8e04c3dbaee13770090416c/35/GPL/openjdk-21_linux-x64_bin.tar.gz')''' ],
[javaVersion: 24, javaHome: '''installJDK('https://download.java.net/java/early_access/jdk24/18/GPL/openjdk-24-ea+18_linux-x64_bin.tar.gz')''' ]
]

for (STREAM in STREAMS){
Expand All @@ -14,8 +14,7 @@ for (STREAM in STREAMS){

pipelineJob('YPBuilds/ep' + MAJOR + MINOR + 'Y-unit-linux-x86_64-java' + BUILD_CONFIG.javaVersion){
parameters {
stringParam('buildId', null, null)
stringParam('javaDownload', BUILD_CONFIG.javaDownload, null)
stringParam('buildId', null, 'Build Id to test (such as I20240611-1800, N20120716-0800).')
}

definition {
Expand All @@ -31,23 +30,24 @@ pipeline {
agent {
label 'ubuntu-2404'
}
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 = ''' + 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"
}
steps {
wrap([$class: 'Xvnc', takeScreenshot: false, useXauthority: true]) {
withEnv(["JAVA_HOME_NEW=${ tool 'openjdk-jdk15-latest' }"]) {
withAnt(installation: 'apache-ant-latest') {
xvnc(useXauthority: true) {
sh \'\'\'#!/bin/bash -x
buildId=$(echo $buildId|tr -d ' ')
RAW_DATE_START="$(date +%s )"
export LANG=en_US.UTF-8
cat /etc/*release
echo -e "\\n\\tRAW Date Start: ${RAW_DATE_START} \\n"
echo -e "\\n\\t whoami: $( whoami )\\n"
echo -e "\\n\\t uname -a: $(uname -a)\\n"
echo "whoami: $(whoami)"
echo "uname -a: $(uname -a)"
# 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
Expand All @@ -65,40 +65,20 @@ pipeline {
cat ${WORKSPACE}/buildproperties.shsource
source ${WORKSPACE}/buildproperties.shsource
set -x
mkdir -p ${WORKSPACE}/java
pushd ${WORKSPACE}/java
wget -O jdk.tar.gz --no-verbose ${javaDownload}
tar xzf jdk.tar.gz
rm jdk.tar.gz
export JAVA_HOME_NEW=$(pwd)/$(ls)
popd
set +x
export PATH=${JAVA_HOME_NEW}/bin:${ANT_HOME}/bin:${PATH}
echo JAVA_HOME: $JAVA_HOME
export JAVA_HOME=$JAVA_HOME_NEW
echo ANT_HOME: $ANT_HOME
echo PATH: $PATH
export ANT_OPTS="${ANT_OPTS} -Djava.io.tmpdir=${WORKSPACE}/tmp -Djava.security.manager=allow"
env 1>envVars.txt 2>&1
ant -diagnostics 1>antDiagnostics.txt 2>&1
java -XshowSettings -version 1>javaSettings.txt 2>&1
ant -f getEBuilder.xml -Djava.io.tmpdir=${WORKSPACE}/tmp -DbuildId=$buildId -DeclipseStream=$STREAM -DEBUILDER_HASH=${EBUILDER_HASH} -DdownloadURL=https://download.eclipse.org/eclipse/downloads/drops4/${buildId} -Dosgi.os=linux -Dosgi.ws=gtk -Dosgi.arch=x86_64 -DtestSuite=all -Djvm=${JAVA_HOME}/bin/java
RAW_DATE_END="$(date +%s )"
echo -e "\\n\\tRAW Date End: ${RAW_DATE_END} \\n"
TOTAL_TIME=$((${RAW_DATE_END} - ${RAW_DATE_START}))
echo -e "\\n\\tTotal elapsed time: ${TOTAL_TIME} \\n"
ant -f getEBuilder.xml -DbuildId=${buildId} \\
-DeclipseStream=$STREAM -DEBUILDER_HASH=${EBUILDER_HASH} \\
-DdownloadURL=https://download.eclipse.org/eclipse/downloads/drops4/${buildId} \\
-Dosgi.os=linux -Dosgi.ws=gtk -Dosgi.arch=x86_64 \\
-DtestSuite=all
\'\'\'
}
}
}
archiveArtifacts '**/eclipse-testing/results/**, **/eclipse-testing/directorLogs/**, *.properties, *.txt'
junit keepLongStdio: true, testResults: '**/eclipse-testing/results/xml/*.xml'
Expand All @@ -111,6 +91,13 @@ pipeline {
}
}
}
def installJDK(String downloadURL) {
dir ("${WORKSPACE}/java") {
sh "curl -L ${downloadURL} | tar -xzf -"
return "${pwd()}/" + sh(script: 'ls', returnStdout: true).strip()
}
}
''')
}
}
Expand Down
37 changes: 13 additions & 24 deletions JenkinsJobs/YBuilds/Y_unit_mac.groovy
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
def config = new groovy.json.JsonSlurper().parseText(readFileFromWorkspace('JenkinsJobs/JobDSL.json'))
def STREAMS = config.Streams

def BUILD_CONFIGURATIONS = [
def BUILD_CONFIGURATIONS = [
[arch: 'aarch64', agentLabel: 'nc1ht-macos11-arm64', javaHome: '/usr/local/openjdk-17/Contents/Home' ],
[arch: 'x86_64', agentLabel: 'nc1ht-macos11-arm64', javaHome: '/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home' ]
]
Expand All @@ -14,8 +14,7 @@ for (STREAM in STREAMS){
pipelineJob('YPBuilds/ep' + MAJOR + MINOR + 'Y-unit-macosx-' + BUILD_CONFIG.arch + '-java17'){
description('Run Eclipse SDK Tests for ' + BUILD_CONFIG.arch + ' Mac (and ' + BUILD_CONFIG.arch + ' VM and Eclipse)')
parameters {
stringParam('buildId', null, 'Build Id to test (such as I20120717-0800, N20120716-0800). ')
stringParam('testSuite', 'all', null)
stringParam('buildId', null, 'Build Id to test (such as I20240611-1800, N20120716-0800).')
}
definition {
cps {
Expand All @@ -32,16 +31,18 @@ pipeline {
}
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 = \'''' + 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"
}
steps {
cleanWs() // workspace not cleaned by default
sh \'\'\'#!/bin/bash -x
RAW_DATE_START="$(date +%s )"
echo -e "\\n\\tRAW Date Start: ${RAW_DATE_START} \\n"
echo -e "\\n\\t whoami: $( whoami )\\n"
echo -e "\\n\\t uname -a: $(uname -a)\\n"
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)
Expand All @@ -64,10 +65,6 @@ curl -o buildProperties.sh https://download.eclipse.org/eclipse/downloads/drops4
cat getEBuilder.xml
source buildProperties.sh
export JAVA_HOME=''' + BUILD_CONFIG.javaHome + '''
export ANT_HOME=/opt/homebrew/Cellar/ant/1.10.11/libexec
export PATH=${JAVA_HOME}/bin:${ANT_HOME}/bin:${PATH}
echo JAVA_HOME: $JAVA_HOME
echo ANT_HOME: $ANT_HOME
echo PATH: $PATH
Expand All @@ -76,19 +73,11 @@ env 1>envVars.txt 2>&1
ant -diagnostics 1>antDiagnostics.txt 2>&1
java -XshowSettings -version 1>javaSettings.txt 2>&1
ant -f getEBuilder.xml -Djava.io.tmpdir=${WORKSPACE}/tmp -DbuildId=$buildId \\
ant -f getEBuilder.xml -DbuildId=${buildId} \\
-DeclipseStream=$STREAM -DEBUILDER_HASH=${EBUILDER_HASH} \\
-DdownloadURL=https://download.eclipse.org/eclipse/downloads/drops4/${buildId} \\
-Dosgi.os=macosx -Dosgi.ws=cocoa -Dosgi.arch=''' + BUILD_CONFIG.arch + ''' \\
-DtestSuite=${testSuite}
RAW_DATE_END="$(date +%s )"
echo -e "\\n\\tRAW Date End: ${RAW_DATE_END} \\n"
TOTAL_TIME=$((${RAW_DATE_END} - ${RAW_DATE_START}))
echo -e "\\n\\tTotal elapsed time: ${TOTAL_TIME} \\n"
-DtestSuite=all
\'\'\'
archiveArtifacts '**/eclipse-testing/results/**, **/eclipse-testing/directorLogs/**, *.properties, *.txt'
junit keepLongStdio: true, testResults: '**/eclipse-testing/results/xml/*.xml'
Expand Down
24 changes: 20 additions & 4 deletions JenkinsJobs/YBuilds/Y_unit_win32.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ for (STREAM in STREAMS){
pipelineJob('YPBuilds/ep' + MAJOR + MINOR + 'Y-unit-win32-x86_64-java17'){
description('Run Eclipse SDK Windows Tests ')
parameters {
stringParam('buildId', null, 'Build Id to test (such as I20120717-0800, N20120716-0800). ')
stringParam('buildId', null, 'Build Id to test (such as I20240611-1800, N20120716-0800).')
}
definition {
cps {
Expand All @@ -25,6 +25,13 @@ pipeline {
}
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 = 'C:\\\\Program Files\\\\Eclipse Adoptium\\\\jdk-17.0.11+9'
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"
}
steps {
cleanWs() // workspace not cleaned by default
bat \'\'\'
Expand All @@ -46,13 +53,22 @@ For /F "tokens=1* delims==" %%A IN (buildProperties.properties) DO (
IF "%%A"=="EBUILDER_HASH " set EBUILDER_HASH=%%B
)
echo on
set STREAM
set EBUILDER_HASH
set JAVA_HOME="C:\\PROGRA~1\\ECLIPS~1\\jdk-17.0.5.8-hotspot\\"
set JAVA_HOME
set Path="C:\\PROGRA~1\\ECLIPS~1\\jdk-17.0.5.8-hotspot\\bin";C:\\ProgramData\\Boxstarter;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\ProgramData\\chocolatey\\bin;C:\\tools\\cygwin\\bin;C:\\Program Files\\IcedTeaWeb\\WebStart\\bin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Users\\jenkins_vnc\\AppData\\Local\\Microsoft\\WindowsApps;%PATH%
set ANT_HOME
set PATH
env 1>envVars.txt 2>&1
cmd /c ant -diagnostics 1>antDiagnostics.txt 2>&1
java -XshowSettings -version 1>javaSettings.txt 2>&1
ant -f getEBuilder.xml -Djava.io.tmpdir=%WORKSPACE%\\tmp -Djvm="C:\\PROGRA~1\\ECLIPS~1\\jdk-17.0.5.8-hotspot\\bin\\java.exe" -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 -DtestSuite=all
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 ^
-DtestSuite=all
\'\'\'
archiveArtifacts '**/eclipse-testing/results/**, **/eclipse-testing/directorLogs/**, *.properties, *.txt'
junit keepLongStdio: true, testResults: '**/eclipse-testing/results/xml/*.xml'
Expand Down

0 comments on commit 2818030

Please sign in to comment.