Skip to content

Commit

Permalink
[I-Build-Tests] Define Mac and Windows jobs as Jenkins-pipeline
Browse files Browse the repository at this point in the history
This allows to unify the job definition with the test-jobs for Linux and
also allows to simplify some parts of the job a lot.
  • Loading branch information
HannesWell committed Apr 30, 2024
1 parent d6ee563 commit c453c37
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 308 deletions.
143 changes: 44 additions & 99 deletions JenkinsJobs/AutomatedTests/I_unit_mac64_java17.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -5,80 +5,40 @@ for (STREAM in STREAMS){
def MAJOR = STREAM.split('\\.')[0]
def MINOR = STREAM.split('\\.')[1]

job('AutomatedTests/ep' + MAJOR + MINOR + 'I-unit-mac64-java17'){
pipelineJob('AutomatedTests/ep' + MAJOR + MINOR + 'I-unit-mac64-java17'){
description('Run Eclipse SDK Tests for the platform implied by this job\'s name')

logRotator {
numToKeep(5)
}

parameters {
stringParam('buildId', null, 'Build Id to test (such as I20120717-0800, N20120716-0800). ')
stringParam('testSuite', 'all', null)
}


label('nc1ht-macos11-arm64')

jdk('openjdk-jdk11-latest')

authenticationToken('windows2012tests')

wrappers { //adds pre/post actions
timestamps()
timeout {
absolute(600)
}
}

steps {
shell('''
#!/usr/bin/env bash
if [[ -z "${WORKSPACE}" ]]
then
echo -e "\\n\\tERROR: WORKSPACE variable was not defined"
exit 1
else
if [[ ! -d "${WORKSPACE}" ]]
then
echo -e "\\n\\tERROR: WORKSPACE was defined, but did not exist?"
echo -e "\\t\\tIt was defined as ${WORKSPACE}"
exit 1
else
echo -e "\\n\\tINFO: WORKSPACE was defined as ${WORKSPACE}"
echo -e "\\t\\tWill delete contents, for clean run"
MaxLoops=15
SleepTime=60
currentLoop=0
nFilesOrDirs=$( find "${WORKSPACE}" -mindepth 1 -maxdepth 1 | wc -l )
while [[ ${nFilesOrDirs} -gt 0 ]]
do
currentLoop=$(( ${currentLoop} + 1 ))
if [[ ${currentLoop} -gt ${MaxLoops} ]]
then
echo -e "\\n\\tERROR: Number of re-try loops, ${currentLoop}, exceeded maximum, ${MaxLoops}. "
echo -e " \\t\\tPossibly due to files still being used by another process?"
exit 0
break
fi
echo -e "\\tcurrentLoop: ${currentLoop} nFilesOrDirs: ${nFilesOrDirs}"
find "${WORKSPACE}" -mindepth 1 -maxdepth 1 -execdir rm -fr '{}' \\;
nFilesOrDirs=$( find "${WORKSPACE}" -mindepth 1 -maxdepth 1 | wc -l )
if [[ ${nFilesOrDirs} -gt 0 ]]
then
sleep ${SleepTime}
fi
done
fi
fi
echo -e "\\t... ending cleaning"
exit 0
''')
shell('''
#!/bin/bash -x
definition {
cps {
sandbox()
script('''
pipeline {
options {
timeout(time: 600, unit: 'MINUTES')
timestamps()
buildDiscarder(logRotator(numToKeepStr:'5'))
}
parameters {
string(name: 'buildId', defaultValue: null, description: 'Build Id to test (such as I20120717-0800, N20120716-0800).')
}
agent {
label 'nc1ht-macos11-arm64'
}
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 = '/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home'
ANT_HOME = '/opt/homebrew/Cellar/ant/1.10.11/libexec'
PATH = "${JAVA_HOME}/bin:${ANT_HOME}/bin:${PATH}"
eclipseArch = 'x86_64'
}
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"
Expand All @@ -88,8 +48,8 @@ echo -e "\\n\\t uname -a: $(uname -a)\\n"
# 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
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
Expand All @@ -107,10 +67,6 @@ curl -o buildProperties.sh https://download.eclipse.org/eclipse/downloads/drops4
cat getEBuilder.xml
source buildProperties.sh
export JAVA_HOME=/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home
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 @@ -119,11 +75,10 @@ env 1>envVars.txt 2>&1
ant -diagnostics 1>antDiagnostics.txt 2>&1
java -XshowSettings -version 1>javaSettings.txt 2>&1
export eclipseArch=x86_64
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=macosx -Dosgi.ws=cocoa -Dosgi.arch=${eclipseArch} \\
-DtestSuite=${testSuite}
-DtestSuite=all
RAW_DATE_END="$(date +%s )"
Expand All @@ -132,29 +87,19 @@ 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"
''')
}

publishers {
archiveJunit('**/eclipse-testing/results/xml/*.xml') {
retainLongStdout()
healthScaleFactor((1.0).doubleValue())
}
archiveArtifacts {
pattern('**/eclipse-testing/results/**, **/eclipse-testing/directorLogs/**, *.properties, *.txt')
}
extendedEmail {
recipientList("[email protected]")
}
downstreamParameterized {
trigger('Releng/ep-collectResults') {
condition('UNSTABLE_OR_BETTER')
parameters {
predefinedProp('triggeringJob', '$JOB_BASE_NAME')
predefinedProp('buildURL', '$BUILD_URL')
predefinedProp('buildID', '$buildId')
\'\'\'
archiveArtifacts '**/eclipse-testing/results/**, **/eclipse-testing/directorLogs/**, *.properties, *.txt'
junit keepLongStdio: true, testResults: '**/eclipse-testing/results/xml/*.xml'
build job: 'Releng/ep-collectResults', wait: false, parameters: [
string(name: 'triggeringJob', value: "${JOB_BASE_NAME}"),
string(name: 'buildURL', value: "${BUILD_URL}"),
string(name: 'buildID', value: "${params.buildId}")
]
}
}
}
}
}
''')
}
}
}
Expand Down
143 changes: 44 additions & 99 deletions JenkinsJobs/AutomatedTests/I_unit_macM1_java17.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -5,79 +5,40 @@ for (STREAM in STREAMS){
def MAJOR = STREAM.split('\\.')[0]
def MINOR = STREAM.split('\\.')[1]

job('AutomatedTests/ep' + MAJOR + MINOR + 'I-unit-macM1-java17'){
pipelineJob('AutomatedTests/ep' + MAJOR + MINOR + 'I-unit-macM1-java17'){
description('Run Eclipse SDK Tests for the platform implied by this job\'s name')

logRotator {
numToKeep(5)
}

parameters {
stringParam('buildId', null, 'Build Id to test (such as I20120717-0800, N20120716-0800). ')
stringParam('testSuite', 'all', null)
}

label('nc1ht-macos11-arm64')

jdk('openjdk-jdk11-latest')

authenticationToken('windows2012tests')

wrappers { //adds pre/post actions
timestamps()
timeout {
absolute(600)
}
}

steps {
shell('''
#!/usr/bin/env bash
if [[ -z "${WORKSPACE}" ]]
then
echo -e "\\n\\tERROR: WORKSPACE variable was not defined"
exit 1
else
if [[ ! -d "${WORKSPACE}" ]]
then
echo -e "\\n\\tERROR: WORKSPACE was defined, but did not exist?"
echo -e "\\t\\tIt was defined as ${WORKSPACE}"
exit 1
else
echo -e "\\n\\tINFO: WORKSPACE was defined as ${WORKSPACE}"
echo -e "\\t\\tWill delete contents, for clean run"
MaxLoops=15
SleepTime=60
currentLoop=0
nFilesOrDirs=$( find "${WORKSPACE}" -mindepth 1 -maxdepth 1 | wc -l )
while [[ ${nFilesOrDirs} -gt 0 ]]
do
currentLoop=$(( ${currentLoop} + 1 ))
if [[ ${currentLoop} -gt ${MaxLoops} ]]
then
echo -e "\\n\\tERROR: Number of re-try loops, ${currentLoop}, exceeded maximum, ${MaxLoops}. "
echo -e " \\t\\tPossibly due to files still being used by another process?"
exit 0
break
fi
echo -e "\\tcurrentLoop: ${currentLoop} nFilesOrDirs: ${nFilesOrDirs}"
find "${WORKSPACE}" -mindepth 1 -maxdepth 1 -execdir rm -fr '{}' \\;
nFilesOrDirs=$( find "${WORKSPACE}" -mindepth 1 -maxdepth 1 | wc -l )
if [[ ${nFilesOrDirs} -gt 0 ]]
then
sleep ${SleepTime}
fi
done
fi
fi
echo -e "\\t... ending cleaning"
exit 0
''')
shell('''
#!/bin/bash -x
definition {
cps {
sandbox()
script('''
pipeline {
options {
timeout(time: 600, unit: 'MINUTES')
timestamps()
buildDiscarder(logRotator(numToKeepStr:'5'))
}
parameters {
string(name: 'buildId', defaultValue: null, description: 'Build Id to test (such as I20120717-0800, N20120716-0800).')
}
agent {
label 'nc1ht-macos11-arm64'
}
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 = '/usr/local/openjdk-17/Contents/Home'
ANT_HOME = '/opt/homebrew/Cellar/ant/1.10.11/libexec'
PATH = "${JAVA_HOME}/bin:${ANT_HOME}/bin:${PATH}"
eclipseArch = 'aarch64'
}
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"
Expand All @@ -87,8 +48,8 @@ echo -e "\\n\\t uname -a: $(uname -a)\\n"
# 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
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
Expand All @@ -106,24 +67,18 @@ curl -o buildProperties.sh https://download.eclipse.org/eclipse/downloads/drops4
cat getEBuilder.xml
source buildProperties.sh
export JAVA_HOME=/usr/local/openjdk-17/Contents/Home
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
export eclipseArch=aarch64
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=macosx -Dosgi.ws=cocoa -Dosgi.arch=${eclipseArch} \\
-DtestSuite=${testSuite}
-DtestSuite=all
RAW_DATE_END="$(date +%s )"
Expand All @@ -132,29 +87,19 @@ 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"
''')
}

publishers {
archiveJunit('**/eclipse-testing/results/xml/*.xml') {
retainLongStdout()
healthScaleFactor((1.0).doubleValue())
}
archiveArtifacts {
pattern('**/eclipse-testing/results/**, **/eclipse-testing/directorLogs/**, *.properties, *.txt')
}
extendedEmail {
recipientList("[email protected]")
}
downstreamParameterized {
trigger('Releng/ep-collectResults') {
condition('UNSTABLE_OR_BETTER')
parameters {
predefinedProp('triggeringJob', '$JOB_BASE_NAME')
predefinedProp('buildURL', '$BUILD_URL')
predefinedProp('buildID', '$buildId')
\'\'\'
archiveArtifacts '**/eclipse-testing/results/**, **/eclipse-testing/directorLogs/**, *.properties, *.txt'
junit keepLongStdio: true, testResults: '**/eclipse-testing/results/xml/*.xml'
build job: 'Releng/ep-collectResults', wait: false, parameters: [
string(name: 'triggeringJob', value: "${JOB_BASE_NAME}"),
string(name: 'buildURL', value: "${BUILD_URL}"),
string(name: 'buildID', value: "${params.buildId}")
]
}
}
}
}
}
''')
}
}
}
Expand Down
Loading

0 comments on commit c453c37

Please sign in to comment.