sijie closed pull request #1481: Improve precommit build time
URL: https://github.com/apache/bookkeeper/pull/1481
 
 
   

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/common_job_properties.groovy 
b/.test-infra/jenkins/common_job_properties.groovy
index 86162a8c7..2a0b97152 100644
--- a/.test-infra/jenkins/common_job_properties.groovy
+++ b/.test-infra/jenkins/common_job_properties.groovy
@@ -126,8 +126,8 @@ class common_job_properties {
   // below to insulate callers from internal parameter defaults.
   private static void setPullRequestBuildTrigger(context,
                                                  String commitStatusContext,
-                                                 String successComment = 
'--none--',
                                                  String prTriggerPhrase = '',
+                                                 String prSkipBuildPhrase = '',
                                                  boolean onlyMaster = false) {
     context.triggers {
       githubPullRequest {
@@ -143,7 +143,9 @@ class common_job_properties {
         // required to start it.
         if (prTriggerPhrase) {
           triggerPhrase(prTriggerPhrase)
-          onlyTriggerPhrase()
+        }
+        if (prSkipBuildPhrase) {
+          skipBuildPhrase(prSkipBuildPhrase)
         }
         if (onlyMaster) {
           whiteListTargetBranches(['master'])
@@ -155,38 +157,9 @@ class common_job_properties {
             // for this Jenkins project.
             delegate.context("Jenkins: " + commitStatusContext)
           }
-
-          /*
-            This section is disabled, because of jenkinsci/ghprb-plugin#417 
issue.
-            For the time being, an equivalent configure section below is added.
-
-          // Comment messages after build completes.
-          buildStatus {
-            completedStatus('SUCCESS', successComment)
-            completedStatus('FAILURE', '--none--')
-            completedStatus('ERROR', '--none--')
-          }
-          */
         }
       }
     }
-
-    // Comment messages after build completes.
-    context.configure {
-      def messages = it / triggers / 
'org.jenkinsci.plugins.ghprb.GhprbTrigger' / extensions / 
'org.jenkinsci.plugins.ghprb.extensions.comments.GhprbBuildStatus' / messages
-      messages << 
'org.jenkinsci.plugins.ghprb.extensions.comments.GhprbBuildResultMessage' {
-        message(successComment)
-        result('SUCCESS')
-      }
-      messages << 
'org.jenkinsci.plugins.ghprb.extensions.comments.GhprbBuildResultMessage' {
-        message('--none--')
-        result('ERROR')
-      }
-      messages << 
'org.jenkinsci.plugins.ghprb.extensions.comments.GhprbBuildResultMessage' {
-        message('--none--')
-        result('FAILURE')
-      }
-    }
   }
 
   // Sets common config for Maven jobs.
@@ -213,10 +186,11 @@ class common_job_properties {
   // Sets common config for PreCommit jobs.
   static void setPreCommit(context,
                            String commitStatusName,
-                           String successComment = '--none--',
+                           String prTriggerPhrase = '',
+                           String prSkipBuildPhrase = '',
                            boolean onlyMaster = false) {
     // Set pull request build trigger.
-    setPullRequestBuildTrigger(context, commitStatusName, successComment, '', 
onlyMaster)
+    setPullRequestBuildTrigger(context, commitStatusName, prTriggerPhrase, 
prSkipBuildPhrase, onlyMaster)
   }
 
   // Enable triggering postcommit runs against pull requests. Users can 
comment the trigger phrase
@@ -228,7 +202,6 @@ class common_job_properties {
     setPullRequestBuildTrigger(
       context,
       commitStatusName,
-      '--none--',
       prTriggerPhrase)
   }
 
diff --git a/.test-infra/jenkins/job_bookkeeper_precommit_bookie_tests.groovy 
b/.test-infra/jenkins/job_bookkeeper_precommit_bookie_tests.groovy
new file mode 100644
index 000000000..b9501d91d
--- /dev/null
+++ b/.test-infra/jenkins/job_bookkeeper_precommit_bookie_tests.groovy
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import common_job_properties
+
+// test `org.apache.bookkeeper.bookie.**`
+freeStyleJob('bookkeeper_precommit_bookie_tests') {
+  description('Run bookkeeper bookie tests in Java 8.')
+
+  // Execute concurrent builds if necessary.
+  concurrentBuild()
+
+  // Set common parameters.
+  common_job_properties.setTopLevelMainJobProperties(
+    delegate,
+    'master',
+    'JDK 1.8 (latest)',
+    200,
+    'ubuntu',
+    '${ghprbTargetBranch}')
+
+  // Sets that this is a PreCommit job.
+  common_job_properties.setPreCommit(
+    delegate,
+    'Bookie Tests',
+    '.*(re)?run (bookie )?tests.*',
+    '.*\[skip (bookie )?tests\].*',
+    true)
+
+  steps {
+    // Temporary information gathering to see if full disks are causing the 
builds to flake
+    shell("id")
+    shell("ulimit -a")
+    shell("pwd")
+    shell("df -h")
+    shell("ps aux")
+
+    // Build everything
+    maven {
+      // Set Maven parameters.
+      common_job_properties.setMavenConfig(delegate)
+
+      goals('-B -am -pl bookkeeper-server clean install -DskipTests')
+    }
+
+    // Test the package
+    maven {
+      // Set Maven parameters.
+      common_job_properties.setMavenConfig(delegate)
+
+      goals('-pl bookkeeper-server test 
-Dtest="org.apache.bookkeeper.bookie.**"')
+    }
+  }
+
+}
diff --git a/.test-infra/jenkins/job_bookkeeper_precommit_client_tests.groovy 
b/.test-infra/jenkins/job_bookkeeper_precommit_client_tests.groovy
new file mode 100644
index 000000000..1990686e7
--- /dev/null
+++ b/.test-infra/jenkins/job_bookkeeper_precommit_client_tests.groovy
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import common_job_properties
+
+// test `org.apache.bookkeeper.client.**`
+freeStyleJob('bookkeeper_precommit_client_tests') {
+  description('Run bookkeeper client tests in Java 8.')
+
+  // Execute concurrent builds if necessary.
+  concurrentBuild()
+
+  // Set common parameters.
+  common_job_properties.setTopLevelMainJobProperties(
+    delegate,
+    'master',
+    'JDK 1.8 (latest)',
+    200,
+    'ubuntu',
+    '${ghprbTargetBranch}')
+
+  // Sets that this is a PreCommit job.
+  common_job_properties.setPreCommit(
+    delegate,
+    'Client Tests',
+    '.*(re)?run (client )?tests.*',
+    '.*\[skip (client )?tests\].*',
+    true)
+
+  steps {
+    // Temporary information gathering to see if full disks are causing the 
builds to flake
+    shell("id")
+    shell("ulimit -a")
+    shell("pwd")
+    shell("df -h")
+    shell("ps aux")
+
+    // Build everything
+    maven {
+      // Set Maven parameters.
+      common_job_properties.setMavenConfig(delegate)
+
+      goals('-B -am -pl bookkeeper-server clean install -DskipTests')
+    }
+
+    // Test the package
+    maven {
+      // Set Maven parameters.
+      common_job_properties.setMavenConfig(delegate)
+
+      goals('-pl bookkeeper-server test 
-Dtest="org.apache.bookkeeper.client.**"')
+    }
+  }
+
+}
diff --git 
a/.test-infra/jenkins/job_bookkeeper_precommit_integrationtests.groovy 
b/.test-infra/jenkins/job_bookkeeper_precommit_integrationtests.groovy
index 9cd7635c5..8dcdb63b3 100644
--- a/.test-infra/jenkins/job_bookkeeper_precommit_integrationtests.groovy
+++ b/.test-infra/jenkins/job_bookkeeper_precommit_integrationtests.groovy
@@ -35,7 +35,11 @@ freeStyleJob('bookkeeper_precommit_integrationtests') {
     concurrentBuild()
 
     // Sets that this is a PreCommit job.
-    common_job_properties.setPreCommit(delegate, 'Integration Tests')
+    common_job_properties.setPreCommit(
+        delegate,
+        'Integration Tests',
+        '.*(re)?run integration tests.*',
+        '.*\[skip integration tests\].*')
 
     steps {
         // Temporary information gathering to see if full disks are causing 
the builds to flake
diff --git a/.test-infra/jenkins/job_bookkeeper_precommit_java8.groovy 
b/.test-infra/jenkins/job_bookkeeper_precommit_java8.groovy
index 28e7214e1..4e62b45e0 100644
--- a/.test-infra/jenkins/job_bookkeeper_precommit_java8.groovy
+++ b/.test-infra/jenkins/job_bookkeeper_precommit_java8.groovy
@@ -44,11 +44,15 @@ mavenJob('bookkeeper_precommit_pullrequest_java8') {
     '${ghprbTargetBranch}')
 
   // Sets that this is a PreCommit job.
-  common_job_properties.setPreCommit(delegate, 'Maven clean install (Java 8)')
+  common_job_properties.setPreCommit(
+    delegate,
+    'Build (Java 8)',
+    '.*(re)?build( java8)?.*',
+    '.*\[skip build( java8)?\].*')
 
   // Set Maven parameters.
   common_job_properties.setMavenConfig(delegate)
 
   // Maven build project
-  goals('clean apache-rat:check package spotbugs:check -Dstream')
+  goals('clean package spotbugs:check -Dstream -DskipBookKeeperServerTests')
 }
diff --git a/.test-infra/jenkins/job_bookkeeper_precommit_java9.groovy 
b/.test-infra/jenkins/job_bookkeeper_precommit_java9.groovy
index 120144e14..2420c4c98 100644
--- a/.test-infra/jenkins/job_bookkeeper_precommit_java9.groovy
+++ b/.test-infra/jenkins/job_bookkeeper_precommit_java9.groovy
@@ -44,11 +44,15 @@ mavenJob('bookkeeper_precommit_pullrequest_java9') {
     '${ghprbTargetBranch}')
 
   // Sets that this is a PreCommit job.
-  common_job_properties.setPreCommit(delegate, 'Maven clean install (Java 9)')
+  common_job_properties.setPreCommit(
+    delegate,
+    'Build (Java 9)',
+    '.*(re)?build( java9)?.*',
+    '.*\[skip build( java9)?\].*')
 
   // Set Maven parameters.
   common_job_properties.setMavenConfig(delegate)
 
   // Maven build project
-  goals('clean apache-rat:check package spotbugs:check -Dstream')
+  goals('clean package spotbugs:check -Dstream -DskipBookKeeperServerTests')
 }
diff --git 
a/.test-infra/jenkins/job_bookkeeper_precommit_remaining_tests.groovy 
b/.test-infra/jenkins/job_bookkeeper_precommit_remaining_tests.groovy
new file mode 100644
index 000000000..f7811c8a0
--- /dev/null
+++ b/.test-infra/jenkins/job_bookkeeper_precommit_remaining_tests.groovy
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import common_job_properties
+
+// run tests except:
+//   - `org.apache.bookkeeper.client.**`
+//   - `org.apache.bookkeeper.bookie.**`
+//   - `org.apache.bookkeeper.replication.**`
+//   - `org.apache.bookkeeper.tls.**`
+freeStyleJob('bookkeeper_precommit_remaining_tests') {
+  description('Run bookkeeper remaining tests in Java 8.')
+
+  // Execute concurrent builds if necessary.
+  concurrentBuild()
+
+  // Set common parameters.
+  common_job_properties.setTopLevelMainJobProperties(
+    delegate,
+    'master',
+    'JDK 1.8 (latest)',
+    200,
+    'ubuntu',
+    '${ghprbTargetBranch}')
+
+  // Sets that this is a PreCommit job.
+  common_job_properties.setPreCommit(
+    delegate,
+    'All Other Tests',
+    '.*(re)?run (remaining )?tests.*',
+    '.*\[skip (remaining )?tests\].*',
+    true)
+
+  steps {
+    // Temporary information gathering to see if full disks are causing the 
builds to flake
+    shell("id")
+    shell("ulimit -a")
+    shell("pwd")
+    shell("df -h")
+    shell("ps aux")
+
+    // Build everything
+    maven {
+      // Set Maven parameters.
+      common_job_properties.setMavenConfig(delegate)
+
+      goals('-B -am -pl bookkeeper-server clean install -DskipTests')
+    }
+
+    // Test the package
+    maven {
+      // Set Maven parameters.
+      common_job_properties.setMavenConfig(delegate)
+
+      goals('-pl bookkeeper-server test 
-Dtest="!org.apache.bookkeeper.client.**,!org.apache.bookkeeper.bookie.**,!org.apache.bookkeeper.replication.**,!org.apache.bookkeeper.tls.**"')
+    }
+  }
+
+}
diff --git 
a/.test-infra/jenkins/job_bookkeeper_precommit_replication_tests.groovy 
b/.test-infra/jenkins/job_bookkeeper_precommit_replication_tests.groovy
new file mode 100644
index 000000000..f474bde9c
--- /dev/null
+++ b/.test-infra/jenkins/job_bookkeeper_precommit_replication_tests.groovy
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import common_job_properties
+
+// test `org.apache.bookkeeper.replication.**`
+freeStyleJob('bookkeeper_precommit_replication_tests') {
+  description('Run bookkeeper replication tests in Java 8.')
+
+  // Execute concurrent builds if necessary.
+  concurrentBuild()
+
+  // Set common parameters.
+  common_job_properties.setTopLevelMainJobProperties(
+    delegate,
+    'master',
+    'JDK 1.8 (latest)',
+    200,
+    'ubuntu',
+    '${ghprbTargetBranch}')
+
+  // Sets that this is a PreCommit job.
+  common_job_properties.setPreCommit(
+    delegate,
+    'Replication Tests',
+    '.*(re)?run (replication )?tests.*',
+    '.*\[skip (replication )?tests\].*',
+    true)
+
+  steps {
+    // Temporary information gathering to see if full disks are causing the 
builds to flake
+    shell("id")
+    shell("ulimit -a")
+    shell("pwd")
+    shell("df -h")
+    shell("ps aux")
+
+    // Build everything
+    maven {
+      // Set Maven parameters.
+      common_job_properties.setMavenConfig(delegate)
+
+      goals('-B -am -pl bookkeeper-server clean install -DskipTests')
+    }
+
+    // Test the package
+    maven {
+      // Set Maven parameters.
+      common_job_properties.setMavenConfig(delegate)
+
+      goals('-pl bookkeeper-server test 
-Dtest="org.apache.bookkeeper.replication.**"')
+    }
+  }
+
+}
diff --git a/.test-infra/jenkins/job_bookkeeper_precommit_tls_tests.groovy 
b/.test-infra/jenkins/job_bookkeeper_precommit_tls_tests.groovy
new file mode 100644
index 000000000..f38c319be
--- /dev/null
+++ b/.test-infra/jenkins/job_bookkeeper_precommit_tls_tests.groovy
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import common_job_properties
+
+// test `org.apache.bookkeeper.tls.**`
+freeStyleJob('bookkeeper_precommit_tls_tests') {
+  description('Run bookkeeper tls tests in Java 8.')
+
+  // Execute concurrent builds if necessary.
+  concurrentBuild()
+
+  // Set common parameters.
+  common_job_properties.setTopLevelMainJobProperties(
+    delegate,
+    'master',
+    'JDK 1.8 (latest)',
+    200,
+    'ubuntu',
+    '${ghprbTargetBranch}')
+
+  // Sets that this is a PreCommit job.
+  common_job_properties.setPreCommit(
+    delegate,
+    'TLS Tests',
+    '.*(re)?run (tls )?tests.*',
+    '.*\[skip (tls )?tests\].*',
+    true)
+
+  steps {
+    // Temporary information gathering to see if full disks are causing the 
builds to flake
+    shell("id")
+    shell("ulimit -a")
+    shell("pwd")
+    shell("df -h")
+    shell("ps aux")
+
+    // Build everything
+    maven {
+      // Set Maven parameters.
+      common_job_properties.setMavenConfig(delegate)
+
+      goals('-B -am -pl bookkeeper-server clean install -DskipTests')
+    }
+
+    // Test the package
+    maven {
+      // Set Maven parameters.
+      common_job_properties.setMavenConfig(delegate)
+
+      goals('-pl bookkeeper-server test -Dtest="org.apache.bookkeeper.tls.**"')
+    }
+  }
+
+}
diff --git a/.test-infra/jenkins/job_bookkeeper_precommit_validation.groovy 
b/.test-infra/jenkins/job_bookkeeper_precommit_validation.groovy
index 48d6c3a88..cbcec6d01 100644
--- a/.test-infra/jenkins/job_bookkeeper_precommit_validation.groovy
+++ b/.test-infra/jenkins/job_bookkeeper_precommit_validation.groovy
@@ -35,7 +35,12 @@ mavenJob('bookkeeper_precommit_pullrequest_validation') {
     '${ghprbTargetBranch}')
 
   // Sets that this is a PreCommit job.
-  common_job_properties.setPreCommit(delegate, 'Pull Request Validation', 
'--none--', true)
+  common_job_properties.setPreCommit(
+    delegate,
+    'PR Validation',
+    '.*(re)?run pr validation.*',
+    ''
+    true)
 
   // Set Maven parameters.
   common_job_properties.setMavenConfig(delegate)
diff --git a/bookkeeper-server/pom.xml b/bookkeeper-server/pom.xml
index d90f6bbae..a07165b24 100644
--- a/bookkeeper-server/pom.xml
+++ b/bookkeeper-server/pom.xml
@@ -270,5 +270,25 @@
         </plugins>
       </build>
     </profile>
+    <!-- test profiles -->
+    <profile>
+      <id>skipBookKeeperServerTests</id>
+      <activation>
+        <property>
+          <name>skipBookKeeperServerTests</name>
+        </property>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <configuration>
+              <skipTests>true</skipTests>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
   </profiles>
 </project>


 

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to