This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


The following commit(s) were added to refs/heads/main by this push:
     new e55cac2ea4 Add capability to ignore specific example projects in CI 
workflows
e55cac2ea4 is described below

commit e55cac2ea43864c7a5d57142f0eab67e65b28976
Author: James Netherton <[email protected]>
AuthorDate: Mon Nov 25 14:51:10 2024 +0000

    Add capability to ignore specific example projects in CI workflows
---
 tooling/scripts/generate-examples-matrix.groovy | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/tooling/scripts/generate-examples-matrix.groovy 
b/tooling/scripts/generate-examples-matrix.groovy
index ff52c26116..2741ad6d5b 100644
--- a/tooling/scripts/generate-examples-matrix.groovy
+++ b/tooling/scripts/generate-examples-matrix.groovy
@@ -17,9 +17,24 @@
 import groovy.json.JsonOutput;
 import groovy.json.JsonSlurper
 
+import java.nio.file.Files
+import java.nio.file.Paths
+
 final int MAX_GROUPS = 2
 final List<Map<String, String>> GROUPS = new ArrayList<>()
 final String EXAMPLES_BRANCH = System.getProperty('EXAMPLES_BRANCH')
+final String EXAMPLES_IGNORE= System.getProperty('EXAMPLES_IGNORE')
+
+def ignoredExamples = []
+if (EXAMPLES_IGNORE != null) {
+    if (EXAMPLES_IGNORE.contains(",")) {
+        ignoredExamples = EXAMPLES_IGNORE.split(",")
+    } else if (Files.exists(Paths.get(EXAMPLES_IGNORE))) {
+        ignoredExamples = Files.readAllLines(Paths.get(EXAMPLES_IGNORE))
+    } else {
+        ignoredExamples.add(EXAMPLES_IGNORE)
+    }
+}
 
 int groupId = 0
 JsonSlurper jsonSlurper = new JsonSlurper()
@@ -30,6 +45,12 @@ try {
 
     // Distribute example projects across a bounded set of test groups and 
output as JSON
     examples.each { example ->
+        String projectName = 
example.link.substring(example.link.lastIndexOf('/') + 1)
+
+        if (ignoredExamples.contains(projectName)) {
+            return
+        }
+
         if (GROUPS[groupId] == null) {
             GROUPS[groupId] = [:]
             GROUPS[groupId].name = "group-${String.format("%02d", groupId + 
1)}"
@@ -37,8 +58,6 @@ try {
         }
 
         String separator = GROUPS[groupId].examples == "" ? "" : ","
-        String projectName = 
example.link.substring(example.link.lastIndexOf('/') + 1)
-
         GROUPS[groupId].examples = 
"${GROUPS[groupId].examples}${separator}${projectName}"
 
         groupId += 1;

Reply via email to