@@ -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 }
@@ -58,17 +59,14 @@ pipeline {
5859 }
5960 }
6061 }
61- stage('Eclipse I-builds ') {
62+ stage('Eclipse') {
6263 steps {
6364 sshagent (['projects-storage.eclipse.org-bot-ssh']) {
65+ // I-builds
6466 removeOldBuildDropsOfCurrentStream("${EP_ECLIPSE_DROPS}", 'I', ECLIPSE_I_BUILD_RETENTION_DAYS, ECLIPSE_I_BUILD_RETENTION_COUNT)
65- }
66- }
67- }
68- stage('Eclipse Y-builds') {
69- steps {
70- sshagent (['projects-storage.eclipse.org-bot-ssh']) {
67+ // Y-builds
7168 removeSurplusBuildDrops("${EP_ECLIPSE_DROPS}", 'Y', ECLIPSE_Y_BUILD_RETENTION_COUNT)
69+ removeSurplusDirectories("${EP_ECLIPSE_UPDATES}/${devVersionMajor}.${devVersionMinor}-Y-builds", 'Y*', ECLIPSE_Y_BUILD_RETENTION_COUNT)
7270 }
7371 }
7472 }
@@ -93,10 +91,19 @@ def int devVersionService = null
9391
9492def removeSurplusBuildDrops(String remoteDirectory, String buildType, int retentionCount) {
9593 def drops = utilities.listBuildDropDirectoriesOnRemote(remoteDirectory, "${buildType}*") // sorted in ascending order
96- if (retentionCount < drops.size()) {
97- utilities.removeDropsOnRemote(remoteDirectory, drops.subList(0, drops.size() - retentionCount))
94+ removeSurplusLeadingDirectories(drops, remoteDirectory, "${buildType}*", retentionCount)
95+ }
96+
97+ def removeSurplusDirectories(String remoteDirectory, String dirNamePattern, int retentionCount) {
98+ def directories = utilities.listDirectoriesOnRemote(remoteDirectory, dirNamePattern) // sorted in ascending order
99+ removeSurplusLeadingDirectories(directories, remoteDirectory, dirNamePattern, retentionCount)
100+ }
101+
102+ def removeSurplusLeadingDirectories(List<String> directories, String remoteDirectory, String dirNamePattern, int retentionCount) {
103+ if (directories.size() > retentionCount) {
104+ utilities.removeDropsOnRemote(remoteDirectory, directories.subList(0, directories.size() - retentionCount))
98105 } else {
99- echo "Nothing to clean in ${remoteDirectory} with pattern '${buildType}* '. Found only ${drops }, not exceeding the threshold of ${retentionCount}."
106+ echo "Nothing to clean in ${remoteDirectory} with pattern '${dirNamePattern} '. Found only ${directories }, not exceeding the threshold of ${retentionCount}."
100107 }
101108}
102109
@@ -105,7 +112,7 @@ def removeOldBuildDropsOfCurrentStream(String remoteDirectory, String buildType,
105112 // But keep at least the minimal retention count of builds regardless of their age and all of those younger than the minimal retention time.
106113 def retentionThresholdDate = java.time.LocalDate.now().minusDays(retentionDays)
107114 def allBuilds = utilities.listBuildDropDirectoriesOnRemote(remoteDirectory, "${buildType}*",
108- devVersionMajor, devVersionMinor, devVersionService).sort() // sort ascending to start with Mondays
115+ devVersionMajor, devVersionMinor, devVersionService) // sorted in ascending order -> starts with Mondays
109116 echo "Number of ${buildType}-builds before cleaning: ${allBuilds.size()}"
110117 def oldBuilds = allBuilds.findAll{ b -> parseDate(b) < retentionThresholdDate} // sorted ascendingly to start with Mondays
111118 // Keep the specified count of latest builds
0 commit comments