Skip to content

Commit dd6ad8b

Browse files
committed
[Build] Simplify git cloning/tagging and submodule branch definition
- Define maintenance branches for submodules in the .gitmodules file instead of separate text files and fetch from the tip of the remote of each submodules in I/Y-builds. - Specify other branches to checkout (like in case of Y-builds), in the buildConfigurations.json. - In I/Y-builds clone the same branch from that the current build runs respectively that's defined in the Jenkins job.
1 parent 6be7e3b commit dd6ad8b

File tree

8 files changed

+28
-59
lines changed

8 files changed

+28
-59
lines changed

JenkinsJobs/Builds/build.jenkinsfile

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ spec:
4949
def configurations = readJSON(file: "${WORKSPACE}/JenkinsJobs/buildConfigurations.json")
5050
BUILD = configurations["${BUILD_TYPE}"]
5151
assignEnvVariable('BUILD_TYPE_NAME', BUILD.typeName)
52-
assignEnvVariable('PATCH_OR_BRANCH_LABEL', BUILD.branchLabel)
52+
assignEnvVariable('GIT_SUBMODULE_BRANCHES', BUILD.branches ? BUILD.branches.collect{ name, branch -> "${name}:${branch}" }.join(',') : '')
5353
assignEnvVariable('TEST_NAME_PREFIX', "ep${matcher.group('major')}${matcher.group('minor')}${BUILD_TYPE}-unit")
5454
assignEnvVariable('TEST_CONFIGURATIONS_EXPECTED', BUILD.tests.collect{ c ->
5555
"${TEST_NAME_PREFIX}-${c.os}-${c.arch}-java${c.javaVersion}_${c.os}.${c.ws}.${c.arch}_${c.javaVersion}"
@@ -82,12 +82,21 @@ spec:
8282
git config --global user.name 'Eclipse Releng Bot'
8383

8484
# Clone this repo and all submodules into the 'AGG_DIR' directory
85-
git clone --branch=$BRANCH --recursive \
85+
git clone --branch=$BRANCH --recurse-submodules --remote-submodules \
8686
[email protected]:eclipse-platform/eclipse.platform.releng.aggregator.git "$CJE_ROOT/$AGG_DIR"
8787

8888
cd "$CJE_ROOT/$AGG_DIR"
8989

90-
git submodule foreach 'git fetch; SUBMODULE_BRANCH=$(grep $name: $CJE_ROOT/streams/repositories_$PATCH_OR_BRANCH_LABEL.txt | cut -f2 -d\\ ); SUBMODULE_BRANCH=${SUBMODULE_BRANCH:-$BRANCH}; echo Checking out $SUBMODULE_BRANCH; git checkout $SUBMODULE_BRANCH; git pull'
90+
if [ -n "${GIT_SUBMODULE_BRANCHES}" ]; then
91+
for submodule in ${GIT_SUBMODULE_BRANCHES//,/ }; do
92+
path=$(echo "$submodule" | cut -d: -f1)
93+
branch=$(echo "$submodule" | cut -d: -f2)
94+
pushd "${path}"
95+
git checkout ${branch}
96+
git pull
97+
popd
98+
done
99+
fi
91100

92101
# Create 'Build input' commit (considering commits potentially submitted to the aggregator BRANCH in the meantime)
93102
git checkout $BRANCH
@@ -133,14 +142,14 @@ spec:
133142
sshagent (['github-bot-ssh']) {
134143
sh '''#!/bin/bash -xe
135144
source $CJE_ROOT/buildproperties.shsource
136-
function toPushRepo() {
137-
from="$1"
138-
echo $(sed --expression 's,https://github.com/,[email protected]:,' <<< $from)
145+
function tagAndPush {
146+
git tag ${BUILD_ID} HEAD
147+
pushURL=$(git config remote.origin.url | sed --expression 's,https://github.com/,[email protected]:,')
148+
git push "${pushURL}" tag ${BUILD_ID}
139149
}
140-
export -f toPushRepo
141-
git submodule foreach 'if grep "^${name}:" $CJE_ROOT/streams/repositories_$PATCH_OR_BRANCH_LABEL.txt > /dev/null; then git tag $BUILD_ID; PUSH_URL="$(toPushRepo $(git config --get remote.origin.url))"; git push --verbose $PUSH_URL $BUILD_ID; else echo Skipping $name; fi || :'
142-
git tag $BUILD_ID
143-
git push --verbose origin $BUILD_ID
150+
export -f tagAndPush
151+
git submodule foreach 'tagAndPush'
152+
tagAndPush
144153
'''
145154
}
146155
// Git log creation

JenkinsJobs/Releng/prepareNextDevCycle.jenkinsfile

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,6 @@ pipeline {
284284
build.branch = env.MAINTENANCE_BRANCH
285285
build.schedule = ''
286286
}
287-
builds.I.branchLabel = env.MAINTENANCE_BRANCH
288287
}
289288
}
290289
replaceInFile('JenkinsJobs/Builds/dockerImages.jenkinsfile', [
@@ -293,13 +292,9 @@ pipeline {
293292
replaceInFile('cje-production/buildproperties.txt', [
294293
'BRANCH="master"' : "BRANCH=\"${MAINTENANCE_BRANCH}\"",
295294
])
296-
replaceInFile('cje-production/streams/repositories_java25.txt', [
297-
': master' : ": ${MAINTENANCE_BRANCH}",
295+
replaceAllInFile('.gitmodules', [
296+
'branch\\s*=\\s*master' : "branch = ${MAINTENANCE_BRANCH}",
298297
])
299-
replaceInFile('cje-production/streams/repositories_master.txt', [
300-
': master' : ": ${MAINTENANCE_BRANCH}",
301-
])
302-
sh "mv cje-production/streams/repositories_master.txt cje-production/streams/repositories_${MAINTENANCE_BRANCH}.txt"
303298

304299
gitCommitAllExcludingSubmodules("Move ${PREVIOUS_RELEASE_VERSION}-I builds to ${MAINTENANCE_BRANCH} branch")
305300

JenkinsJobs/buildConfigurations.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"I": {
33
"typeName": "Integration",
4-
"branchLabel": "master",
54
"streams": {
65
"4.38": {
76
"branch": "master",
@@ -55,14 +54,18 @@
5554
},
5655
"Y": {
5756
"typeName": "Beta Java 25",
58-
"branchLabel": "java25",
5957
"streams": {
6058
"4.38": {
6159
"branch": "master",
6260
"disabled": "true",
6361
"schedule": "0 10 * 8-10 2,4,6\n0 10 1-26 11 2,4,6"
6462
}
6563
},
64+
"branches": {
65+
"eclipse.jdt.core": "BETA_JAVA25",
66+
"eclipse.jdt.debug": "BETA_JAVA25",
67+
"eclipse.jdt.ui": "BETA_JAVA25"
68+
},
6669
"mailingList": "[email protected]",
6770
"testJobFolder": "YBuilds",
6871
"tests": [

RELENG.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ When the JDT team is ready they will raise an issue to create new Y builds and s
5454

5555
**Things to Do:**
5656
* 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.
57+
- Update `typeName` to the name of the new java version.
5858
- Remove the disablement of the current stream in the Y-build configuration (should be the only Y-build stream).
59+
- Update `branches` to point to the new BETA branch.
5960
- Add unit tests for the new java version and remove old ones.
60-
* Update and rename the java repository files in (cje-production/streams)[cje-production/streams]
61-
- Repos without a `BETA_JAVA##` branch should be set to master

cje-production/mbscripts/mb010_createEnvfiles.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ fn-addToPropFiles BUILD_ENV_FILE_PROP "\"$BUILD_ENV_FILE_PROP\""
7474
# variables in buildproperties.txt are now defined, add other commonly used variables to prop files
7575
fn-addToPropFiles BUILD_TYPE "\"${BUILD_TYPE}\""
7676
fn-addToPropFiles BUILD_TYPE_NAME "\"${BUILD_TYPE_NAME}\""
77-
fn-addToPropFiles PATCH_OR_BRANCH_LABEL "\"${PATCH_OR_BRANCH_LABEL}\""
7877
fn-addToPropFiles BUILD_ID "\"$BUILD_TYPE$TIMESTAMP\""
7978
fn-addToPropFiles BUILD_DIR_SEG "\"$BUILD_TYPE$TIMESTAMP\""
8079
fn-addToPropFiles EQ_BUILD_DIR_SEG "\"$BUILD_TYPE$TIMESTAMP\""

cje-production/streams/description.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

cje-production/streams/repositories_java25.txt

Lines changed: 0 additions & 21 deletions
This file was deleted.

cje-production/streams/repositories_master.txt

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)