[ 
https://issues.apache.org/jira/browse/BEAM-4014?focusedWorklogId=89005&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-89005
 ]

ASF GitHub Bot logged work on BEAM-4014:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 09/Apr/18 16:34
            Start Date: 09/Apr/18 16:34
    Worklog Time Spent: 10m 
      Work Description: lukecwik closed pull request #5047: [BEAM-4014] Replace 
the Java maven based PostCommit with a Gradle based version.
URL: https://github.com/apache/beam/pull/5047
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/.test-infra/jenkins/job_beam_PostCommit_Java_MavenInstall.groovy 
b/.test-infra/jenkins/job_beam_PostCommit_Java_GradleBuild.groovy
similarity index 55%
rename from .test-infra/jenkins/job_beam_PostCommit_Java_MavenInstall.groovy
rename to .test-infra/jenkins/job_beam_PostCommit_Java_GradleBuild.groovy
index 0dda772a230..ba0da5dab44 100644
--- a/.test-infra/jenkins/job_beam_PostCommit_Java_MavenInstall.groovy
+++ b/.test-infra/jenkins/job_beam_PostCommit_Java_GradleBuild.groovy
@@ -20,10 +20,10 @@ import common_job_properties
 
 // This job runs the Java postcommit tests, including the suite of integration
 // tests.
