Skip to content

Commit 0b2e6d4

Browse files
committed
Add dedicated job to modify a p2 composite repository
- unifies the code to modify a composite p2-repository, which was previously written in multiple locations - the new job performs all operations locally within the job's workspace and only copies the resulting files to the download-server. This therefore eliminates the remaining executions of Eclipse directly on the download-server. - A dedicated job, prevents concurrent modifications of the same repository - A dedicated job, allows run a specific modification manually if necessary (for out of order trouble-shooting).
1 parent 9d62e9a commit 0b2e6d4

File tree

12 files changed

+199
-321
lines changed

12 files changed

+199
-321
lines changed

JenkinsJobs/Builds/build.jenkinsfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,17 @@ spec:
280280
./mb620_promoteUpdateSite.sh $CJE_ROOT/buildproperties.shsource
281281
'''
282282
}
283+
script {
284+
if ("${COMPARATOR_ERRORS_SUBJECT}" != '' && "$BUILD_TYPE" != "I") {
285+
echo 'Skip adding unstable build to composite repository.'
286+
return //TODO: test this
287+
}
288+
build job: 'Releng/modifyP2CompositeRepository', wait: true, propagate: true, parameters: [
289+
string(name: 'repositoryPath', value: "eclipse/updates/${RELEASE_VER}-I-builds"),
290+
string(name: 'add', value: "${BUILD_IID}"),
291+
string(name: 'sizeLimit', value: '3')
292+
]
293+
}
283294
}
284295
}
285296
}

JenkinsJobs/Builds/markBuild.groovy

Lines changed: 12 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pipeline {
2222
}
2323
stages {
2424
stage('Mark ''' + marker + ''''){
25-
steps { // workspace is not always cleaned by default. Clean before custom tools are installed into workspace.
25+
steps {
2626
sshagent(['projects-storage.eclipse.org-bot-ssh']) {
2727
sh \'''#!/bin/bash -xe
2828
# this function executes command passed as command line parameter and
@@ -40,48 +40,8 @@ pipeline {
4040
echo "IssueUrl is empty! Exiting."
4141
exit 1
4242
fi''' : '') + '''
43-
4443
epDownloadDir=/home/data/httpd/download.eclipse.org/eclipse
45-
dropsPath=${epDownloadDir}/downloads/drops4
46-
p2RepoPath=${epDownloadDir}/updates
47-
buildDir=${dropsPath}/${buildId}
48-
49-
workingDir=${epDownloadDir}/workingDir
50-
51-
workspace=${workingDir}/${JOB_NAME}-${BUILD_NUMBER}
52-
53-
ssh [email protected] rm -rf ${workingDir}/${JOB_NAME}*
54-
55-
ssh [email protected] mkdir -p ${workspace}
56-
ssh [email protected] cd ${workspace}
57-
58-
#get latest Eclipse platform product
59-
epRelDir=$(ssh [email protected] ls -d --format=single-column ${dropsPath}/R-*|sort|tail -1)
60-
ssh [email protected] tar -C ${workspace} -xzf ${epRelDir}/eclipse-platform-*-linux-gtk-x86_64.tar.gz
61-
62-
#get requisite tools
63-
markingScriptName=\'''' + { switch (marker) {
64-
case 'stable': return 'addToComposite'
65-
case 'unstable': return 'removeFromComposite'
66-
default : throw new IllegalArgumentException("Unknown marker: ${marker}")
67-
} }() + ''''
68-
ssh [email protected] wget -O ${workspace}/${markingScriptName}.xml https://download.eclipse.org/eclipse/relengScripts/cje-production/scripts/${markingScriptName}.xml
69-
70-
#triggering ant runner
71-
baseBuilderDir=${workspace}/eclipse
72-
javaCMD=/opt/public/common/java/openjdk/jdk-21_x64-latest/bin/java
73-
74-
launcherJar=$(ssh [email protected] find ${baseBuilderDir}/. -name "org.eclipse.equinox.launcher_*.jar" | sort | head -1 )
75-
76-
scp [email protected]:${buildDir}/buildproperties.shsource .
77-
source ./buildproperties.shsource
78-
repoDir=/home/data/httpd/download.eclipse.org/eclipse/updates/${STREAMMajor}.${STREAMMinor}-${BUILD_TYPE}-builds
79-
80-
devworkspace=${workspace}/workspace-antRunner
81-
devArgs=-Xmx512m
82-
extraArgs="${markingScriptName} -Drepodir=${repoDir} -Dcomplocation=${buildId}"
83-
ssh [email protected] ${javaCMD} -jar ${launcherJar} -nosplash -consolelog -debug -data $devworkspace \\
84-
-application org.eclipse.ant.core.antRunner -file ${workspace}/${markingScriptName}.xml ${extraArgs} -vmargs $devArgs
44+
buildDir="${epDownloadDir}/downloads/drops4/${buildId}"
8545
''' + { switch (marker) {
8646
case 'stable': return '''
8747
#Remove hidden attribute and unstable tags
@@ -98,8 +58,17 @@ pipeline {
9858
'''
9959
default : throw new IllegalArgumentException("Unknown marker: ${marker}")
10060
} }() + '''
101-
ssh [email protected] rm -rf ${workingDir}/${JOB_NAME}*
10261
\'''
62+
//TODO: get !RELEASE_VER
63+
build job: 'Releng/modifyP2CompositeRepository', wait: true, propagate: true, parameters: [
64+
string(name: 'repositoryPath', value: "eclipse/updates/${RELEASE_VER}-I-builds"),
65+
string(name: \'''' + { switch (marker) {
66+
case 'stable': return 'add'
67+
case 'unstable': return 'remove'
68+
default : throw new IllegalArgumentException("Unknown marker: ${marker}")
69+
} }() + '''\', value: "${BUILD_IID}"),
70+
string(name: 'sizeLimit', value: '3')
71+
]
10372
build job: 'Releng/updateIndex', wait: false
10473
}
10574
}

JenkinsJobs/Releng/FOLDER.groovy

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,26 @@ Releases are published to <a href="https://repo1.maven.org/maven2/org/eclipse/">
6161
}
6262
}
6363

64+
pipelineJob('Releng/modifyP2CompositeRepository'){
65+
displayName('Modify P2 composite repository')
66+
description('Add or remove children from an Eclipse-P2 composite repository.')
67+
parameters {
68+
stringParam('repositoryPath', null, "Relative repository path from https://download.eclipse.org/. E.g. 'eclipse/updates/4.37-I-builds'")
69+
stringParam('add', null, 'Comma separated list of children to add. May be empty')
70+
stringParam('remove', null, 'Comma separated list of children to remove. May be empty')
71+
stringParam('sizeLimit', null, 'The maximum number of childrem of the modified composite. If the')
72+
}
73+
definition {
74+
cpsScm {
75+
lightweight(true)
76+
scm {
77+
github('eclipse-platform/eclipse.platform.releng.aggregator', 'master')
78+
}
79+
scriptPath('JenkinsJobs/Releng/modifyP2CompositeRepository.jenkinsfile')
80+
}
81+
}
82+
}
83+
6484
pipelineJob('Releng/prepareNextDevCycle'){
6585
displayName('Prepare Next Development Cycle')
6686
description('Perform all steps to prepare the next development cycle of Eclipse.')

JenkinsJobs/Releng/checkCompositesValidity.groovy

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

JenkinsJobs/Releng/makeVisible.jenkinsfile

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -62,42 +62,10 @@ pipeline {
6262
environment name: 'RELEASE_TYPE', value: 'R'
6363
}
6464
steps {
65-
sshagent(['projects-storage.eclipse.org-bot-ssh']) {
66-
sh '''
67-
#Repository will be available only for R builds. add it to composite
68-
epDownloadDir=/home/data/httpd/download.eclipse.org/eclipse
69-
dropsPath=${epDownloadDir}/downloads/drops4
70-
workingDir=${epDownloadDir}/workingDir
71-
72-
workspace=${workingDir}/${JOB_NAME}-${BUILD_NUMBER}
73-
74-
ssh [email protected] rm -rf ${workingDir}/${JOB_NAME}*
75-
76-
ssh [email protected] mkdir -p ${workspace}
77-
ssh [email protected] cd ${workspace}
78-
79-
#get latest Eclipse platform product
80-
epRelDir=$(ssh [email protected] ls -d --format=single-column ${dropsPath}/R-*|sort|tail -1)
81-
ssh [email protected] tar -C ${workspace} -xzf ${epRelDir}/eclipse-platform-*-linux-gtk-x86_64.tar.gz
82-
83-
#get requisite tools
84-
ssh [email protected] wget -O ${workspace}/addToComposite.xml https://download.eclipse.org/eclipse/relengScripts/cje-production/scripts/addToComposite.xml
85-
86-
#triggering ant runner
87-
baseBuilderDir=${workspace}/eclipse
88-
javaCMD=/opt/public/common/java/openjdk/jdk-21_x64-latest/bin/java
89-
launcherJar=$(ssh [email protected] find ${baseBuilderDir}/. -name "org.eclipse.equinox.launcher_*.jar" | sort | head -1 )
90-
91-
repoDir=/"home/data/httpd/download.eclipse.org/eclipse/updates/${BUILD_MAJOR}.${BUILD_MINOR}"
92-
93-
devWorkspace=${workspace}/workspace-antRunner
94-
devArgs=-Xmx512m
95-
extraArgs="addToComposite -Drepodir=${repoDir} -Dcomplocation=${RELEASE_ID}"
96-
ssh [email protected] ${javaCMD} -jar ${launcherJar} -nosplash -consolelog -debug -data $devWorkspace -application org.eclipse.ant.core.antRunner -file ${workspace}/addToComposite.xml ${extraArgs} -vmargs $devArgs
97-
98-
ssh [email protected] rm -rf ${workingDir}/${JOB_NAME}*
99-
'''
100-
}
65+
build job: 'Releng/modifyP2CompositeRepository', wait: true, propagate: true, parameters: [
66+
string(name: 'repositoryPath', value: "eclipse/updates/${RELEASE_VERSION_MAJOR}.${RELEASE_VERSION_MINOR}"),
67+
string(name: 'add', value: "${RELEASE_ID}"),
68+
]
10169
}
10270
}
10371
}
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
pipeline {
2+
options {
3+
disableConcurrentBuilds() // prevent concurrent updates of the same repository
4+
timestamps()
5+
skipDefaultCheckout()
6+
timeout(time: 15, unit: 'MINUTES')
7+
buildDiscarder(logRotator(numToKeepStr:'5'))
8+
}
9+
//TODO: move parameters to job definition
10+
parameters {
11+
string(name: 'repositoryPath', defaultValue: 'eclipse/updates/4.37-I-builds', description: "Relative repository path from https://download.eclipse.org/. E.g. 'eclipse/updates/4.37-I-builds'")
12+
string(name: 'add', defaultValue: 'I20250616-1800', description: 'Comma separated list of children to add. May be empty')
13+
string(name: 'remove', description: 'Comma separated list of children to remove. May be empty')
14+
string(name: 'sizeLimit', defaultValue: '3', description: 'The maximum number of childrem of the modified composite. If the')
15+
}
16+
agent {
17+
label 'ubuntu-2404'
18+
}
19+
tools {
20+
jdk 'temurin-jdk21-latest'
21+
//TODO: try to use a Tycho eclipse-run task! and just use the releng-aggr parent as file and only run the eclipserun goal.
22+
// This would also solve the question how to get the eclipse platform product
23+
}
24+
environment {
25+
//TODO: use latest release automatically? How to determine the version?
26+
ECLIPSE_EXE = installLatestReleasedEclipsePlatformProduct()
27+
}
28+
stages {
29+
stage('Check Composites Validity') {
30+
steps {
31+
sh '''
32+
repository="https://download.eclipse.org/${repositoryPath}"
33+
echo "Validate consistency of content at: ${repository}"
34+
${ECLIPSE_EXE} -nosplash -consolelog --launcher.suppressErrors -application org.eclipse.equinox.p2.director -repository "${repository}" -list
35+
'''
36+
}
37+
}
38+
stage('Update composite repository') {
39+
environment {
40+
ANT_TASK_NAME = 'modifyComposite'
41+
OUTPUT_PATH = './output-repository'
42+
}
43+
steps {
44+
script {
45+
//TODO: test this with the empty template repository
46+
//TODO: copy this via SSH to avoid caching issues.
47+
sh "curl -o compositeArtifacts.jar https://download.eclipse.org/${repositoryPath}/compositeArtifacts.jar"
48+
def childenXPathSet = sh(script: '''#!/bin/sh +xe
49+
unzip -p compositeArtifacts.jar compositeArtifacts.xml |\
50+
xmllint - --xpath '/repository/children/child/@location'
51+
exit 0
52+
''', returnStdout: true).trim()
53+
def compositeChildren = 'XPath set is empty' == childenXPathSet ? []
54+
: parseList(childenXPathSet, '\\s+')
55+
.collect{c -> c.startsWith('location="') && c.endsWith('"') ? c.substring(10, c.length() - 1) : null}
56+
.findAll{c -> c != null}
57+
58+
echo "Current children: ${compositeChildren}"
59+
def toAdd = parseList(params.add, ',').unique()
60+
def toRemove = parseList(params.remove, ',').unique()
61+
toRemove = toRemove.findAll{e -> compositeChildren.contains(e)}
62+
63+
if (params.sizeLimit) {
64+
def sizeRestrictionRemovals = compositeChildren.size() + toAdd.size() - toRemove.size() - Integer.parseInt(params.sizeLimit)
65+
if (sizeRestrictionRemovals > 0) {
66+
toRemove += compositeChildren.subList(0, sizeRestrictionRemovals)
67+
}
68+
}
69+
echo "Children added: ${toAdd}"
70+
echo "Children removed: ${toRemove}"
71+
if (compositeChildren.size() + toAdd.size() - toRemove.size() == 0) {
72+
error('All children are removed and composite repository becomes empty.')
73+
}
74+
def modifyComposite_xml = """\
75+
<?xml version="1.0" encoding="UTF-8"?>
76+
<project default="${ANT_TASK_NAME}" basedir=".">
77+
<target name="${ANT_TASK_NAME}">
78+
<p2.composite.repository>
79+
<source location="https://download.eclipse.org/${repositoryPath}" />
80+
<repository location="${OUTPUT_PATH}" />
81+
""".stripIndent() //FIXME: check if the local path works as desired
82+
for (child in toAdd) {
83+
modifyComposite_xml += """ <add><repository location="${child}"/></add>\n"""
84+
}
85+
for (child in toRemove) {
86+
modifyComposite_xml += """ <remove><repository location="${child}"/></remove>\n"""
87+
}
88+
modifyComposite_xml+= '''\
89+
</p2.composite.repository>
90+
</target>
91+
</project>
92+
'''.stripIndent()
93+
writeFile(file: "${ANT_TASK_NAME}.xml", text: modifyComposite_xml)
94+
95+
sh '''
96+
${ECLIPSE_EXE} -nosplash -consolelog --launcher.suppressErrors -debug -data ./eclipse-ws \
97+
-application org.eclipse.ant.core.antRunner -file "${ANT_TASK_NAME}.xml" "${ANT_TASK_NAME}"
98+
'''
99+
sshagent(['projects-storage.eclipse.org-bot-ssh']) {
100+
sh '''
101+
epDownloadsDir='/home/data/httpd/download.eclipse.org'
102+
echo -r "${OUTPUT_PATH}" "[email protected]:${epDownloadsDir}/${repositoryPath}"
103+
#TODO: activate copying
104+
#scp -r "${OUTPUT_PATH}" "[email protected]:${epDownloadsDir}/${repositoryPath}"
105+
'''
106+
}
107+
}
108+
}
109+
}
110+
}
111+
post {
112+
always {
113+
archiveArtifacts allowEmptyArchive: true, artifacts: '**/*', excludes: 'tools/**/*'
114+
}
115+
}
116+
}
117+
118+
@NonCPS
119+
def parseList(String str, String delimiterPattern) {
120+
return str !=null && !str.trim().isEmpty() ? str.trim().split(delimiterPattern).collect{c -> c.trim()} : []
121+
}
122+
123+
def installLatestReleasedEclipsePlatformProduct() {
124+
sh 'curl -o buildproperties.txt https://download.eclipse.org/eclipse/relengScripts/cje-production/buildproperties.txt'
125+
def eclipseURL = sh(script: '''#!/bin/sh +xe
126+
source ./buildproperties.txt
127+
#TODO: Remove this after the next release!
128+
PREVIOUS_RELEASE_ID='I20250630-1800'
129+
PREVIOUS_RELEASE_VER='I20250630-1800'
130+
echo "https://download.eclipse.org/eclipse/downloads/drops4/${PREVIOUS_RELEASE_ID}/eclipse-platform-${PREVIOUS_RELEASE_VER}-linux-gtk-x86_64.tar.gz"
131+
''', returnStdout: true).trim()
132+
return install('eclipse-platform', eclipseURL) + '/eclipse'
133+
}
134+
135+
def install(String toolType, String url) {
136+
dir("${WORKSPACE}/tools/${toolType}") {
137+
sh "curl -L ${url} | tar -xzf -"
138+
return "${pwd()}/" + sh(script: 'ls', returnStdout: true).trim()
139+
}
140+
}

0 commit comments

Comments
 (0)