|
| 1 | +def config = new groovy.json.JsonSlurper().parseText(readFileFromWorkspace('JenkinsJobs/JobDSL.json')) |
| 2 | +def STREAMS = config.Streams |
| 3 | + |
| 4 | +for (STREAM in STREAMS){ |
| 5 | + def MAJOR = STREAM.split('\\.')[0] |
| 6 | + def MINOR = STREAM.split('\\.')[1] |
| 7 | + |
| 8 | + pipelineJob('AutomatedTests/ep' + MAJOR + MINOR + 'I-unit-cen64-gtk3-java23'){ |
| 9 | + description('Run Eclipse SDK Tests for the platform implied by this job\'s name') |
| 10 | + parameters { // Define parameters in job configuration to make them available from the very first build onwards |
| 11 | + stringParam('buildId', null, 'Build Id to test (such as I20240611-1800, N20120716-0800).') |
| 12 | + } |
| 13 | + |
| 14 | + definition { |
| 15 | + cps { |
| 16 | + sandbox() |
| 17 | + script(''' |
| 18 | +pipeline { |
| 19 | + options { |
| 20 | + timeout(time: 600, unit: 'MINUTES') |
| 21 | + timestamps() |
| 22 | + buildDiscarder(logRotator(numToKeepStr:'5')) |
| 23 | + } |
| 24 | + agent { |
| 25 | + kubernetes { |
| 26 | + label 'centos-unitpod23' |
| 27 | + defaultContainer 'custom' |
| 28 | + yaml """ |
| 29 | +apiVersion: v1 |
| 30 | +kind: Pod |
| 31 | +spec: |
| 32 | + containers: |
| 33 | + - name: "jnlp" |
| 34 | + resources: |
| 35 | + limits: |
| 36 | + memory: "2048Mi" |
| 37 | + cpu: "2000m" |
| 38 | + requests: |
| 39 | + memory: "512Mi" |
| 40 | + cpu: "1000m" |
| 41 | + - name: "custom" |
| 42 | + image: "eclipse/platformreleng-centos-gtk3-metacity:8" |
| 43 | + imagePullPolicy: "Always" |
| 44 | + resources: |
| 45 | + limits: |
| 46 | + memory: "4096Mi" |
| 47 | + cpu: "1000m" |
| 48 | + requests: |
| 49 | + # memory needs to be at least 1024Mi, see https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/issues/2478 |
| 50 | + memory: "1024Mi" |
| 51 | + cpu: "1000m" |
| 52 | + securityContext: |
| 53 | + privileged: false |
| 54 | + tty: true |
| 55 | + command: |
| 56 | + - cat |
| 57 | + volumeMounts: |
| 58 | + - mountPath: "/opt/tools" |
| 59 | + name: "volume-0" |
| 60 | + readOnly: false |
| 61 | + workingDir: "/home/jenkins/agent" |
| 62 | + nodeSelector: {} |
| 63 | + restartPolicy: "Never" |
| 64 | + volumes: |
| 65 | + - name: "volume-0" |
| 66 | + persistentVolumeClaim: |
| 67 | + claimName: "tools-claim-jiro-releng" |
| 68 | + readOnly: true |
| 69 | + - configMap: |
| 70 | + name: "known-hosts" |
| 71 | + name: "volume-1" |
| 72 | + - emptyDir: |
| 73 | + medium: "" |
| 74 | + name: "workspace-volume" |
| 75 | + - emptyDir: |
| 76 | + medium: "" |
| 77 | + name: "volume-3" |
| 78 | +""" |
| 79 | + } |
| 80 | + } |
| 81 | +
|
| 82 | + stages { |
| 83 | + stage('Run tests'){ |
| 84 | + environment { |
| 85 | + // 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 |
| 86 | + ANT_HOME = tool(type:'ant', name:'apache-ant-latest') |
| 87 | + PATH = "${JAVA_HOME}/bin:${ANT_HOME}/bin:${PATH}" |
| 88 | + } |
| 89 | + steps { |
| 90 | + container ('custom'){ |
| 91 | + xvnc(useXauthority: true) { |
| 92 | + sh \'\'\'#!/bin/bash -x |
| 93 | + |
| 94 | + buildId=$(echo $buildId|tr -d ' ') |
| 95 | + RAW_DATE_START="$(date +%s )" |
| 96 | + |
| 97 | + export LANG=en_US.UTF-8 |
| 98 | + cat /etc/*release |
| 99 | + echo -e "\\n\\tRAW Date Start: ${RAW_DATE_START} \\n" |
| 100 | + echo -e "\\n\\t whoami: $( whoami )\\n" |
| 101 | + echo -e "\\n\\t uname -a: $(uname -a)\\n" |
| 102 | + |
| 103 | + # 0002 is often the default for shell users, but it is not when ran from |
| 104 | + # a cron job, so we set it explicitly, to be sure of value, so releng group has write access to anything |
| 105 | + # we create on shared area. |
| 106 | + oldumask=$(umask) |
| 107 | + umask 0002 |
| 108 | + |
| 109 | + echo "umask explicitly set to 0002, old value was $oldumask" |
| 110 | + |
| 111 | + # we want java.io.tmpdir to be in $WORKSPACE, but must already exist, for Java to use it. |
| 112 | + mkdir -p ${WORKSPACE}/tmp |
| 113 | + |
| 114 | + wget -O ${WORKSPACE}/getEBuilder.xml --no-verbose --no-check-certificate https://download.eclipse.org/eclipse/relengScripts/production/testScripts/hudsonBootstrap/getEBuilder.xml 2>&1 |
| 115 | + wget -O ${WORKSPACE}/buildproperties.shsource --no-check-certificate https://download.eclipse.org/eclipse/downloads/drops4/${buildId}/buildproperties.shsource |
| 116 | + cat ${WORKSPACE}/buildproperties.shsource |
| 117 | + source ${WORKSPACE}/buildproperties.shsource |
| 118 | + |
| 119 | + echo JAVA_HOME: $JAVA_HOME |
| 120 | + echo ANT_HOME: $ANT_HOME |
| 121 | + echo PATH: $PATH |
| 122 | + export ANT_OPTS="${ANT_OPTS} -Djava.io.tmpdir=${WORKSPACE}/tmp -Djava.security.manager=allow" |
| 123 | + |
| 124 | + env 1>envVars.txt 2>&1 |
| 125 | + ant -diagnostics 1>antDiagnostics.txt 2>&1 |
| 126 | + java -XshowSettings -version 1>javaSettings.txt 2>&1 |
| 127 | + |
| 128 | + ant -f getEBuilder.xml -Djava.io.tmpdir=${WORKSPACE}/tmp -DbuildId=$buildId -DeclipseStream=$STREAM -DEBUILDER_HASH=${EBUILDER_HASH} \\ |
| 129 | + -DdownloadURL=https://download.eclipse.org/eclipse/downloads/drops4/${buildId} \\ |
| 130 | + -Dosgi.os=linux -Dosgi.ws=gtk -Dosgi.arch=x86_64 \\ |
| 131 | + -DtestSuite=all \\ |
| 132 | + -Djvm=${JAVA_HOME}/bin/java |
| 133 | + |
| 134 | + RAW_DATE_END="$(date +%s )" |
| 135 | + |
| 136 | + echo -e "\\n\\tRAW Date End: ${RAW_DATE_END} \\n" |
| 137 | + |
| 138 | + TOTAL_TIME=$((${RAW_DATE_END} - ${RAW_DATE_START})) |
| 139 | + |
| 140 | + echo -e "\\n\\tTotal elapsed time: ${TOTAL_TIME} \\n" |
| 141 | + \'\'\' |
| 142 | + } |
| 143 | + } |
| 144 | + archiveArtifacts '**/eclipse-testing/results/**, **/eclipse-testing/directorLogs/**, *.properties, *.txt' |
| 145 | + junit keepLongStdio: true, testResults: '**/eclipse-testing/results/xml/*.xml' |
| 146 | + build job: 'Releng/ep-collectResults', wait: false, parameters: [ |
| 147 | + string(name: 'triggeringJob', value: "${JOB_BASE_NAME}"), |
| 148 | + string(name: 'buildURL', value: "${BUILD_URL}"), |
| 149 | + string(name: 'buildID', value: "${params.buildId}") |
| 150 | + ] |
| 151 | + } |
| 152 | + } |
| 153 | + } |
| 154 | +} |
| 155 | + ''') |
| 156 | + } |
| 157 | + } |
| 158 | + } |
| 159 | +} |
0 commit comments