Bring common_job_properties closer to Groovy style

Fix "RunnableOnService" typo

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/3c22a842
Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/3c22a842
Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/3c22a842

Branch: refs/heads/master
Commit: 3c22a842071f9644175449b268dffbbccadc7b99
Parents: 9151676
Author: Jason Kuster <jasonkus...@google.com>
Authored: Thu Feb 16 10:32:01 2017 -0800
Committer: Thomas Groh <tg...@google.com>
Committed: Thu Feb 16 18:26:14 2017 -0800

----------------------------------------------------------------------
 .jenkins/common_job_properties.groovy           | 74 ++++++++++----------
 ...ostCommit_Java_RunnableOnService_Apex.groovy |  2 +-
 ...ommit_Java_RunnableOnService_Dataflow.groovy |  2 +-
 ...stCommit_Java_RunnableOnService_Flink.groovy |  2 +-
 ...ommit_Java_RunnableOnService_Gearpump.groovy |  2 +-
 ...stCommit_Java_RunnableOnService_Spark.groovy |  2 +-
 6 files changed, 43 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/beam/blob/3c22a842/.jenkins/common_job_properties.groovy
----------------------------------------------------------------------
diff --git a/.jenkins/common_job_properties.groovy 
b/.jenkins/common_job_properties.groovy
index 3c77aab..19cf471 100644
--- a/.jenkins/common_job_properties.groovy
+++ b/.jenkins/common_job_properties.groovy
@@ -18,29 +18,31 @@
 
 // Contains functions that help build Jenkins projects. Functions typically set
 // common properties that are shared among all Jenkins projects.
