Repository: zeppelin
Updated Branches:
  refs/heads/master ce97b5343 -> a716308ce


[ZEPPELIN-2230] clear bower_contents if bower.json changed

### What is this PR for?
Before travis build:
* check if any bower.json file is part of the commit range
* check if any commit message of the commit range contains "bower clear" or 
"clear bower"
* If one of the above, clear bower_components, npm cache clear
This should prevent breaking the build when upgrading a js lib.

### What type of PR is it?
Improvement

### Todos
* [ ] - Task

### What is the Jira issue?
[ZEPPELIN-2230](https://issues.apache.org/jira/browse/ZEPPELIN-2230)

### How should this be tested?

1. Using this version of .travis.yml, build the project once. (e.g. with nvd3 
1.7.1)
2. then modify a version of js lib (e.g. nvd3), rebuild.
3. Verify the build goes through, check the build log for the message "Clearing 
bower_components cache".
4. Rebuild, without changing a version, but putting "bower clean" in a commit 
message.
5. Same as 3.

### Screenshots (if appropriate)

### Questions:
* Does the licenses files need update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? Maybe for the "bower clear" trigger.

Author: Remilito <remy.ga...@gmail.com>

Closes #2111 from Remilito/ZEPPELIN-2230b and squashes the following commits:

cb9647f [Remilito] [ZEPPELIN-2230] clear bower_contents if bower.json changed 
or bower clear provided in commit message


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

Branch: refs/heads/master
Commit: a716308ce07cc09106048464f5f76711f9b31dfb
Parents: ce97b53
Author: Remilito <remy.ga...@gmail.com>
Authored: Tue Mar 7 18:32:12 2017 +0100
Committer: ahyoungryu <ahyoung...@apache.org>
Committed: Sat Mar 11 21:51:16 2017 +0900

----------------------------------------------------------------------
 .travis.yml | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/a716308c/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index ab4e8f6..f34cdd8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -25,6 +25,7 @@ cache:
     - ${HOME}/R
     -  zeppelin-web/node
     -  zeppelin-web/node_modules
+    -  zeppelin-web/bower_components
 
 addons:
   apt:
@@ -70,6 +71,13 @@ matrix:
       env: PYTHON="3" SCALA_VER="2.11" SPARK_VER="2.0.0" HADOOP_VER="2.6" 
PROFILE="-Pspark-2.0 -Phadoop-2.6 -Ppyspark -Pscala-2.11" BUILD_FLAG="package 
-pl spark,python -am -DskipTests -DskipRat" TEST_FLAG="test -DskipRat" 
MODULES="-pl 
zeppelin-interpreter,zeppelin-display,spark-dependencies,spark,python" 
TEST_PROJECTS="-Dtest=org.apache.zeppelin.spark.PySpark*Test,org.apache.zeppelin.python.*
 -Dpyspark.test.exclude='' -DfailIfNoTests=false"
 
 before_install:
+  # check files included in commit range, clear bower_components if a 
bower.json file has changed.
+  # bower cache clearing can also be forced by putting "bower clear" or "clear 
bower" in a commit message
+  - changedfiles=$(git diff --name-only $TRAVIS_COMMIT_RANGE)
+  - echo $changedfiles
+  - hasbowerchanged=$(echo $changedfiles | grep -c "bower.json" || true);
+  - clearcache=$(git log $TRAVIS_COMMIT_RANGE | grep -c -E "clear bower|bower 
clear" || true)
+  - if [ "$hasbowerchanged" -gt 0 ] || [ "$clearcache" -gt 0 ]; then echo 
"Clearing bower_components cache"; rm -r zeppelin-web/bower_components; npm 
cache clear; else echo "Using cached bower_components."; fi
   - echo "MAVEN_OPTS='-Xms1024M -Xmx2048M -XX:MaxPermSize=1024m 
-XX:-UseGCOverheadLimit -Dorg.slf4j.simpleLogger.defaultLogLevel=warn'" >> 
~/.mavenrc
   - ./testing/install_external_dependencies.sh
   - ls -la .spark-dist ${HOME}/.m2/repository/.cache/maven-download-plugin || 
true
@@ -110,4 +118,4 @@ after_failure:
   - cat livy/target/tmp/livy-int-test/*/output.log
   - ls -R 
livy/target/tmp/livy-int-test/MiniYarnMain/target/com.cloudera.livy.test.framework.MiniYarnMain/*
   - cat 
livy/target/tmp/livy-int-test/MiniYarnMain/target/com.cloudera.livy.test.framework.MiniYarnMain/*/*/*/stdout
-  - cat 
livy/target/tmp/livy-int-test/MiniYarnMain/target/com.cloudera.livy.test.framework.MiniYarnMain/*/*/*/stderr
\ No newline at end of file
+  - cat 
livy/target/tmp/livy-int-test/MiniYarnMain/target/com.cloudera.livy.test.framework.MiniYarnMain/*/*/*/stderr

Reply via email to