This is an automated email from the ASF dual-hosted git repository.
ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-pack.git
The following commit(s) were added to refs/heads/master by this push:
new 3e3cf17 SCB-1542 fix Test build error with Alpha Server (#580)
3e3cf17 is described below
commit 3e3cf1746e64fb9a32b5984bdc5b48c4711df50f
Author: Daniel Qian <[email protected]>
AuthorDate: Fri Oct 25 16:49:30 2019 +0800
SCB-1542 fix Test build error with Alpha Server (#580)
* SCB-1542 fix Test build error with Alpha Server
* SCB-1542 fix LICENSE issue
* SCB-1542 fix LICENSE issue again
---
LICENSE | 8 ++++
docker-build-config/assembly/assembly.xml | 6 +++
docker-build-config/docker-entrypoint.sh | 2 +-
docker-build-config/pom.xml | 3 +-
docker-build-config/wait-for | 79 +++++++++++++++++++++++++++++++
5 files changed, 95 insertions(+), 3 deletions(-)
diff --git a/LICENSE b/LICENSE
index b911910..811ef56 100644
--- a/LICENSE
+++ b/LICENSE
@@ -206,4 +206,12 @@ For web/src/main/java/resources/saga-frontend
This product bundles ngx-admin libraries which is licensed under the
MIT license.
For details, see https://github.com/akveo/ngx-admin
+================================================================
+For docker-build-config
+================================================================
+This product bundles wait-for script which is licensed under the
+MIT license.
+For details, see https://github.com/eficode/wait-for
+
+* wait-for script (docker-build-config/wait-for -
https://github.com/eficode/wait-for)
================================================================
\ No newline at end of file
diff --git a/docker-build-config/assembly/assembly.xml
b/docker-build-config/assembly/assembly.xml
index e8e6557..7b4e3de 100644
--- a/docker-build-config/assembly/assembly.xml
+++ b/docker-build-config/assembly/assembly.xml
@@ -46,5 +46,11 @@
<fileMode>0755</fileMode>
<filtered>true</filtered>
</file>
+ <file>
+ <source>${root.basedir}/docker-build-config/wait-for</source>
+ <outputDirectory>saga</outputDirectory>
+ <fileMode>0755</fileMode>
+ <filtered>true</filtered>
+ </file>
</files>
</assembly>
diff --git a/docker-build-config/docker-entrypoint.sh
b/docker-build-config/docker-entrypoint.sh
old mode 100644
new mode 100755
index bd4ae72..19f7558
--- a/docker-build-config/docker-entrypoint.sh
+++ b/docker-build-config/docker-entrypoint.sh
@@ -22,7 +22,7 @@ wait_for_services() {
port=$(printf "%s\n" "$svc"| cut -d : -f 2)
timeout=$(printf "%s\n" "$svc"| cut -d : -f 3)
echo "Waiting for service $host:$port(timeout: $timeout seconds) ready"
- /wait-for $host:$port -t $timeout
+ /maven/saga/wait-for $host:$port -t $timeout
result=$?
if [ $result -eq 0 ] ; then
echo "Service $host:$port is ready"
diff --git a/docker-build-config/pom.xml b/docker-build-config/pom.xml
index df12d8d..7d66bdf 100644
--- a/docker-build-config/pom.xml
+++ b/docker-build-config/pom.xml
@@ -51,8 +51,7 @@
</descriptor>
</assembly>
<runCmds>
- <run>wget -O /wait-for
https://raw.githubusercontent.com/eficode/wait-for/master/wait-for</run>
- <run>chmod +x /wait-for</run>
+ <run>chmod +x /maven/saga/wait-for</run>
</runCmds>
<entryPoint>
<shell>/maven/saga/docker-entrypoint.sh</shell>
diff --git a/docker-build-config/wait-for b/docker-build-config/wait-for
new file mode 100755
index 0000000..ddfc39e
--- /dev/null
+++ b/docker-build-config/wait-for
@@ -0,0 +1,79 @@
+#!/bin/sh
+
+TIMEOUT=15
+QUIET=0
+
+echoerr() {
+ if [ "$QUIET" -ne 1 ]; then printf "%s\n" "$*" 1>&2; fi
+}
+
+usage() {
+ exitcode="$1"
+ cat << USAGE >&2
+Usage:
+ $cmdname host:port [-t timeout] [-- command args]
+ -q | --quiet Do not output any status messages
+ -t TIMEOUT | --timeout=timeout Timeout in seconds, zero for no timeout
+ -- COMMAND ARGS Execute command with args after the test
finishes
+USAGE
+ exit "$exitcode"
+}
+
+wait_for() {
+ for i in `seq $TIMEOUT` ; do
+ nc -z "$HOST" "$PORT" > /dev/null 2>&1
+
+ result=$?
+ if [ $result -eq 0 ] ; then
+ if [ $# -gt 0 ] ; then
+ exec "$@"
+ fi
+ exit 0
+ fi
+ sleep 1
+ done
+ echo "Operation timed out" >&2
+ exit 1
+}
+
+while [ $# -gt 0 ]
+do
+ case "$1" in
+ *:* )
+ HOST=$(printf "%s\n" "$1"| cut -d : -f 1)
+ PORT=$(printf "%s\n" "$1"| cut -d : -f 2)
+ shift 1
+ ;;
+ -q | --quiet)
+ QUIET=1
+ shift 1
+ ;;
+ -t)
+ TIMEOUT="$2"
+ if [ "$TIMEOUT" = "" ]; then break; fi
+ shift 2
+ ;;
+ --timeout=*)
+ TIMEOUT="${1#*=}"
+ shift 1
+ ;;
+ --)
+ shift
+ break
+ ;;
+ --help)
+ usage 0
+ ;;
+ *)
+ echoerr "Unknown argument: $1"
+ usage 1
+ ;;
+ esac
+done
+
+if [ "$HOST" = "" -o "$PORT" = "" ]; then
+ echoerr "Error: you need to provide a host and port to test."
+ usage 2
+fi
+
+wait_for "$@"