Introduce a more sustainable way to add new SDKs.

Signed-off-by: Jason Kuster <jasonkus...@google.com>


Project: http://git-wip-us.apache.org/repos/asf/beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/9625de53
Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/9625de53
Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/9625de53

Branch: refs/heads/master
Commit: 9625de53ee1806f9dce8a896c14132066ee51d41
Parents: 5cdae88
Author: Jason Kuster <jasonkus...@google.com>
Authored: Thu Sep 28 18:17:07 2017 -0700
Committer: Jason Kuster <jasonkus...@google.com>
Committed: Thu Sep 28 18:17:07 2017 -0700

----------------------------------------------------------------------
 .test-infra/jenkins/PreCommit_Pipeline.groovy   | 31 +++++++++++++-------
 .../jenkins/job_beam_PreCommit_Pipeline.groovy  |  2 +-
 2 files changed, 22 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/beam/blob/9625de53/.test-infra/jenkins/PreCommit_Pipeline.groovy
----------------------------------------------------------------------
diff --git a/.test-infra/jenkins/PreCommit_Pipeline.groovy 
b/.test-infra/jenkins/PreCommit_Pipeline.groovy
index 85af172..0f104d9 100644
--- a/.test-infra/jenkins/PreCommit_Pipeline.groovy
+++ b/.test-infra/jenkins/PreCommit_Pipeline.groovy
@@ -36,16 +36,27 @@ List<Object> commitArg = [string(name: 'sha1', value: 
"origin/pr/${ghprbPullId}/
 
 int javaBuildNum = NO_BUILD
 
-boolean testJava = true
-boolean testPython = true
+final String JAVA_BUILD_TYPE = "java"
+final String PYTHON_BUILD_TYPE = "python"
+final String ALL_BUILD_TYPE = "all"
 
+def buildTypes = [
+        JAVA_BUILD_TYPE,
+        PYTHON_BUILD_TYPE,
+        ALL_BUILD_TYPE,
+]
+
+String currentBuildType = allBuildType
 String commentLower = ghprbCommentBody.toLowerCase()
 
+// Currently if there is nothing selected (e.g. the comment is just "retest 
this please") we select "all" by default.
+// In the future we should provide some mechanism, either via commenting or 
the suite failure message, to enforce
+// selection of one of the build types.
 if (!commentLower.isEmpty()) {
-    if (commentLower.endsWith('python only')) {
-        testJava = false
-    } else if (commentLower.endsWith('java only')) {
-        testPython = false
+    commentSplit = commentLower.split(' ')
+    buildType = commentSplit[commentSplit.length-1]
+    if (buildTypes.contains(buildType)) {
+        currentBuildType = buildType
     }
 }
 
@@ -56,24 +67,24 @@ if (!commentLower.isEmpty()) {
 stage('Build') {
     parallel (
         java: {
-            if (testJava) {
+            if (currentBuildType == javaBuildType || currentBuildType == 
allBuildType) {
                 def javaBuild = build job: 'beam_Java_Build', parameters: 
commitArg + ghprbArgs
                 if (javaBuild.getResult() == Result.SUCCESS.toString()) {
                     javaBuildNum = javaBuild.getNumber()
                 }
             } else {
-                echo 'Skipping Java due to comment ending in "python only": ' 
+ ghprbCommentBody
+                echo 'Skipping Java due to comment selecting non-Java 
execution: ' + ghprbCommentBody
             }
         },
         python_unit: { // Python doesn't have a build phase, so we include 
this here.
-            if (testPython) {
+            if (currentBuildType == pythonBuildType || currentBuildType == 
allBuildType) {
                 try {
                     build job: 'beam_Python_UnitTest', parameters: commitArg + 
ghprbArgs
                 } catch (Exception e) {
                     echo 'Python build failed: ' + e.toString()
                 }
             } else {
-                echo 'Skipping Python due to comment ending in "java only": ' 
+ ghprbCommentBody
+                echo 'Skipping Python due to comment selecting non-Python 
execution: ' + ghprbCommentBody
             }
         }
     )

http://git-wip-us.apache.org/repos/asf/beam/blob/9625de53/.test-infra/jenkins/job_beam_PreCommit_Pipeline.groovy
----------------------------------------------------------------------
diff --git a/.test-infra/jenkins/job_beam_PreCommit_Pipeline.groovy 
b/.test-infra/jenkins/job_beam_PreCommit_Pipeline.groovy
index 3e7c8c9..dadc10c 100644
--- a/.test-infra/jenkins/job_beam_PreCommit_Pipeline.groovy
+++ b/.test-infra/jenkins/job_beam_PreCommit_Pipeline.groovy
@@ -58,7 +58,7 @@ pipelineJob('beam_PreCommit_Pipeline') {
       allowMembersOfWhitelistedOrgsAsAdmin()
       permitAll()
       // Remove once Pipeline Build is default.
-      triggerPhrase('^Run PreCommit Pipeline (((Python|Java) Only)|All)$')
+      triggerPhrase('^Run PreCommit Pipeline (((Python|Java))|All)$')
       onlyTriggerPhrase()
       displayBuildErrorsOnDownstreamBuilds()
       extensions {

Reply via email to