@@ -28,6 +28,7 @@ pipeline {
2828 EP_ROOT = '/home/data/httpd/download.eclipse.org'
2929 EP_ECLIPSE_DROPS = "${EP_ROOT}/eclipse/downloads/drops4"
3030 EP_EQUINOX_DROPS = "${EP_ROOT}/equinox/drops"
31+ EP_ECLIPSE_UPDATES = "${EP_ROOT}/eclipse/updates"
3132
3233 SSH = 'ssh genie.releng@projects-storage.eclipse.org'
3334 }
@@ -59,17 +60,14 @@ pipeline {
5960 }
6061 }
6162 }
62- stage('Eclipse I-builds ') {
63+ stage('Eclipse') {
6364 steps {
6465 sshagent (['projects-storage.eclipse.org-bot-ssh']) {
66+ // I-builds
6567 removeOldBuildDropsOfCurrentStream("${EP_ECLIPSE_DROPS}", 'I', ECLIPSE_I_BUILD_RETENTION_DAYS, ECLIPSE_I_BUILD_RETENTION_COUNT)
66- }
67- }
68- }
69- stage('Eclipse Y-builds') {
70- steps {
71- sshagent (['projects-storage.eclipse.org-bot-ssh']) {
68+ // Y-builds
7269 removeSurplusBuildDrops("${EP_ECLIPSE_DROPS}", 'Y', ECLIPSE_Y_BUILD_RETENTION_COUNT)
70+ removeSurplusDirectories("${EP_ECLIPSE_UPDATES}/${devVersionMajor}.${devVersionMinor}-Y-builds", 'Y*', ECLIPSE_Y_BUILD_RETENTION_COUNT)
7371 }
7472 }
7573 }
@@ -94,10 +92,19 @@ def int devVersionService = null
9492
9593def removeSurplusBuildDrops(String remoteDirectory, String buildType, int retentionCount) {
9694 def drops = utilities.listBuildDropDirectoriesOnRemote(remoteDirectory, "${buildType}*") // sorted in ascending order
97- if (retentionCount < drops.size()) {
98- utilities.removeDropsOnRemote(remoteDirectory, drops.subList(0, drops.size() - retentionCount))
95+ removeSurplusLeadingDirectories(drops, remoteDirectory, "${buildType}*", retentionCount)
96+ }
97+
98+ def removeSurplusDirectories(String remoteDirectory, String dirNamePattern, int retentionCount) {
99+ def directories = utilities.listDirectoriesOnRemote(remoteDirectory, dirNamePattern) // sorted in ascending order
100+ removeSurplusLeadingDirectories(directories, remoteDirectory, dirNamePattern, retentionCount)
101+ }
102+
103+ def removeSurplusLeadingDirectories(List<String> directories, String remoteDirectory, String dirNamePattern, int retentionCount) {
104+ if (directories.size() > retentionCount) {
105+ utilities.removeDropsOnRemote(remoteDirectory, directories.subList(0, directories.size() - retentionCount))
99106 } else {
100- echo "Nothing to clean in ${remoteDirectory} with pattern '${buildType}* '. Found only ${drops }, not exceeding the threshold of ${retentionCount}."
107+ echo "Nothing to clean in ${remoteDirectory} with pattern '${dirNamePattern} '. Found only ${directories }, not exceeding the threshold of ${retentionCount}."
101108 }
102109}
103110
@@ -106,7 +113,7 @@ def removeOldBuildDropsOfCurrentStream(String remoteDirectory, String buildType,
106113 // But keep at least the minimal retention count of builds regardless of their age and all of those younger than the minimal retention time.
107114 def retentionThresholdDate = java.time.LocalDate.now().minusDays(retentionDays)
108115 def allBuilds = utilities.listBuildDropDirectoriesOnRemote(remoteDirectory, "${buildType}*",
109- devVersionMajor, devVersionMinor, devVersionService).sort() // sort ascending to start with Mondays
116+ devVersionMajor, devVersionMinor, devVersionService) // sorted in ascending order -> starts with Mondays
110117 echo "Number of ${buildType}-builds before cleaning: ${allBuilds.size()}"
111118 def oldBuilds = allBuilds.findAll{ b -> parseDate(b) < retentionThresholdDate} // sorted ascendingly to start with Mondays
112119 // Keep the specified count of latest builds
0 commit comments