Skip to content

Commit e1f36dc

Browse files
committed
[Build] Remove old builds from composite p2-repo when adding new ones
Previously the I/Y-builds only added the just built p2-repository to their corresponding composite repository and a separate job, running twice a day, has trimmed down that repositorie's content afterwards to retain only two children. This made the setup's and job configurations more cumbersome and the repository content less predictable. Furthermore the the pruning only removed children that where located directly within the composite's directory and not absolute references to other repositories. This simplifies this task by removing the oldest children while adding the new, just built one, making sure the composite contains at most three children. Permanently fixes - #3123
1 parent 1f26975 commit e1f36dc

File tree

4 files changed

+31
-315
lines changed

4 files changed

+31
-315
lines changed

JenkinsJobs/Cleanup/pruneDailyRepos.groovy

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

cje-production/cleaners/cleanupNightlyRepo.sh

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

cje-production/mbscripts/mb620_promoteUpdateSite.sh

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ fi
2222
source $CJE_ROOT/scripts/common-functions.shsource
2323
source $1
2424

25+
compositeTargetSize=3
2526
epUpdateDir=/home/data/httpd/download.eclipse.org/eclipse/updates
2627
dropsPath=${epUpdateDir}/${STREAMMajor}.${STREAMMinor}-${BUILD_TYPE}-builds
2728
latestRelDir=/home/data/httpd/download.eclipse.org/eclipse/downloads/drops4
@@ -48,7 +49,35 @@ epRelDir=$(ssh [email protected] ls -d --format=single-c
4849
ssh [email protected] tar -C ${workspace} -xzf ${epRelDir}/eclipse-platform-*-linux-gtk-x86_64.tar.gz
4950

5051
#get requisite tools
51-
ssh [email protected] wget -O ${workspace}/addToComposite.xml https://download.eclipse.org/eclipse/relengScripts/cje-production/scripts/addToComposite.xml
52+
# Enhance the addToComposite ANT script to remove the oldest/earliest children to ensure the target-size is not exceeded
53+
scp [email protected]:${dropsPath}/compositeArtifacts.jar compositeArtifacts.jar
54+
#Unzip compositeArtifacts.xml and read the current children from it
55+
currentChildren=$(unzip -p compositeArtifacts.jar compositeArtifacts.xml |\
56+
xmllint - --xpath '/repository/children/child/@location' |\
57+
sed --expression 's|location="||g' --expression 's|"||g')
58+
rm compositeArtifacts.jar
59+
childrenArray=(${currentChildren})
60+
echo "Current children of composite repository: ${childrenArray[@]}"
61+
62+
addToComposite_xml=$(curl https://download.eclipse.org/eclipse/relengScripts/cje-production/scripts/addToComposite.xml)
63+
extraTasksMarker='<!--EXTRA_TASKS-->'
64+
65+
# One more child is about to be added to the composite.
66+
# Remove those children from the beginning of the list if the target-size would be exceeded.
67+
removalCount=$(( ${#childrenArray[@]} + 1 - compositeTargetSize ))
68+
if [ "${removalCount}" -gt 0 ]; then
69+
childrenToRemove="${childrenArray[@]:0:${removalCount}}"
70+
echo "Remove from composite repsitory: ${childrenToRemove}"
71+
extraAntTask=''
72+
for child in ${childrenToRemove}; do
73+
extraAntTask+="<remove><repository location=\\\"${child}\\\"/></remove>\\n "
74+
done
75+
addToComposite_xml=$(cat <<<"${addToComposite_xml}" | sed --expression "s|${extraTasksMarker}|${extraAntTask}|g")
76+
else
77+
echo "Composite p2-repository contains only ${#childrenArray[@]} children and adding one will not exceed its target size of ${compositeTargetSize}: ${dropsPath}"
78+
fi
79+
80+
ssh [email protected] "cat<<<'${addToComposite_xml}' > ${workspace}/addToComposite.xml"
5281

5382
#triggering ant runner
5483
baseBuilderDir=${workspace}/eclipse

cje-production/scripts/addToComposite.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
32
<project
43
default="addToComposite"
54
basedir=".">
@@ -16,7 +15,7 @@
1615
<add>
1716
<repository location="${complocation}" />
1817
</add>
18+
<!--EXTRA_TASKS-->
1919
</p2.composite.repository>
2020
</target>
2121
</project>
22-

0 commit comments

Comments
 (0)