Skip to content

Commit 814a16c

Browse files
committed
[I/Y-Build] Unify build configurations into buildConfigurations.json
The buildConfigurations.json becomes the central and only source for configurations of all I/Y-builds and their associated tests. It's read by the seed-job to create the corresponding Jenkins jobs and during I/Y-builds executions. This avoids a definition of test configurations split over multiple files and avoids continuous changes in the build pipeline file due to regular version, Java or infrastructure updates.
1 parent f338c60 commit 814a16c

File tree

7 files changed

+139
-91
lines changed

7 files changed

+139
-91
lines changed

JenkinsJobs/AutomatedTests/I_unit_tests.groovy

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
11
def config = new groovy.json.JsonSlurper().parseText(readFileFromWorkspace('buildConfigurations.json'))
22

3-
def TEST_CONFIGURATIONS = [
4-
[os: 'linux' , ws:'gtk' , arch: 'x86_64' , javaVersion: 21, agentLabel: 'ubuntu-2404' , javaHome: "tool(type:'jdk', name:'temurin-jdk21-latest')" ],
5-
[os: 'linux' , ws:'gtk' , arch: 'x86_64' , javaVersion: 25, agentLabel: 'ubuntu-2404' , javaHome: "tool(type:'jdk', name:'openjdk-jdk25-latest')" ],
6-
[os: 'macosx', ws:'cocoa', arch: 'aarch64', javaVersion: 21, agentLabel: 'nc1ht-macos11-arm64', javaHome: "'/Library/Java/JavaVirtualMachines/jdk-21.0.5+11-arm64/Contents/Home'" ],
7-
[os: 'macosx', ws:'cocoa', arch: 'x86_64' , javaVersion: 21, agentLabel: 'nc1ht-macos11-arm64', javaHome: "'/Library/Java/JavaVirtualMachines/jdk-21.0.5+11/Contents/Home'" ],
8-
[os: 'win32' , ws:'win32', arch: 'x86_64' , javaVersion: 21, agentLabel: 'qa6xd-win11' , javaHome: "'C:\\\\Program Files\\\\Eclipse Adoptium\\\\jdk-21.0.5.11-hotspot'" ],
9-
]
10-
113
for (STREAM in config.I.streams.keySet()){
124
def MAJOR = STREAM.split('\\.')[0]
135
def MINOR = STREAM.split('\\.')[1]
14-
for (TEST_CONFIG in TEST_CONFIGURATIONS){
6+
for (TEST_CONFIG in config.I.tests){
157

168
pipelineJob('AutomatedTests/ep' + MAJOR + MINOR + 'I-unit-' + TEST_CONFIG.os + '-' + TEST_CONFIG.arch + '-java' + TEST_CONFIG.javaVersion){
179
description('Run Eclipse SDK Tests for the platform implied by this job\'s name')

JenkinsJobs/Builds/build.jenkinsfile

Lines changed: 37 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,5 @@
1-
2-
def I_TEST_CONFIGURATIONS = [
3-
[ os: 'linux' , ws: 'gtk' , arch: 'x86_64' , javaVersion: 21],
4-
[ os: 'linux' , ws: 'gtk' , arch: 'x86_64' , javaVersion: 25],
5-
[ os: 'macosx', ws: 'cocoa', arch: 'aarch64', javaVersion: 21],
6-
[ os: 'macosx', ws: 'cocoa', arch: 'x86_64' , javaVersion: 21],
7-
[ os: 'win32' , ws: 'win32', arch: 'x86_64' , javaVersion: 21],
8-
]
9-
def Y_TEST_CONFIGURATIONS = [
10-
[ os: 'linux' , ws: 'gtk' , arch: 'x86_64' , javaVersion: 21],
11-
[ os: 'linux' , ws: 'gtk' , arch: 'x86_64' , javaVersion: 25],
12-
[ os: 'macosx', ws: 'cocoa', arch: 'aarch64', javaVersion: 21],
13-
[ os: 'macosx', ws: 'cocoa', arch: 'x86_64' , javaVersion: 21],
14-
]
15-
def BUILD = {
16-
def matcher = "$JOB_BASE_NAME" =~ '(?<type>[IY])-build-(?<major>\\d).(?<minor>\\d+)'
17-
if (matcher) {
18-
def buildConfig = [ type: matcher.group('type'), testPrefix: "ep${matcher.group('major')}${matcher.group('minor')}${matcher.group('type')}-unit"]
19-
switch(buildConfig.type) {
20-
case 'I': return [*:buildConfig,
21-
typeName: 'Integration' , branchLabel: 'master',
22-
mailingList: '[email protected]', testJobFolder:'AutomatedTests', testConfigurations: I_TEST_CONFIGURATIONS]
23-
case 'Y': return [*:buildConfig,
24-
typeName: 'Beta Java 25', branchLabel: 'java25',
25-
mailingList: '[email protected]' , testJobFolder:'YBuilds' , testConfigurations: Y_TEST_CONFIGURATIONS]
26-
}
27-
}
28-
error("Unsupported job: $JOB_BASE_NAME" )
29-
}()
30-
31-
def testConfigurationsExpected = BUILD.testConfigurations.collect{c ->
32-
"${BUILD.testPrefix}-${c.os}-${c.arch}-java${c.javaVersion}_${c.os}.${c.ws}.${c.arch}_${c.javaVersion}"
33-
}.join(',')
1+
@groovy.transform.Field
2+
def BUILD = null
343

354
pipeline {
365
options {
@@ -63,43 +32,42 @@ spec:
6332
ant 'apache-ant-latest'
6433
}
6534
environment {
66-
BUILD_TYPE = "${BUILD.type}"
67-
BUILD_TYPE_NAME = "${BUILD.typeName}"
68-
PATCH_OR_BRANCH_LABEL = "${BUILD.branchLabel}"
69-
7035
MAVEN_OPTS = '-Xmx4G'
7136
CJE_ROOT = "${WORKSPACE}/cje-production"
7237
logDir = "$CJE_ROOT/buildlogs"
73-
TEST_CONFIGURATIONS_EXPECTED = "${testConfigurationsExpected}"
7438
}
7539
stages {
76-
stage('Setup intial configuration'){
40+
stage('Set up environment') {
7741
steps {
78-
dir("${CJE_ROOT}") {
79-
sh '''
80-
chmod +x mbscripts/*
81-
mkdir -p $logDir
82-
'''
42+
script { // Extend build configuration with data from the configuration file
43+
def matcher = "$JOB_BASE_NAME" =~ '(?<type>[IY])-build-(?<major>\\d).(?<minor>\\d+)'
44+
if (!matcher) {
45+
error("Unsupported job: $JOB_BASE_NAME")
46+
}
47+
assignEnvVariable('BUILD_TYPE', matcher.group('type'))
48+
def configurations = readJSON(file: "${WORKSPACE}/JenkinsJobs/buildConfigurations.json")
49+
BUILD = configurations["${BUILD_TYPE}"]
50+
assignEnvVariable('BUILD_TYPE_NAME', BUILD.typeName)
51+
assignEnvVariable('PATCH_OR_BRANCH_LABEL', BUILD.branchLabel)
52+
assignEnvVariable('TEST_NAME_PREFIX', "ep${matcher.group('major')}${matcher.group('minor')}${BUILD_TYPE}-unit")
53+
assignEnvVariable('TEST_CONFIGURATIONS_EXPECTED', BUILD.tests.collect{ c ->
54+
"${TEST_NAME_PREFIX}-${c.os}-${c.arch}-java${c.javaVersion}_${c.os}.${c.ws}.${c.arch}_${c.javaVersion}"
55+
}.join(','))
8356
}
84-
}
85-
}
86-
stage('Generate environment variables'){
87-
steps {
88-
dir("${CJE_ROOT}/mbscripts") {
89-
sh '''
90-
set -eo pipefail
91-
./mb010_createEnvfiles.sh $CJE_ROOT/buildproperties.shsource 2>&1 | tee $logDir/mb010_createEnvfiles.sh.log
92-
'''
57+
dir("${CJE_ROOT}") {
58+
sh '''
59+
set -eo pipefail
60+
chmod +x mbscripts/*
61+
mkdir -p $logDir
62+
63+
./mbscripts/mb010_createEnvfiles.sh ${CJE_ROOT}/buildproperties.shsource 2>&1 | tee $logDir/mb010_createEnvfiles.sh.log
64+
'''
9365
}
94-
}
95-
}
96-
stage('Export environment variables stage 1'){
97-
steps {
9866
script {
9967
def buildProps = readBuildProperties("${CJE_ROOT}/buildproperties.properties")
100-
env.BUILD_IID = buildProps.BUILD_TYPE + buildProps.TIMESTAMP
101-
env.STREAM = buildProps.STREAM
102-
env.RELEASE_VER = buildProps.RELEASE_VER
68+
assignEnvVariable('BUILD_IID', buildProps.BUILD_TYPE + buildProps.TIMESTAMP)
69+
assignEnvVariable('STREAM', buildProps.STREAM)
70+
assignEnvVariable('RELEASE_VER', buildProps.RELEASE_VER)
10371
}
10472
}
10573
}
@@ -294,11 +262,11 @@ spec:
294262
}
295263
}
296264
}
297-
stage('Trigger tests'){
265+
stage('Trigger tests') {
298266
steps {
299267
script {
300-
for (c in BUILD.testConfigurations) {
301-
build job: "${BUILD.testJobFolder}/${BUILD.testPrefix}-${c.os}-${c.arch}-java${c.javaVersion}", wait: false, parameters: [
268+
for (c in BUILD.tests) {
269+
build job: "${BUILD.testJobFolder}/${TEST_NAME_PREFIX}-${c.os}-${c.arch}-java${c.javaVersion}", wait: false, parameters: [
302270
string(name: 'buildId', value: "${BUILD_IID}")
303271
]
304272
}
@@ -359,6 +327,12 @@ spec:
359327
}
360328
}
361329

330+
@NonCPS
331+
def assignEnvVariable(String name, String value) {
332+
env[name] = value
333+
println("${name}=${value}")
334+
}
335+
362336
def readBuildProperties(String buildPropertiesFile){
363337
return readProperties(file: buildPropertiesFile, charset: 'UTF-8').collectEntries{n, v ->
364338
v = v.trim();

JenkinsJobs/Releng/prepareNextDevCycle.jenkinsfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,11 +284,9 @@ pipeline {
284284
build.branch = env.MAINTENANCE_BRANCH
285285
build.schedule = ''
286286
}
287+
builds.I.branchLabel = env.MAINTENANCE_BRANCH
287288
}
288289
}
289-
replaceInFile('JenkinsJobs/Builds/build.jenkinsfile', [
290-
"typeName: 'Integration' , branchLabel: 'master'" : "typeName: 'Integration' , branchLabel: '${MAINTENANCE_BRANCH}'",
291-
])
292290
replaceInFile('JenkinsJobs/Builds/dockerImages.jenkinsfile', [
293291
'-b master' : "-b ${MAINTENANCE_BRANCH}",
294292
])

JenkinsJobs/YBuilds/Y_unit_tests.groovy

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
11
def config = new groovy.json.JsonSlurper().parseText(readFileFromWorkspace('buildConfigurations.json'))
22

3-
def TEST_CONFIGURATIONS = [
4-
[os: 'linux' , ws:'gtk' , arch: 'x86_64' , javaVersion: 21, agentLabel: 'ubuntu-2404' , javaHome: "tool(type:'jdk', name:'temurin-jdk21-latest')" ],
5-
[os: 'linux' , ws:'gtk' , arch: 'x86_64' , javaVersion: 25, agentLabel: 'ubuntu-2404' , javaHome: "install('jdk', 'https://download.java.net/java/GA/jdk25/bd75d5f9689641da8e1daabeccb5528b/36/GPL/openjdk-25_linux-x64_bin.tar.gz')" ],
6-
[os: 'macosx', ws:'cocoa', arch: 'aarch64', javaVersion: 21, agentLabel: 'nc1ht-macos11-arm64', javaHome: "'/Library/Java/JavaVirtualMachines/jdk-21.0.5+11-arm64/Contents/Home'" ],
7-
[os: 'macosx', ws:'cocoa', arch: 'x86_64' , javaVersion: 21, agentLabel: 'nc1ht-macos11-arm64', javaHome: "'/Library/Java/JavaVirtualMachines/jdk-21.0.5+11/Contents/Home'" ],
8-
[os: 'win32' , ws:'win32', arch: 'x86_64' , javaVersion: 21, agentLabel: 'qa6xd-win11' , javaHome: "'C:\\\\Program Files\\\\Eclipse Adoptium\\\\jdk-21.0.5.11-hotspot'" ],
9-
]
10-
113
for (STREAM in config.Y.streams.keySet()){
124
def MAJOR = STREAM.split('\\.')[0]
135
def MINOR = STREAM.split('\\.')[1]
14-
for (TEST_CONFIG in TEST_CONFIGURATIONS){
6+
for (TEST_CONFIG in config.Y.tests){
157

168
pipelineJob('YBuilds/ep' + MAJOR + MINOR + 'Y-unit-' + TEST_CONFIG.os + '-' + TEST_CONFIG.arch + '-java' + TEST_CONFIG.javaVersion){
179
description('Run Eclipse SDK Tests for the platform implied by this job\'s name')
Lines changed: 94 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,111 @@
11
{
22
"I": {
3+
"typeName": "Integration",
4+
"branchLabel": "master",
35
"streams": {
46
"4.38": {
57
"branch": "master",
68
"schedule": "0 18 * 8-10 *\n0 18 1-26 11 *"
79
}
8-
}
10+
},
11+
"mailingList": "[email protected]",
12+
"testJobFolder": "AutomatedTests",
13+
"tests": [
14+
{
15+
"os": "linux",
16+
"ws": "gtk",
17+
"arch": "x86_64",
18+
"javaVersion": 21,
19+
"agentLabel": "ubuntu-2404",
20+
"javaHome": "tool(type:'jdk', name:'temurin-jdk21-latest')"
21+
},
22+
{
23+
"os": "linux",
24+
"ws": "gtk",
25+
"arch": "x86_64",
26+
"javaVersion": 25,
27+
"agentLabel": "ubuntu-2404",
28+
"javaHome": "tool(type:'jdk', name:'openjdk-jdk25-latest')"
29+
},
30+
{
31+
"os": "macosx",
32+
"ws": "cocoa",
33+
"arch": "aarch64",
34+
"javaVersion": 21,
35+
"agentLabel": "nc1ht-macos11-arm64",
36+
"javaHome": "'/Library/Java/JavaVirtualMachines/jdk-21.0.5+11-arm64/Contents/Home'"
37+
},
38+
{
39+
"os": "macosx",
40+
"ws": "cocoa",
41+
"arch": "x86_64",
42+
"javaVersion": 21,
43+
"agentLabel": "nc1ht-macos11-arm64",
44+
"javaHome": "'/Library/Java/JavaVirtualMachines/jdk-21.0.5+11/Contents/Home'"
45+
},
46+
{
47+
"os": "win32",
48+
"ws": "win32",
49+
"arch": "x86_64",
50+
"javaVersion": 21,
51+
"agentLabel": "qa6xd-win11",
52+
"javaHome": "'C:\\\\Program Files\\\\Eclipse Adoptium\\\\jdk-21.0.5.11-hotspot'"
53+
}
54+
]
955
},
1056
"Y": {
57+
"typeName": "Beta Java 25",
58+
"branchLabel": "java25",
1159
"streams": {
1260
"4.38": {
1361
"branch": "master",
1462
"disabled": "true",
1563
"schedule": "0 10 * 8-10 2,4,6\n0 10 1-26 11 2,4,6"
1664
}
17-
}
65+
},
66+
"mailingList": "[email protected]",
67+
"testJobFolder": "YBuilds",
68+
"tests": [
69+
{
70+
"os": "linux",
71+
"ws": "gtk",
72+
"arch": "x86_64",
73+
"javaVersion": 21,
74+
"agentLabel": "ubuntu-2404",
75+
"javaHome": "tool(type:'jdk', name:'temurin-jdk21-latest')"
76+
},
77+
{
78+
"os": "linux",
79+
"ws": "gtk",
80+
"arch": "x86_64",
81+
"javaVersion": 25,
82+
"agentLabel": "ubuntu-2404",
83+
"javaHome": "install('jdk', 'https://download.java.net/java/GA/jdk25/bd75d5f9689641da8e1daabeccb5528b/36/GPL/openjdk-25_linux-x64_bin.tar.gz')"
84+
},
85+
{
86+
"os": "macosx",
87+
"ws": "cocoa",
88+
"arch": "aarch64",
89+
"javaVersion": 21,
90+
"agentLabel": "nc1ht-macos11-arm64",
91+
"javaHome": "'/Library/Java/JavaVirtualMachines/jdk-21.0.5+11-arm64/Contents/Home'"
92+
},
93+
{
94+
"os": "macosx",
95+
"ws": "cocoa",
96+
"arch": "x86_64",
97+
"javaVersion": 21,
98+
"agentLabel": "nc1ht-macos11-arm64",
99+
"javaHome": "'/Library/Java/JavaVirtualMachines/jdk-21.0.5+11/Contents/Home'"
100+
},
101+
{
102+
"os": "win32",
103+
"ws": "win32",
104+
"arch": "x86_64",
105+
"javaVersion": 21,
106+
"agentLabel": "qa6xd-win11",
107+
"javaHome": "'C:\\\\Program Files\\\\Eclipse Adoptium\\\\jdk-21.0.5.11-hotspot'"
108+
}
109+
]
18110
}
19111
}

RELENG.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ The builds themselves and their unit tests are in the (Y Builds)[JenkinsJobs/YBu
5353
When the JDT team is ready they will raise an issue to create new Y builds and supply the name of the new branch, usually `BETA_JAVA##`.
5454

5555
**Things to Do:**
56-
* Update the Y-build configuration in the (build.jenkinsfile)[JenkinsJobs/Builds/build.jenkinsfile]
57-
- Update `branchLabel` and `typeName` to the name of the new java version
58-
* Remove the disablement of the current stream in the Y-build configuration in the (buildConfigurations.json)[JenkinsJobs/buildConfigurations.json] (should be the only Y-build stream).
56+
* Update the Y-build configuration in the (buildConfigurations.json)[JenkinsJobs/buildConfigurations.json]
57+
- Update `branchLabel` and `typeName` to the name of the new java version.
58+
- Remove the disablement of the current stream in the Y-build configuration (should be the only Y-build stream).
59+
- Add unit tests for the new java version and remove old ones.
5960
* Update and rename the java repository files in (cje-production/streams)[cje-production/streams]
6061
- Repos without a `BETA_JAVA##` branch should be set to master
61-
* Add unit tests for the new java version in (JenkinsJobs/YBuilds)[JenkinsJobs/YBuilds] and (build.jenkinsfile)[JenkinsJobs/Builds/build.jenkinsfile]

cje-production/mbscripts/mb010_createEnvfiles.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ do
6464
fi
6565
fn-addToPropFiles $key "$value"
6666
fi
67-
done < ../buildproperties.txt
67+
done < ${CJE_ROOT}/buildproperties.txt
6868

6969
source $BUILD_ENV_FILE
7070
# add BUILD_ENV_FILE* variables to prop files before using fn-write-property in common-functions.shsource

0 commit comments

Comments
 (0)