jjb: lttng-modules: Add upstream lts filtering
authorMichael Jeanson <mjeanson@efficios.com>
Fri, 29 Jan 2021 16:15:39 +0000 (11:15 -0500)
committerMichael Jeanson <mjeanson@efficios.com>
Fri, 29 Jan 2021 16:15:39 +0000 (11:15 -0500)
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
scripts/lttng-modules/master.groovy

index ca8443835df1199cb7f18b42c8e77eaef9e8c6f7..18e0a9fd7e38d1c63916f978949dccc7b55ec440 100644 (file)
@@ -416,6 +416,7 @@ for (ref in refs) {
   }
 }
 
+// The filtering step assumes the version lists are sorted
 kversions.sort()
 kversionsRC.sort()
 
@@ -437,6 +438,45 @@ switch (kverfilter) {
     }
     break
 
+  case 'lts':
+    // Keep only the head of each LTS branch and the latest non-RC tag
+    println('Filter kernel versions to keep only the latest point release of each lts branch and the current stable.')
+
+    def lts_44 = kversionFactory.factory("v4.4")
+    def lts_49 = kversionFactory.factory("v4.9")
+    def lts_414 = kversionFactory.factory("v4.14")
+    def lts_419 = kversionFactory.factory("v4.19")
+    def lts_54 = kversionFactory.factory("v5.4")
+
+    // First filter the head of each branch
+    for (i = 0; i < kversions.size(); i++) {
+      def curr = kversions[i]
+      def next = i < kversions.size() - 1 ? kversions[i + 1] : null
+
+      if (next != null) {
+        if (curr.isSameStable(next)) {
+          kversions.remove(i)
+          i--
+        }
+      }
+    }
+
+    for (i = 0; i < kversions.size(); i++) {
+      def curr = kversions[i]
+
+      // Keep the newest tag
+      if (i == kversions.size() - 1) {
+        break
+      }
+
+      // Prune non-LTS versions
+      if (!(curr.isSameStable(lts_44) || curr.isSameStable(lts_49) || curr.isSameStable(lts_414) || curr.isSameStable(lts_419) || curr.isSameStable(lts_54))) {
+        kversions.remove(i)
+        i--
+      }
+    }
+    break
+
   default:
     // No filtering of kernel versions
     println('No kernel versions filtering selected.')
This page took 0.025134 seconds and 4 git commands to generate.