+// Code in this directory should conform to the Groovy style guide.
+//  http://groovy-lang.org/style-guide.html
 class common_job_properties {
 
   // Sets common top-level job properties for website repository jobs.
-  static def setTopLevelWebsiteJobProperties(def context) {
+  static void setTopLevelWebsiteJobProperties(context) {
     setTopLevelJobProperties(context, 'beam-site', 'asf-site', 30)
   }
 
   // Sets common top-level job properties for main repository jobs.
-  static def setTopLevelMainJobProperties(def context,
-                                          def default_branch = 'master') {
-    setTopLevelJobProperties(context, 'beam', default_branch, 100)
+  static void setTopLevelMainJobProperties(context,
+                                           String defaultBranch = 'master') {
+    setTopLevelJobProperties(context, 'beam', defaultBranch, 100)
   }
 
-  // Sets common top-level job properties. Should be accessed through one of 
the
-  // above methods to protect jobs from internal details of param defaults.
-  private static def setTopLevelJobProperties(def context,
-                                              def repository_name,
-                                              def default_branch,
-                                              def default_timeout) {
+  // Sets common top-level job properties. Accessed through one of the above
+  // methods to protect jobs from internal details of param defaults.
+  private static void setTopLevelJobProperties(context,
+                                               String repositoryName,
+                                               String defaultBranch,
+                                               int defaultTimeout) {
 
     // GitHub project.
     context.properties {
-      githubProjectUrl('https://github.com/apache/' + repository_name + '/')
+      githubProjectUrl('https://github.com/apache/' + repositoryName + '/')
     }
 
     // Set JDK version.
@@ -59,7 +61,7 @@ class common_job_properties {
     context.scm {
       git {
         remote {
-          url('https://github.com/apache/' + repository_name + '.git')
+          url('https://github.com/apache/' + repositoryName + '.git')
           refspec('+refs/heads/*:refs/remotes/origin/* ' +
                   '+refs/pull/*:refs/remotes/origin/pr/*')
         }
@@ -75,14 +77,14 @@ class common_job_properties {
       // ${sha1} parameter needs to be provided, and defaults to the main 
branch.
       stringParam(
           'sha1',
-          default_branch,
+          defaultBranch,
           'Commit id or refname (eg: origin/pr/9/head) you want to build.')
     }
 
     context.wrappers {
       // Abort the build if it's stuck for more minutes than specified.
       timeout {
-        absolute(default_timeout)
+        absolute(defaultTimeout)
         abortBuild()
       }
 
@@ -98,10 +100,10 @@ class common_job_properties {
 
   // Sets the pull request build trigger. Accessed through precommit methods
   // below to insulate callers from internal parameter defaults.
-  private static def setPullRequestBuildTrigger(def context,
-                                                def commitStatusContext,
-                                                def successComment = 
'--none--',
-                                                def trigger_phrase = '') {
+  private static void setPullRequestBuildTrigger(context,
+                                                 String commitStatusContext,
+                                                 String successComment = 
'--none--',
+                                                 String prTriggerPhrase = '') {
     context.triggers {
       githubPullRequest {
         admins(['asfbot'])
@@ -109,13 +111,13 @@ class common_job_properties {
         orgWhitelist(['apache'])
         allowMembersOfWhitelistedOrgsAsAdmin()
         permitAll()
-        // trigger_phrase is the argument which gets set when we want to allow
+        // prTriggerPhrase is the argument which gets set when we want to allow
         // post-commit builds to run against pending pull requests. This block
         // overrides the default trigger phrase with the new one. Setting this
         // will disable automatic invocation of this build; the phrase will be
         // required to start it.
-        if (trigger_phrase != '') {
-          triggerPhrase(trigger_phrase)
+        if (prTriggerPhrase) {
+          triggerPhrase(prTriggerPhrase)
           onlyTriggerPhrase()
         }
 
@@ -160,7 +162,7 @@ class common_job_properties {
   }
 
   // Sets common config for Maven jobs.
-  static def setMavenConfig(def context) {
+  static void setMavenConfig(context) {
     context.mavenInstallation('Maven 3.3.3')
     context.mavenOpts('-Dorg.slf4j.simpleLogger.showDateTime=true')
     
context.mavenOpts('-Dorg.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd\\\'T\\\'HH:mm:ss.SSS')
@@ -174,9 +176,9 @@ class common_job_properties {
   }
 
   // Sets common config for PreCommit jobs.
-  static def setPreCommit(def context,
-                          def commitStatusName,
-                          def successComment = '--none--') {
+  static void setPreCommit(context,
+                           String commitStatusName,
+                           String successComment = '--none--') {
     // Set pull request build trigger.
     setPullRequestBuildTrigger(context, commitStatusName, successComment)
   }
@@ -184,33 +186,33 @@ class common_job_properties {
   // Enable triggering postcommit runs against pull requests. Users can 
comment the trigger phrase
   // specified in the postcommit job and have the job run against their PR to 
run
   // tests not in the presubmit suite for additional confidence.
-  static def enablePhraseTriggeringFromPullRequest(def context,
-                                         def commitStatusName,
-                                         def trigger_phrase) {
+  static void enablePhraseTriggeringFromPullRequest(context,
+                                                    String commitStatusName,
+                                                    String prTriggerPhrase) {
     setPullRequestBuildTrigger(
       context,
       commitStatusName,
       '--none--',
-      trigger_phrase)
+      prTriggerPhrase)
   }
 
   // Sets common config for PostCommit jobs.
-  static def setPostCommit(def context,
-                           def build_schedule = '0 */6 * * *',
-                           def trigger_every_push = true,
-                           def notify_address = 'commits@beam.apache.org') {
+  static void setPostCommit(context,
+                            String buildSchedule = '0 */6 * * *',
+                            boolean triggerEveryPush = true,
+                            String notifyAddress = 'commits@beam.apache.org') {
     // Set build triggers
     context.triggers {
       // By default runs every 6 hours.
-      cron(build_schedule)
-      if (trigger_every_push) {
+      cron(buildSchedule)
+      if (triggerEveryPush) {
         githubPush()
       }
     }
 
     context.publishers {
       // Notify an email address for each failed build (defaults to commits@).
-      mailer(notify_address, false, true)
+      mailer(notifyAddress, false, true)
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/beam/blob/3c22a842/.jenkins/job_beam_PostCommit_Java_RunnableOnService_Apex.groovy
----------------------------------------------------------------------
diff --git a/.jenkins/job_beam_PostCommit_Java_RunnableOnService_Apex.groovy 
b/.jenkins/job_beam_PostCommit_Java_RunnableOnService_Apex.groovy
index b2bed00..b03e34e 100644
--- a/.jenkins/job_beam_PostCommit_Java_RunnableOnService_Apex.groovy
+++ b/.jenkins/job_beam_PostCommit_Java_RunnableOnService_Apex.groovy
@@ -35,7 +35,7 @@ mavenJob('beam_PostCommit_Java_RunnableOnService_Apex') {
   common_job_properties.enablePhraseTriggeringFromPullRequest(
     delegate,
     'Apache Apex Runner RunnableOnService Tests',
-    'Run Apex RunableOnService')
+    'Run Apex RunnableOnService')
 
   // Maven goals for this job.
   goals('''clean verify --projects runners/apex \

http://git-wip-us.apache.org/repos/asf/beam/blob/3c22a842/.jenkins/job_beam_PostCommit_Java_RunnableOnService_Dataflow.groovy
----------------------------------------------------------------------
diff --git 
a/.jenkins/job_beam_PostCommit_Java_RunnableOnService_Dataflow.groovy 
b/.jenkins/job_beam_PostCommit_Java_RunnableOnService_Dataflow.groovy
index c5336f1..a3b8150 100644
--- a/.jenkins/job_beam_PostCommit_Java_RunnableOnService_Dataflow.groovy
+++ b/.jenkins/job_beam_PostCommit_Java_RunnableOnService_Dataflow.groovy
@@ -38,7 +38,7 @@ mavenJob('beam_PostCommit_Java_RunnableOnService_Dataflow') {
   common_job_properties.enablePhraseTriggeringFromPullRequest(
     delegate,
     'Google Cloud Dataflow Runner RunnableOnService Tests',
-    'Run Dataflow RunableOnService')
+    'Run Dataflow RunnableOnService')
 
   // Maven goals for this job.
   goals('-B -e clean verify -am -pl runners/google-cloud-dataflow-java 
-DforkCount=0 -DrunnableOnServicePipelineOptions=\'[ 
"--runner=org.apache.beam.runners.dataflow.testing.TestDataflowRunner", 
"--project=apache-beam-testing", 
"--tempRoot=gs://temp-storage-for-runnable-on-service-tests/" ]\'')

http://git-wip-us.apache.org/repos/asf/beam/blob/3c22a842/.jenkins/job_beam_PostCommit_Java_RunnableOnService_Flink.groovy
----------------------------------------------------------------------
diff --git a/.jenkins/job_beam_PostCommit_Java_RunnableOnService_Flink.groovy 
b/.jenkins/job_beam_PostCommit_Java_RunnableOnService_Flink.groovy
index d0062ed..9dd0fa3 100644
--- a/.jenkins/job_beam_PostCommit_Java_RunnableOnService_Flink.groovy
+++ b/.jenkins/job_beam_PostCommit_Java_RunnableOnService_Flink.groovy
@@ -37,7 +37,7 @@ mavenJob('beam_PostCommit_Java_RunnableOnService_Flink') {
   common_job_properties.enablePhraseTriggeringFromPullRequest(
     delegate,
     'Apache Flink Runner RunnableOnService Tests',
-    'Run Flink RunableOnService')
+    'Run Flink RunnableOnService')
 
   // Maven goals for this job.
   goals('-B -e clean verify -am -pl runners/flink/runner 
-Plocal-runnable-on-service-tests -Prunnable-on-service-tests')

http://git-wip-us.apache.org/repos/asf/beam/blob/3c22a842/.jenkins/job_beam_PostCommit_Java_RunnableOnService_Gearpump.groovy
----------------------------------------------------------------------
diff --git 
a/.jenkins/job_beam_PostCommit_Java_RunnableOnService_Gearpump.groovy 
b/.jenkins/job_beam_PostCommit_Java_RunnableOnService_Gearpump.groovy
index 17f6476..8f41c3e 100644
--- a/.jenkins/job_beam_PostCommit_Java_RunnableOnService_Gearpump.groovy
+++ b/.jenkins/job_beam_PostCommit_Java_RunnableOnService_Gearpump.groovy
@@ -42,7 +42,7 @@ mavenJob('beam_PostCommit_Java_RunnableOnService_Gearpump') {
   common_job_properties.enablePhraseTriggeringFromPullRequest(
     delegate,
     'Apache Gearpump Runner RunnableOnService Tests',
-    'Run Gearpump RunableOnService')
+    'Run Gearpump RunnableOnService')
 
   // Maven goals for this job.
   goals('-B -e clean verify -am -pl runners/gearpump -DforkCount=0 
-DrunnableOnServicePipelineOptions=\'[ "--runner=TestGearpumpRunner", 
"--streaming=false" ]\'')

http://git-wip-us.apache.org/repos/asf/beam/blob/3c22a842/.jenkins/job_beam_PostCommit_Java_RunnableOnService_Spark.groovy
----------------------------------------------------------------------
diff --git a/.jenkins/job_beam_PostCommit_Java_RunnableOnService_Spark.groovy 
b/.jenkins/job_beam_PostCommit_Java_RunnableOnService_Spark.groovy
index f58457f..6927902 100644
--- a/.jenkins/job_beam_PostCommit_Java_RunnableOnService_Spark.groovy
+++ b/.jenkins/job_beam_PostCommit_Java_RunnableOnService_Spark.groovy
@@ -37,7 +37,7 @@ mavenJob('beam_PostCommit_Java_RunnableOnService_Spark') {
   common_job_properties.enablePhraseTriggeringFromPullRequest(
     delegate,
     'Apache Spark Runner RunnableOnService Tests',
-    'Run Spark RunableOnService')
+    'Run Spark RunnableOnService')
 
   // Maven goals for this job.
   goals('-B -e clean verify -am -pl runners/spark -Prunnable-on-service-tests 
-Plocal-runnable-on-service-tests -Dspark.port.maxRetries=64 
-Dspark.ui.enabled=false')

Reply via email to