Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-456 c82aa443d -> 352d9fa3c


# ignite-456: test builds auto detection


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/352d9fa3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/352d9fa3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/352d9fa3

Branch: refs/heads/ignite-456
Commit: 352d9fa3c7ce5bc306af181b007cb1dc0341aafd
Parents: c82aa44
Author: null <null>
Authored: Wed May 20 18:31:17 2015 +0300
Committer: null <null>
Committed: Wed May 20 18:31:17 2015 +0300

----------------------------------------------------------------------
 dev-tools/src/main/groovy/jiraslurp.groovy | 60 +++++++++++++++++--------
 1 file changed, 42 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/352d9fa3/dev-tools/src/main/groovy/jiraslurp.groovy
----------------------------------------------------------------------
diff --git a/dev-tools/src/main/groovy/jiraslurp.groovy 
b/dev-tools/src/main/groovy/jiraslurp.groovy
index 2d434e5..376034f 100644
--- a/dev-tools/src/main/groovy/jiraslurp.groovy
+++ b/dev-tools/src/main/groovy/jiraslurp.groovy
@@ -179,9 +179,41 @@ def JIRA_xml = { jiranum ->
 }
 
 /**
+ * Gets all builds from TC project.
+ */
+def getTestBuilds = { ->
+    def projName = System.getenv('PROJECT_NAME')
+
+    if (projName == null || projName == 'null')
+        projName = "Ignite"
+
+    def tcURL = System.getenv('TC_URL')
+    def excludeListProp = System.getenv('BUILD_ID_EXCLUDES')
+    def excludeList = excludeListProp?.split(' ') as List
+
+    if (excludeList == null || excludeList == 'null')
+        excludeList = ["Ignite_RunAllTestBuilds"]
+
+    def project = new 
XmlSlurper().parse("http://$tcURL:80/guestAuth/app/rest/projects/id:$projName";)
+
+    def buildIds = []
+
+    def count = Integer.valueOf(project.buildTypes.@count as String)
+
+    for (int i = 0; i < count; i++) {
+        def id = project.buildTypes.buildType[i].@id
+
+        if (excludeList == null || !excludeList.contains(id))
+            buildIds.add(id)
+    }
+
+    buildIds
+}
+
+/**
  * Runs all given test builds to validate last patch from given jira.
  */
-def runAllTestBuilds = { builds, jiraNum ->
+def runAllTestBuilds = {builds, jiraNum ->
     def tcURL = System.getenv('TC_URL')
     def user = System.getenv('TASK_RUNNER_USER')
     def pwd = System.getenv('TASK_RUNNER_PWD')
@@ -264,24 +296,20 @@ args.each {
     println parameters
 
     if (parameters.length >= 1 && parameters[0] == "slurp") {
-        if (parameters.length < 2 || parameters[1] == 'null') {
-            println "There is no builds to run. Exit."
-
-            return
-        }
+        println "Running in 'slurp' mode."
 
-        def builds = parameters[1].split(' ');
+        checkForAttachments()
 
-        println "Running in 'slurp' mode. Test builds=${builds}"
+        def builds = getTestBuilds()
 
-        checkForAttachments()
+        println "Test builds to be triggered=$builds"
 
         // For each ticket with new attachment, let's trigger remove build
         jirasAttached.each { k, v ->
             //  Trailing slash is important for download; only need to pass 
JIRA number
             println "Triggering the test builds for: $k = $ATTACHMENT_URL/$v/"
 
-            runAllTestBuilds(builds,k)
+            runAllTestBuilds(builds, k)
         }
     }
     else if (parameters.length > 1 && parameters[0] == "patchApply") {
@@ -311,17 +339,13 @@ args.each {
         }
     }
     else if (parameters.length > 1 && parameters[0] == "runAllBuilds" ) {
-        if (parameters.length < 2 || parameters[1] == 'null') {
-            println "There is no builds to run. Exit."
-
-            return
-        }
+        def jiraNum = parameters[1]
 
-        def builds = parameters[1].split(' ');
+        println "Running in 'all builds' mode with jira number='$jiraNum'."
 
-        def jiraNum = parameters[2]
+        def builds = getTestBuilds()
 
-        println "Running in 'all builds' mode for builds=$builds with jira 
number='$jiraNum'."
+        println "Test builds to be triggered=$builds"
 
         runAllTestBuilds(builds, jiraNum)
     }

Reply via email to