This is an automated email from the ASF dual-hosted git repository.
garren pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb-fauxton.git
The following commit(s) were added to refs/heads/master by this push:
new f9d62f1 Retry docker:up a few times in case of failure (#1005)
f9d62f1 is described below
commit f9d62f1a7ca9313467e595109a588ebbab0ad37e
Author: Antonio Maranhao <30349380+Antonio-Maranhao@users.noreply.github.com>
AuthorDate: Tue Oct 24 04:05:15 2017 -0400
Retry docker:up a few times in case of failure (#1005)
* Retry docker:up a few times in case of failure
---
.travis.yml | 6 +----
bin/docker-up-and-check.sh | 62 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+), 5 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 7eccf52..16e203d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,18 +8,14 @@ git:
depth: 1
before_script:
- - npm run docker:up
+ - travis_retry ./bin/docker-up-and-check.sh
- npm install
- - docker logs couchdb
- - docker logs selenium
- curl http://127.0.0.1:5984
- npm run stylecheck
- npm test
- grunt debugDev
- DIST=./dist/debug ./bin/fauxton &
- sleep 30
- - docker logs couchdb
- - curl http://127.0.0.1:5984
script:
- travis_retry ./node_modules/.bin/grunt nightwatch
after_script:
diff --git a/bin/docker-up-and-check.sh b/bin/docker-up-and-check.sh
new file mode 100755
index 0000000..7d69859
--- /dev/null
+++ b/bin/docker-up-and-check.sh
@@ -0,0 +1,62 @@
+#!/bin/bash
+
+# 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.
+
+
+## Sometimes the couchdb docker container won't start correctly, which causes
+## the Travis build to fail and forces users to resubmit their PRs.
+## This script tries to minimize the issue by retrying to start the containers
+## in case of failure.
+
+
+start_containters_and_check() {
+ npm run docker:up
+ if [[ $? != 0 ]]; then exit $?; fi
+
+ # Uses docker logs to check if couchdb server has started
+ NUM_CHECKS=10
+ for ((check=1; check<=$NUM_CHECKS; check++));
+ do
+ echo "Checking if couchdb container has started ($check of $NUM_CHECKS)"
+ logs=$(docker logs couchdb)
+ if [[ $logs == *"Errno socket error"* ]]; then
+ echo "Failed to start couchdb container"
+ echo "=============================="
+ docker logs couchdb
+ echo "=============================="
+ return 1
+ fi
+ if [[ $logs == *"Developers cluster is set up"* ]]; then
+ echo "Docker containers are up"
+ echo "========================"
+ docker logs couchdb
+ echo "========================"
+ return 0
+ fi
+ sleep 6
+ done
+}
+
+stop_containters() {
+ npm run docker:down
+ sleep 2
+}
+
+
+if start_containters_and_check
+then
+ exit 0
+fi
+
+stop_containters
+exit 2
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
['"commits@couchdb.apache.org" <commits@couchdb.apache.org>'].
|