diff --git a/.travis/build-site.sh b/.travis/build-site.sh index 79152e594f..2e7ec21db2 100644 --- a/.travis/build-site.sh +++ b/.travis/build-site.sh @@ -16,11 +16,11 @@ fi # Run the build, truncate output due to Travis log limits echo -e "\n\nExecuting ./mvnw install...\n\n" - travis_wait ./mvnw install -DskipTests=true -B -V | tail -100 + travis_wait_truncated ./mvnw install -DskipTests=true -B -V echo -e "Finished executing ./mvnw install\n\n" echo -e "\n\nExecuting ./mvnw site site:stage...\n\n" - travis_wait ./mvnw site site:stage -Psite -B -V | tail -100 + travis_wait_truncated ./mvnw site site:stage -Psite -B -V echo -e "Finished executing ./mvnw site site:stage...\n\n" ) @@ -39,6 +39,6 @@ fi ( if [[ "$VERSION" == *-SNAPSHOT && "$TRAVIS_BRANCH" == "master" ]]; then echo -e "\n\nUploading snapshot site...\n\n" - travis_wait rsync -ah --stats --delete target/pmd-doc-${VERSION}/ ${PMD_SF_USER}@web.sourceforge.net:/home/project-web/pmd/htdocs/snapshot/ | tail -100 + travis_wait_truncated rsync -ah --stats --delete target/pmd-doc-${VERSION}/ ${PMD_SF_USER}@web.sourceforge.net:/home/project-web/pmd/htdocs/snapshot/ fi ) diff --git a/.travis/build-sonar.sh b/.travis/build-sonar.sh index 60b4003e23..c38999bea0 100644 --- a/.travis/build-sonar.sh +++ b/.travis/build-sonar.sh @@ -13,5 +13,5 @@ fi # Run the build, truncate output due to Travis log limits -travis_wait ./mvnw clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar -Dsonar.host.url=https://sonarqube.com -Dsonar.login=${SONAR_TOKEN} -B -V | tail -100 +travis_wait_truncated ./mvnw clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar -Dsonar.host.url=https://sonarqube.com -Dsonar.login=${SONAR_TOKEN} -B -V diff --git a/.travis/common-functions.sh b/.travis/common-functions.sh index 6e9c9a8e26..896d0655aa 100644 --- a/.travis/common-functions.sh +++ b/.travis/common-functions.sh @@ -27,3 +27,18 @@ function travis_isPush() { return 1 fi } + +# +# Since travis_wait outputs the "Still running" indication into the +# same stream as the command's output, we need to make sure, we +# output these indications to avoid a build timeout. +# But to workaround the log size limit, we shouldn't output everything. +# travis_wait_truncated now outputs the head immediately, while +# only outputting the tail of the log after the command is finished. +# +function travis_wait_truncated() { + local log=$(tempfile) + travis_wait "$@" | tee $log | head -100 + tail -100 $log + rm -f $log +} \ No newline at end of file