-mavenJob('beam_PostCommit_Java_MavenInstall') {
-  description('Runs postcommit tests on the Java SDK.')
-
+job('beam_PostCommit_Java_GradleBuild') {
+  description('Runs PostCommit tests on the Java SDK.')
   previousNames('beam_PostCommit_MavenVerify')
+  previousNames('beam_PostCommit_Java_MavenInstall')
 
   // Execute concurrent builds if necessary.
   concurrentBuild()
@@ -31,35 +31,39 @@ mavenJob('beam_PostCommit_Java_MavenInstall') {
   // Set common parameters.
   common_job_properties.setTopLevelMainJobProperties(delegate, 'master', 240)
 
-  // Set maven parameters.
-  common_job_properties.setMavenConfig(delegate)
+  def gradle_switches = [
+    // Gradle log verbosity enough to diagnose basic build issues
+    "--info",
+    // Continue the build even if there is a failure to show as many potential 
failures as possible.
+    '--continue',
+    // Until we verify the build cache is working appropriately, force 
rerunning all tasks
+    '--rerun-tasks',
+    // Specify maven home on Jenkins, needed by Maven archetype integration 
tests.
+    '-Pmaven_home=/home/jenkins/tools/maven/apache-maven-3.5.2'
+  ]
+
+  // Publish all test results to Jenkins
+  publishers {
+    archiveJunit('**/build/test-results/**/*.xml')
+  }
 
   // Sets that this is a PostCommit job.
   common_job_properties.setPostCommit(delegate)
 
   // Allows triggering this build against pull requests.
   common_job_properties.enablePhraseTriggeringFromPullRequest(
-          delegate,
-          'Java SDK Post Commit Tests',
-          'Run Java PostCommit')
+      delegate,
+      'Java SDK Post Commit Tests',
+      'Run Java PostCommit')
 
-  // Maven goals for this job.
-  goals([
-      'clean',
-      'install',
-      '--projects sdks/java/core,runners/direct-java,sdks/java/fn-execution',
-      ' --also-make',
-      '--also-make-dependents',
-      '--batch-mode',
-      '--errors',
-      '--fail-at-end',
-      '-P release,dataflow-runner',
-      '-DrepoToken=$COVERALLS_REPO_TOKEN',
-      '-D skipITs=false',
-      '''-D integrationTestPipelineOptions=\'[ \
-          "--project=apache-beam-testing", \
-          "--tempRoot=gs://temp-storage-for-end-to-end-tests", \
-          "--runner=TestDataflowRunner" \
-        ]\' '''
-  ].join(' '))
+  // Gradle goals for this job.
+  steps {
+    gradle {
+      rootBuildScriptDir(common_job_properties.checkoutDir)
+      tasks(':javaPostCommit')
+      for (String gradle_switch : gradle_switches) {
+        switches(gradle_switch)
+      }
+    }
+  }
 }
diff --git a/.test-infra/jenkins/job_beam_PreCommit_Java_GradleBuild.groovy 
b/.test-infra/jenkins/job_beam_PreCommit_Java_GradleBuild.groovy
index fe3e1ac76c6..66216708546 100644
--- a/.test-infra/jenkins/job_beam_PreCommit_Java_GradleBuild.groovy
+++ b/.test-infra/jenkins/job_beam_PreCommit_Java_GradleBuild.groovy
@@ -44,7 +44,7 @@ job('beam_PreCommit_Java_GradleBuild') {
     '--continue',
     // Until we verify the build cache is working appropriately, force 
rerunning all tasks
     '--rerun-tasks',
-    // Specify maven home on Jenkins
+    // Specify maven home on Jenkins, needed by Maven archetype integration 
tests.
     '-Pmaven_home=/home/jenkins/tools/maven/apache-maven-3.5.2'
   ]
 
diff --git a/build.gradle b/build.gradle
index d4ebafe30e7..102fffbe687 100644
--- a/build.gradle
+++ b/build.gradle
@@ -109,7 +109,7 @@ rat {
 }
 check.dependsOn rat
 
-// Define root PreCommit tasks simplifying what is needed
+// Define root pre/post commit tasks simplifying what is needed
 // to be specified on the commandline when executing locally.
 // This indirection also makes Jenkins use the branch of the PR
 // for the test definitions.
@@ -122,6 +122,11 @@ task javaPreCommit() {
   dependsOn ":beam-examples-java:preCommit"
 }
 
+task javaPostCommit() {
+  dependsOn ":javaPreCommit"
+  dependsOn ":beam-runners-google-cloud-dataflow-java:postCommit"
+}
+
 task goPreCommit() {
   dependsOn ":rat"
   dependsOn ":beam-sdks-go:test"
diff --git a/runners/google-cloud-dataflow-java/build.gradle 
b/runners/google-cloud-dataflow-java/build.gradle
index 555a61b1e63..cb3c6a42582 100644
--- a/runners/google-cloud-dataflow-java/build.gradle
+++ b/runners/google-cloud-dataflow-java/build.gradle
@@ -51,6 +51,8 @@ test {
 
 configurations {
   validatesRunner
+  examplesJavaIntegrationTest
+  googleCloudPlatformIntegrationTest
 }
 
 dependencies {
@@ -89,6 +91,10 @@ dependencies {
   shadowTest library.java.jackson_dataformat_yaml
   validatesRunner project(path: ":beam-sdks-java-core", configuration: 
"shadowTest")
   validatesRunner project(path: project.path, configuration: "shadow")
+  examplesJavaIntegrationTest project(path: project.path, configuration: 
"shadow")
+  examplesJavaIntegrationTest project(path: ":beam-examples-java", 
configuration: "shadowTest")
+  googleCloudPlatformIntegrationTest project(path: project.path, 
configuration: "shadow")
+  googleCloudPlatformIntegrationTest project(path: 
":beam-sdks-java-io-google-cloud-platform", configuration: "shadowTest")
 }
 
 test {
@@ -120,7 +126,6 @@ task validatesRunnerTest(type: Test) {
     excludeCategories 'org.apache.beam.sdk.testing.UsesUnboundedPCollections'
     excludeCategories 'org.apache.beam.sdk.testing.UsesTestStream'
     excludeCategories 'org.apache.beam.sdk.testing.UsesParDoLifecycle'
-
   }
 }
 
@@ -134,3 +139,48 @@ task validatesRunner {
 def gcpProject = project.findProperty('gcpProject') ?: 'apache-beam-testing'
 def gcsBucket = project.findProperty('gcsBucket') ?: 
'temp-storage-for-release-validation-tests/quickstart'
 createJavaQuickstartValidationTask(name: 'Dataflow', gcpProject: gcpProject, 
gcsBucket: gcsBucket)
+
+task googleCloudPlatformIntegrationTest(type: Test) {
+  group = "Verification"
+  def dataflowProject = project.findProperty('dataflowProject') ?: 
'apache-beam-testing'
+  def dataflowTempRoot = project.findProperty('dataflowTempRoot') ?: 
'gs://temp-storage-for-end-to-end-tests'
+  systemProperty "beamTestPipelineOptions", JsonOutput.toJson([
+          "--runner=TestDataflowRunner",
+          "--project=${dataflowProject}",
+          "--tempRoot=${dataflowTempRoot}",
+  ])
+
+  include '**/*IT.class'
+  maxParallelForks 4
+  classpath = configurations.googleCloudPlatformIntegrationTest
+  testClassesDirs = 
files(project(":beam-sdks-java-io-google-cloud-platform").sourceSets.test.output.classesDirs)
+  useJUnit { }
+}
+
+task examplesJavaIntegrationTest(type: Test) {
+  group = "Verification"
+  def dataflowProject = project.findProperty('dataflowProject') ?: 
'apache-beam-testing'
+  def dataflowTempRoot = project.findProperty('dataflowTempRoot') ?: 
'gs://temp-storage-for-end-to-end-tests'
+  systemProperty "beamTestPipelineOptions", JsonOutput.toJson([
+          "--runner=TestDataflowRunner",
+          "--project=${dataflowProject}",
+          "--tempRoot=${dataflowTempRoot}",
+  ])
+
+  // The examples/java preCommit task already covers running 
WordCountIT/WindowedWordCountIT so
+  // this postCommit integration test excludes them.
+  include '**/*IT.class'
+  exclude '**/WordCountIT.class'
+  exclude '**/WindowedWordCountIT.class'
+  maxParallelForks 4
+  classpath = configurations.googleCloudPlatformIntegrationTest
+  testClassesDirs = 
files(project(":beam-examples-java").sourceSets.test.output.classesDirs)
+  useJUnit { }
+}
+
+task postCommit {
+  group = "Verfication"
+  description = "Various integration tests using the Dataflow runner."
+  dependsOn googleCloudPlatformIntegrationTest
+  dependsOn examplesJavaIntegrationTest
+}
diff --git a/sdks/java/io/google-cloud-platform/build.gradle 
b/sdks/java/io/google-cloud-platform/build.gradle
index a292ebf0883..f9df0965f68 100644
--- a/sdks/java/io/google-cloud-platform/build.gradle
+++ b/sdks/java/io/google-cloud-platform/build.gradle
@@ -69,11 +69,33 @@ dependencies {
   shadow library.java.proto_google_common_protos
   shadow library.java.grpc_all
   shadow library.java.netty_tcnative_boringssl_static
-  testCompile project(path: ":beam-sdks-java-core", configuration: 
"shadowTest")
-  testCompile 
project(":beam-sdks-java-extensions-google-cloud-platform-core").sourceSets.test.output
-  testCompile project(path: ":beam-runners-direct-java", configuration: 
"shadow")
-  testCompile library.java.hamcrest_core
-  testCompile library.java.mockito_core
-  testCompile library.java.junit
-  testCompile library.java.slf4j_jdk14
+  shadowTest project(path: ":beam-sdks-java-core", configuration: "shadowTest")
+  shadowTest 
project(":beam-sdks-java-extensions-google-cloud-platform-core").sourceSets.test.output
+  shadowTest project(path: ":beam-runners-direct-java", configuration: 
"shadow")
+  shadowTest library.java.hamcrest_core
+  shadowTest library.java.mockito_core
+  shadowTest library.java.junit
+  shadowTest library.java.slf4j_jdk14
+}
+
+// Create a shaded test jar.
+task shadowTestJar(type: 
com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
+  classifier = "shaded-tests"
+  from sourceSets.test.output
+  configurations = [project.configurations.testRuntime]
+  dependencies {
+    exclude(".*")
+    include(dependency(library.java.guava))
+  }
+  relocate("com.google.common", getJavaRelocatedPath("com.google.common")) {
+    // com.google.common is too generic, need to exclude guava-testlib
+    exclude "com.google.common.collect.testing.**"
+    exclude "com.google.common.escape.testing.**"
+    exclude "com.google.common.testing.**"
+    exclude "com.google.common.util.concurrent.testing.**"
+  }
+}
+
+artifacts {
+  shadowTest shadowTestJar
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 89005)
    Time Spent: 1h  (was: 50m)

> Migrate MavenInstall Jenkins PostCommits to Gradle
> --------------------------------------------------
>
>                 Key: BEAM-4014
>                 URL: https://issues.apache.org/jira/browse/BEAM-4014
>             Project: Beam
>          Issue Type: Sub-task
>          Components: build-system, testing
>            Reporter: Henning Rohde
>            Assignee: Luke Cwik
>            Priority: Major
>          Time Spent: 1h
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to