You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ch...@apache.org on 2019/01/17 10:21:38 UTC
[flink] 02/03: Setup master java 9 test
This is an automated email from the ASF dual-hosted git repository.
chesnay pushed a commit to branch cron-master-jdk9
in repository https://gitbox.apache.org/repos/asf/flink.git
commit 0017c6c4e2c4eea10203ecfac7be79147bc32dbc
Author: zentol <ch...@apache.org>
AuthorDate: Fri Jan 11 13:02:11 2019 +0100
Setup master java 9 test
---
.travis.yml | 96 +++++++++++++++++++++
LICENSE | 201 +++++++++++++++++++++++++++++++++++++++++++
tools/travis/fold.sh | 45 ++++++++++
tools/travis/shade.sh | 201 +++++++++++++++++++++++++++++++++++++++++++
tools/travis/stage.sh | 149 ++++++++++++++++++++++++++++++++
tools/travis_controller.sh | 207 +++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 899 insertions(+)
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..06247df
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,96 @@
+# 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.
+
+# s3 deployment based on http://about.travis-ci.org/blog/2012-12-18-travis-artifacts/
+
+# send to fully-virtualized infrastructure: https://docs.travis-ci.com/user/trusty-ci-environment/
+sudo: required
+dist: trusty
+
+cache:
+ # default timeout is too low
+ timeout: 600
+ directories:
+ - $HOME/.m2
+ - $HOME/flink_cache
+
+# do not cache our own artifacts
+before_cache:
+ - rm -rf $HOME/.m2/repository/org/apache/flink/
+
+install: true
+
+language: java
+
+git:
+ depth: 100
+
+env:
+ global:
+ # Global variable to avoid hanging travis builds when downloading cache archives.
+ - MALLOC_ARENA_MAX=2
+ - DOCKER_COMPOSE_VERSION=1.22.0
+
+before_script:
+ - "gem install --no-document --version 0.8.9 faraday "
+ - "export -f travis_nanoseconds"
+ - "export -f travis_time_start"
+ - "export -f travis_time_finish"
+
+# Install maven 3.2.5 since trusty uses 3.3.9 for which shading is broken
+before_install:
+ - "wget https://archive.apache.org/dist/maven/maven-3/3.2.5/binaries/apache-maven-3.2.5-bin.zip"
+ - "unzip -qq apache-maven-3.2.5-bin.zip"
+ - "rm apache-maven-3.2.5-bin.zip"
+ - "export M2_HOME=$PWD/apache-maven-3.2.5"
+ - "export PATH=$M2_HOME/bin:$PATH"
+ - "export MAVEN_OPTS=\"-Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss.SSS\""
+# just in case: clean up the .m2 home and remove invalid jar files
+ - 'test ! -d $HOME/.m2/repository/ || find $HOME/.m2/repository/ -name "*.jar" -exec sh -c ''if ! zip -T {} >/dev/null ; then echo "deleting invalid file: {}"; rm -f {} ; fi'' \;'
+# Installing the specified docker compose version
+ - sudo rm /usr/local/bin/docker-compose
+ - curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
+ - chmod +x docker-compose
+ - sudo mv docker-compose /usr/local/bin
+
+# When modifying the matrix you also have to modify travis_controller.sh#getCurrentStage
+jdk: "openjdk9"
+jobs:
+ include:
+ # main profile
+ - stage: compile
+ script: ./tools/travis_controller.sh
+ env: PROFILE="-Dhadoop.version=2.8.3 -Pinclude-kinesis -Dinclude_hadoop_aws -Dscala-2.11"
+ name: compile
+ - stage: test
+ script: ./tools/travis_controller.sh
+ env: PROFILE="-Dhadoop.version=2.8.3 -Pinclude-kinesis -Dinclude_hadoop_aws -Dscala-2.11"
+ name: core
+ - script: ./tools/travis_controller.sh
+ env: PROFILE="-Dhadoop.version=2.8.3 -Pinclude-kinesis -Dinclude_hadoop_aws -Dscala-2.11"
+ name: libraries
+ - script: ./tools/travis_controller.sh
+ env: PROFILE="-Dhadoop.version=2.8.3 -Pinclude-kinesis -Dinclude_hadoop_aws -Dscala-2.11"
+ name: connectors
+ - script: ./tools/travis_controller.sh
+ env: PROFILE="-Dhadoop.version=2.8.3 -Pinclude-kinesis -Dinclude_hadoop_aws -Dscala-2.11"
+ name: tests
+ - script: ./tools/travis_controller.sh
+ env: PROFILE="-Dhadoop.version=2.8.3 -Pinclude-kinesis -Dinclude_hadoop_aws -Dscala-2.11"
+ name: misc
+ - stage: cleanup
+ script: ./tools/travis_controller.sh
+ env: PROFILE="-Dhadoop.version=2.8.3 -Pinclude-kinesis -Dinclude_hadoop_aws -Dscala-2.11"
+ name: cleanup
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..261eeb9
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed 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.
diff --git a/tools/travis/fold.sh b/tools/travis/fold.sh
new file mode 100644
index 0000000..c5676909
--- /dev/null
+++ b/tools/travis/fold.sh
@@ -0,0 +1,45 @@
+#!/usr/bin/env bash
+################################################################################
+# 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.
+################################################################################
+
+# Hex-encoded travis-interval ANSI escape sequences
+# https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/bash/travis_fold.bash
+# https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/bash/travis_setup_env.bash
+#
+# \x1b = \033 = ESC
+# \x5b = [
+# \x4b = K
+# \x6d = m
+# \x30 = 0
+# \x31 = 1
+# \x33 = 3
+# \x3b = ;
+
+COLOR_YELLOW="\x1b\x5b\x33\x33\x3b\x31\x6d"
+ANSI_CLEAR="\x1b\x5b\x30\x6d"
+
+function start_fold {
+ local id=$1
+ local message=$2
+ echo -e "travis_fold:start:${id}\\r${ANSI_CLEAR}${COLOR_YELLOW}${message}${ANSI_CLEAR}"
+}
+
+function end_fold {
+ local message=$1
+ echo -en "travis_fold:end:${message}\\r${ANSI_CLEAR}"
+}
diff --git a/tools/travis/shade.sh b/tools/travis/shade.sh
new file mode 100644
index 0000000..f27dea5
--- /dev/null
+++ b/tools/travis/shade.sh
@@ -0,0 +1,201 @@
+#!/usr/bin/env bash
+################################################################################
+# 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.
+################################################################################
+
+# Check the final fat jar for illegal or missing artifacts
+check_shaded_artifacts() {
+ jar tf build-target/lib/flink-dist*.jar > allClasses
+ ASM=`cat allClasses | grep '^org/objectweb/asm/' | wc -l`
+ if [ "$ASM" != "0" ]; then
+ echo "=============================================================================="
+ echo "Detected '$ASM' unshaded asm dependencies in fat jar"
+ echo "=============================================================================="
+ return 1
+ fi
+
+ GUAVA=`cat allClasses | grep '^com/google/common' | wc -l`
+ if [ "$GUAVA" != "0" ]; then
+ echo "=============================================================================="
+ echo "Detected '$GUAVA' guava dependencies in fat jar"
+ echo "=============================================================================="
+ return 1
+ fi
+
+ CODEHAUS_JACKSON=`cat allClasses | grep '^org/codehaus/jackson' | wc -l`
+ if [ "$CODEHAUS_JACKSON" != "0" ]; then
+ echo "=============================================================================="
+ echo "Detected '$CODEHAUS_JACKSON' unshaded org.codehaus.jackson classes in fat jar"
+ echo "=============================================================================="
+ return 1
+ fi
+
+ FASTERXML_JACKSON=`cat allClasses | grep '^com/fasterxml/jackson' | wc -l`
+ if [ "$FASTERXML_JACKSON" != "0" ]; then
+ echo "=============================================================================="
+ echo "Detected '$FASTERXML_JACKSON' unshaded com.fasterxml.jackson classes in fat jar"
+ echo "=============================================================================="
+ return 1
+ fi
+
+ SNAPPY=`cat allClasses | grep '^org/xerial/snappy' | wc -l`
+ if [ "$SNAPPY" == "0" ]; then
+ echo "=============================================================================="
+ echo "Missing snappy dependencies in fat jar"
+ echo "=============================================================================="
+ return 1
+ fi
+
+ IO_NETTY=`cat allClasses | grep '^io/netty' | wc -l`
+ if [ "$IO_NETTY" != "0" ]; then
+ echo "=============================================================================="
+ echo "Detected '$IO_NETTY' unshaded io.netty classes in fat jar"
+ echo "=============================================================================="
+ return 1
+ fi
+
+ ORG_NETTY=`cat allClasses | grep '^org/jboss/netty' | wc -l`
+ if [ "$ORG_NETTY" != "0" ]; then
+ echo "=============================================================================="
+ echo "Detected '$ORG_NETTY' unshaded org.jboss.netty classes in fat jar"
+ echo "=============================================================================="
+ return 1
+ fi
+
+ ZOOKEEPER=`cat allClasses | grep '^org/apache/zookeeper' | wc -l`
+ if [ "$ZOOKEEPER" != "0" ]; then
+ echo "=============================================================================="
+ echo "Detected '$ZOOKEEPER' unshaded org.apache.zookeeper classes in fat jar"
+ echo "=============================================================================="
+ return 1
+ fi
+
+ CURATOR=`cat allClasses | grep '^org/apache/curator' | wc -l`
+ if [ "$CURATOR" != "0" ]; then
+ echo "=============================================================================="
+ echo "Detected '$CURATOR' unshaded org.apache.curator classes in fat jar"
+ echo "=============================================================================="
+ return 1
+ fi
+
+ FLINK_PYTHON=`cat allClasses | grep '^org/apache/flink/python' | wc -l`
+ if [ "$FLINK_PYTHON" != "0" ]; then
+ echo "=============================================================================="
+ echo "Detected that the Flink Python artifact is in the dist jar"
+ echo "=============================================================================="
+ return 1
+ fi
+
+ HADOOP=`cat allClasses | grep '^org/apache/hadoop' | wc -l`
+ if [ "$HADOOP" != "0" ]; then
+ echo "=============================================================================="
+ echo "Detected '$HADOOP' Hadoop classes in the dist jar"
+ echo "=============================================================================="
+ return 1
+ fi
+
+ MAPR=`cat allClasses | grep '^com/mapr' | wc -l`
+ if [ "$MAPR" != "0" ]; then
+ echo "=============================================================================="
+ echo "Detected '$MAPR' MapR classes in the dist jar"
+ echo "=============================================================================="
+ return 1
+ fi
+
+ return 0
+}
+
+# Check the S3 fs implementations' fat jars for illegal or missing artifacts
+check_shaded_artifacts_s3_fs() {
+ VARIANT=$1
+ jar tf flink-filesystems/flink-s3-fs-${VARIANT}/target/flink-s3-fs-${VARIANT}*.jar > allClasses
+
+ UNSHADED_CLASSES=`cat allClasses | grep -v -e '^META-INF' -e "^org/apache/flink/fs/" | grep '\.class$'`
+ if [ "$?" == "0" ]; then
+ echo "=============================================================================="
+ echo "${VARIANT}: Detected unshaded dependencies in fat jar:"
+ echo "${UNSHADED_CLASSES}"
+ echo "=============================================================================="
+ return 1
+ fi
+
+ if [ ! `cat allClasses | grep '^META-INF/services/org\.apache\.flink\.core\.fs\.FileSystemFactory$'` ]; then
+ echo "=============================================================================="
+ echo "${VARIANT}: File does not exist: services/org.apache.flink.core.fs.FileSystemFactory"
+ echo "=============================================================================="
+ return 1
+ fi
+
+ UNSHADED_SERVICES=`cat allClasses | grep '^META-INF/services/' | grep -v -e '^META-INF/services/org\.apache\.flink\.core\.fs\.FileSystemFactory$' -e "^META-INF/services/org\.apache\.flink\.fs.*shaded" -e '^META-INF/services/'`
+ if [ "$?" == "0" ]; then
+ echo "=============================================================================="
+ echo "${VARIANT}: Detected unshaded service files in fat jar:"
+ echo "${UNSHADED_SERVICES}"
+ echo "=============================================================================="
+ return 1
+ fi
+
+ FS_SERVICE_FILE_CLASSES=`unzip -q -c flink-filesystems/flink-s3-fs-${VARIANT}/target/flink-s3-fs-${VARIANT}*.jar META-INF/services/org.apache.flink.core.fs.FileSystemFactory | grep -v -e '^#' -e '^$'`
+ EXPECTED_FS_SERVICE_FILE_CLASSES="org.apache.flink.fs.s3${VARIANT}.S3FileSystemFactory"
+ if [ "${VARIANT}" == "hadoop" ]; then
+ read -r -d '' EXPECTED_FS_SERVICE_FILE_CLASSES <<EOF
+org.apache.flink.fs.s3${VARIANT}.S3FileSystemFactory
+org.apache.flink.fs.s3${VARIANT}.S3AFileSystemFactory
+EOF
+ elif [ "${VARIANT}" == "presto" ]; then
+ read -r -d '' EXPECTED_FS_SERVICE_FILE_CLASSES <<EOF
+org.apache.flink.fs.s3${VARIANT}.S3FileSystemFactory
+org.apache.flink.fs.s3${VARIANT}.S3PFileSystemFactory
+EOF
+ fi
+
+ if [ "${FS_SERVICE_FILE_CLASSES}" != "${EXPECTED_FS_SERVICE_FILE_CLASSES}" ]; then
+ echo "=============================================================================="
+ echo "${VARIANT}: Detected wrong content in services/org.apache.flink.core.fs.FileSystemFactory:"
+ echo "${FS_SERVICE_FILE_CLASSES}"
+ echo "=============================================================================="
+ return 1
+ fi
+
+ return 0
+}
+
+# Check the elasticsearch connectors' fat jars for illegal or missing artifacts
+check_shaded_artifacts_connector_elasticsearch() {
+ VARIANT=$1
+ find flink-connectors/flink-connector-elasticsearch${VARIANT}/target/flink-connector-elasticsearch${VARIANT}*.jar ! -name "*-tests.jar" -exec jar tf {} \; > allClasses
+
+ UNSHADED_CLASSES=`cat allClasses | grep -v -e '^META-INF' -e '^assets' -e "^org/apache/flink/streaming/connectors/elasticsearch/" -e "^org/apache/flink/streaming/connectors/elasticsearch${VARIANT}/" -e "^org/apache/flink/table/descriptors/" -e "^org/elasticsearch/" | grep '\.class$'`
+ if [ "$?" == "0" ]; then
+ echo "=============================================================================="
+ echo "Detected unshaded dependencies in flink-connector-elasticsearch${VARIANT}'s fat jar:"
+ echo "${UNSHADED_CLASSES}"
+ echo "=============================================================================="
+ return 1
+ fi
+
+ UNSHADED_SERVICES=`cat allClasses | grep '^META-INF/services/' | grep -v -e '^META-INF/services/org\.apache\.flink\.core\.fs\.FileSystemFactory$' -e "^META-INF/services/org\.apache\.flink\.fs\.s3${VARIANT}\.shaded" -e '^META-INF/services/'`
+ if [ "$?" == "0" ]; then
+ echo "=============================================================================="
+ echo "Detected unshaded service files in flink-connector-elasticsearch${VARIANT}'s fat jar:"
+ echo "${UNSHADED_SERVICES}"
+ echo "=============================================================================="
+ return 1
+ fi
+
+ return 0
+}
diff --git a/tools/travis/stage.sh b/tools/travis/stage.sh
new file mode 100644
index 0000000..8c474ea
--- /dev/null
+++ b/tools/travis/stage.sh
@@ -0,0 +1,149 @@
+#!/usr/bin/env bash
+################################################################################
+# 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.
+################################################################################
+
+STAGE_COMPILE="compile"
+STAGE_CORE="core"
+STAGE_LIBRARIES="libraries"
+STAGE_CONNECTORS="connectors"
+STAGE_TESTS="tests"
+STAGE_MISC="misc"
+STAGE_CLEANUP="cleanup"
+
+MODULES_CORE="\
+flink-test-utils-parent/flink-test-utils,\
+flink-state-backends/flink-statebackend-rocksdb,\
+flink-clients,\
+flink-core,\
+flink-java,\
+flink-optimizer,\
+flink-runtime,\
+flink-runtime-web,\
+flink-scala,\
+flink-streaming-java,\
+flink-streaming-scala"
+
+MODULES_LIBRARIES="\
+flink-libraries/flink-cep,\
+flink-libraries/flink-cep-scala,\
+flink-libraries/flink-gelly,\
+flink-libraries/flink-gelly-scala,\
+flink-libraries/flink-gelly-examples,\
+flink-libraries/flink-ml,\
+flink-libraries/flink-python,\
+flink-libraries/flink-streaming-python,\
+flink-libraries/flink-table-common,\
+flink-libraries/flink-table,\
+flink-libraries/flink-sql-client,\
+flink-queryable-state/flink-queryable-state-runtime,\
+flink-queryable-state/flink-queryable-state-client-java"
+
+MODULES_CONNECTORS="\
+flink-contrib/flink-connector-wikiedits,\
+flink-filesystems/flink-hadoop-fs,\
+flink-filesystems/flink-mapr-fs,\
+flink-filesystems/flink-s3-fs-base,\
+flink-filesystems/flink-s3-fs-hadoop,\
+flink-filesystems/flink-s3-fs-presto,\
+flink-formats/flink-avro,\
+flink-formats/flink-parquet,\
+flink-connectors/flink-hbase,\
+flink-connectors/flink-hcatalog,\
+flink-connectors/flink-hadoop-compatibility,\
+flink-connectors/flink-jdbc,\
+flink-connectors/flink-connector-cassandra,\
+flink-connectors/flink-connector-elasticsearch,\
+flink-connectors/flink-connector-elasticsearch2,\
+flink-connectors/flink-connector-elasticsearch5,\
+flink-connectors/flink-connector-elasticsearch6,\
+flink-connectors/flink-connector-elasticsearch-base,\
+flink-connectors/flink-connector-filesystem,\
+flink-connectors/flink-connector-kafka-0.9,\
+flink-connectors/flink-connector-kafka-0.10,\
+flink-connectors/flink-connector-kafka-0.11,\
+flink-connectors/flink-connector-kafka-base,\
+flink-connectors/flink-connector-nifi,\
+flink-connectors/flink-connector-rabbitmq,\
+flink-connectors/flink-orc,\
+flink-connectors/flink-connector-twitter"
+
+MODULES_TESTS="\
+flink-tests"
+
+if [[ ${PROFILE} == *"include-kinesis"* ]]; then
+ MODULES_CONNECTORS="$MODULES_CONNECTORS,flink-connectors/flink-connector-kinesis"
+fi
+
+# we can only build the Kafka 0.8 connector when building for Scala 2.11
+if [[ $PROFILE == *"scala-2.11"* ]]; then
+ MODULES_CONNECTORS="$MODULES_CONNECTORS,flink-connectors/flink-connector-kafka-0.8"
+fi
+
+# we can only build the Scala Shell when building for Scala 2.11
+if [[ $PROFILE == *"scala-2.11"* ]]; then
+ MODULES_CORE="$MODULES_CORE,flink-scala-shell"
+fi
+
+function get_compile_modules_for_stage() {
+ local stage=$1
+
+ case ${stage} in
+ (${STAGE_CORE})
+ echo "-pl $MODULES_CORE -am"
+ ;;
+ (${STAGE_LIBRARIES})
+ echo "-pl $MODULES_LIBRARIES -am"
+ ;;
+ (${STAGE_CONNECTORS})
+ echo "-pl $MODULES_CONNECTORS -am"
+ ;;
+ (${STAGE_TESTS})
+ echo "-pl $MODULES_TESTS -am"
+ ;;
+ (${STAGE_MISC})
+ # compile everything since dist needs it anyway
+ echo ""
+ ;;
+ esac
+}
+
+function get_test_modules_for_stage() {
+ local stage=$1
+
+ case ${stage} in
+ (${STAGE_CORE})
+ echo "-pl $MODULES_CORE"
+ ;;
+ (${STAGE_LIBRARIES})
+ echo "-pl $MODULES_LIBRARIES"
+ ;;
+ (${STAGE_CONNECTORS})
+ echo "-pl $MODULES_CONNECTORS"
+ ;;
+ (${STAGE_TESTS})
+ echo "-pl $MODULES_TESTS"
+ ;;
+ (${STAGE_MISC})
+ NEGATED_CORE=\!${MODULES_CORE//,/,\!}
+ NEGATED_LIBRARIES=\!${MODULES_LIBRARIES//,/,\!}
+ NEGATED_CONNECTORS=\!${MODULES_CONNECTORS//,/,\!}
+ NEGATED_TESTS=\!${MODULES_TESTS//,/,\!}
+ echo "-pl $NEGATED_CORE,$NEGATED_LIBRARIES,$NEGATED_CONNECTORS,$NEGATED_TESTS"
+ ;;
+ esac
+}
diff --git a/tools/travis_controller.sh b/tools/travis_controller.sh
new file mode 100644
index 0000000..09ac70c
--- /dev/null
+++ b/tools/travis_controller.sh
@@ -0,0 +1,207 @@
+#!/usr/bin/env bash
+################################################################################
+# 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.
+################################################################################
+
+CACHE_DIR="$HOME/flink_cache"
+CACHE_BUILD_DIR="$CACHE_DIR/$TRAVIS_BUILD_NUMBER"
+CACHE_FLINK_DIR="$CACHE_BUILD_DIR/flink"
+
+HERE="`dirname \"$0\"`" # relative
+HERE="`( cd \"$HERE\" && pwd )`" # absolutized and normalized
+if [ -z "$HERE" ] ; then
+ # error; for some reason, the path is not accessible
+ # to the script (e.g. permissions re-evaled after suid)
+ exit 1 # fail
+fi
+
+source "${HERE}/travis/fold.sh"
+source "${HERE}/travis/stage.sh"
+source "${HERE}/travis/shade.sh"
+
+function deleteOldCaches() {
+ while read CACHE_DIR; do
+ local old_number="${CACHE_DIR##*/}"
+ if [ "$old_number" -lt "$TRAVIS_BUILD_NUMBER" ]; then
+ echo "Deleting old cache $CACHE_DIR"
+ rm -rf "$CACHE_DIR"
+ fi
+ done
+}
+
+# delete leftover caches from previous builds
+find "$CACHE_DIR" -mindepth 1 -maxdepth 1 | grep -v "$TRAVIS_BUILD_NUMBER" | deleteOldCaches
+
+function getCurrentStage() {
+ STAGE_NUMBER=$(echo "$TRAVIS_JOB_NUMBER" | cut -d'.' -f 2)
+ case $STAGE_NUMBER in
+ (1)
+ echo "$STAGE_COMPILE"
+ ;;
+ (2)
+ echo "$STAGE_CORE"
+ ;;
+ (3)
+ echo "$STAGE_LIBRARIES"
+ ;;
+ (4)
+ echo "$STAGE_CONNECTORS"
+ ;;
+ (5)
+ echo "$STAGE_TESTS"
+ ;;
+ (6)
+ echo "$STAGE_MISC"
+ ;;
+ (7)
+ echo "$STAGE_CLEANUP"
+ ;;
+ (*)
+ echo "Invalid stage detected ($STAGE_NUMBER)"
+ return 1
+ ;;
+ esac
+
+ return 0
+}
+
+STAGE=$(getCurrentStage)
+if [ $? != 0 ]; then
+ echo "Could not determine current stage."
+ exit 1
+fi
+echo "Current stage: \"$STAGE\""
+
+EXIT_CODE=0
+
+git clone --single-branch -b master https://github.com/apache/flink
+
+cd flink
+
+# Run actual compile&test steps
+if [ $STAGE == "$STAGE_COMPILE" ]; then
+ MVN="mvn clean install -nsu -Dflink.forkCount=2 -Dflink.forkCountTestPackage=2 -Dmaven.javadoc.skip=true -B -DskipTests $PROFILE"
+ $MVN
+ EXIT_CODE=$?
+
+ if [ $EXIT_CODE == 0 ]; then
+ printf "\n\n==============================================================================\n"
+ printf "Checking scala suffixes\n"
+ printf "==============================================================================\n"
+
+ ./tools/verify_scala_suffixes.sh
+ EXIT_CODE=$?
+ else
+ printf "\n==============================================================================\n"
+ printf "Previous build failure detected, skipping scala-suffixes check.\n"
+ printf "==============================================================================\n"
+ fi
+
+ if [ $EXIT_CODE == 0 ]; then
+ printf "\n\n==============================================================================\n"
+ printf "Checking dependency convergence\n"
+ printf "==============================================================================\n"
+
+ ./tools/check_dependency_convergence.sh
+ EXIT_CODE=$?
+ else
+ printf "\n==============================================================================\n"
+ printf "Previous build failure detected, skipping dependency-convergence check.\n"
+ printf "==============================================================================\n"
+ fi
+
+ if [ $EXIT_CODE == 0 ]; then
+ check_shaded_artifacts
+ EXIT_CODE=$(($EXIT_CODE+$?))
+ check_shaded_artifacts_s3_fs hadoop
+ EXIT_CODE=$(($EXIT_CODE+$?))
+ check_shaded_artifacts_s3_fs presto
+ EXIT_CODE=$(($EXIT_CODE+$?))
+ check_shaded_artifacts_connector_elasticsearch ""
+ EXIT_CODE=$(($EXIT_CODE+$?))
+ check_shaded_artifacts_connector_elasticsearch 2
+ EXIT_CODE=$(($EXIT_CODE+$?))
+ check_shaded_artifacts_connector_elasticsearch 5
+ EXIT_CODE=$(($EXIT_CODE+$?))
+ else
+ echo "=============================================================================="
+ echo "Previous build failure detected, skipping shaded dependency check."
+ echo "=============================================================================="
+ fi
+
+ if [ $EXIT_CODE == 0 ]; then
+ echo "Creating cache build directory $CACHE_FLINK_DIR"
+ mkdir -p "$CACHE_FLINK_DIR"
+
+ cp -r . "$CACHE_FLINK_DIR"
+
+ function minimizeCachedFiles() {
+ # reduces the size of the cached directory to speed up
+ # the packing&upload / download&unpacking process
+ # by removing files not required for subsequent stages
+
+ # original jars
+ find "$CACHE_FLINK_DIR" -maxdepth 8 -type f -name 'original-*.jar' | xargs rm -rf
+
+ # .git directory
+ # not deleting this can cause build stability issues
+ # merging the cached version sometimes fails
+ rm -rf "$CACHE_FLINK_DIR/.git"
+ }
+
+ start_fold "minimize_cache" "Minimizing cache"
+ travis_time_start
+ minimizeCachedFiles
+ travis_time_finish
+ end_fold "minimize_cache"
+ else
+ echo "=============================================================================="
+ echo "Previous build failure detected, skipping cache setup."
+ echo "=============================================================================="
+ fi
+elif [ $STAGE != "$STAGE_CLEANUP" ]; then
+ if ! [ -e $CACHE_FLINK_DIR ]; then
+ echo "Cached flink dir $CACHE_FLINK_DIR does not exist. Exiting build."
+ exit 1
+ fi
+ # merged compiled flink into local clone
+ # this prevents the cache from being re-uploaded
+ start_fold "merge_cache" "Merging cache"
+ travis_time_start
+ cp -RT "$CACHE_FLINK_DIR" "."
+ travis_time_finish
+ end_fold "merge_cache"
+
+ start_fold "adjust_timestamps" "Adjusting timestamps"
+ travis_time_start
+ # adjust timestamps to prevent recompilation
+ find . -type f -name '*.java' | xargs touch
+ find . -type f -name '*.scala' | xargs touch
+ find . -type f -name '*.class' | xargs touch
+ find . -type f -name '*.timestamp' | xargs touch
+ travis_time_finish
+ end_fold "adjust_timestamps"
+
+ TEST="$STAGE" "./tools/travis_mvn_watchdog.sh" 300
+ EXIT_CODE=$?
+else
+ echo "Cleaning up $CACHE_BUILD_DIR"
+ rm -rf "$CACHE_BUILD_DIR"
+fi
+
+# Exit code for Travis build success/failure
+exit $EXIT_CODE