Merge pull request #1692 from thaJeztah/remove_bashisms

Remove some bashisms
This commit is contained in:
Tibor Vass 2019-03-21 16:17:49 -07:00 committed by GitHub
commit 086df60bab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 23 deletions

View File

@ -21,7 +21,7 @@ jobs=(
# each container has access to two cores.
group=${CROSS_GROUP-"all"}
if [ "$group" == "all" ]; then
if [ "$group" = "all" ]; then
echo "Building binaries for all platforms"
parallel ::: "${jobs[@]}"

View File

@ -14,7 +14,7 @@ RESOURCES=$SCRIPTDIR/../winresources
TEMPDIR=$(mktemp -d)
trap 'rm -rf $TEMPDIR' EXIT
if [ "$(go env GOHOSTOS)" == "windows" ]; then
if [ "$(go env GOHOSTOS)" = "windows" ]; then
WINDRES=windres
else
# Cross compiling
@ -22,7 +22,7 @@ else
fi
# Generate a Windows file version of the form major,minor,patch,build (with any part optional)
VERSION_QUAD=$(echo -n "$VERSION" | sed -re 's/^([0-9.]*).*$/\1/' | tr . ,)
VERSION_QUAD=$(printf "%s" "$VERSION" | sed -re 's/^([0-9.]*).*$/\1/' | tr . ,)
# Pass version and commit information into the resource compiler
defs=
@ -30,7 +30,7 @@ defs=
[ -n "$VERSION_QUAD" ] && defs+=( "-D DOCKER_VERSION_QUAD=$VERSION_QUAD")
[ -n "$GITCOMMIT" ] && defs+=( "-D DOCKER_COMMIT=\"$GITCOMMIT\"")
function makeres {
makeres() {
"$WINDRES" \
-i "$RESOURCES/$1" \
-o "$3" \

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -eu -o pipefail
if [[ -n "${REMOTE_DAEMON-}" ]]; then
if [ -n "${REMOTE_DAEMON-}" ]; then
# Run tests against a remote daemon.
./scripts/test/e2e/run fetch-images
./scripts/test/e2e/run test "${DOCKER_HOST-}"

View File

@ -8,16 +8,13 @@ alpine_dest=registry:5000/alpine:3.6
busybox_src=busybox@sha256:3e8fa85ddfef1af9ca85a5cfb714148956984e02f00bec3f7f49d3925a91e0e7
busybox_dest=registry:5000/busybox:1.27.2
function fetch_tag_image {
local src=$1
local dest=$2
docker pull "$src"
docker tag "$src" "$dest"
fetch_tag_image() {
docker pull "$1"
docker tag "$1" "$2"
}
function push_image {
local img=$1
docker push "$img"
push_image() {
docker push "$1"
}
cmd=${1-}

View File

@ -2,24 +2,24 @@
# Run integration tests against the latest docker-ce dind
set -eu -o pipefail
function container_ip {
container_ip() {
local cid=$1
local network=$2
docker inspect \
-f "{{.NetworkSettings.Networks.${network}.IPAddress}}" "$cid"
}
function fetch_images {
fetch_images() {
./scripts/test/e2e/load-image fetch-only
}
function setup {
setup() {
local project=$1
local file=$2
test "${DOCKERD_EXPERIMENTAL:-0}" -eq "1" && file="${file}:./e2e/compose-env.experimental.yaml"
if [[ "${TEST_CONNHELPER:-}" = "ssh" ]];then
if [ "${TEST_CONNHELPER:-}" = "ssh" ];then
test ! -f "${HOME}/.ssh/id_rsa" && ssh-keygen -t rsa -C docker-e2e-dummy -N "" -f "${HOME}/.ssh/id_rsa" -q
grep "^StrictHostKeyChecking no" "${HOME}/.ssh/config" > /dev/null 2>&1 || echo "StrictHostKeyChecking no" > "${HOME}/.ssh/config"
TEST_CONNHELPER_SSH_ID_RSA_PUB=$(cat "${HOME}/.ssh/id_rsa.pub")
@ -34,7 +34,7 @@ function setup {
engine_ip="$(container_ip "${project}_engine_1" "$network")"
engine_host="tcp://$engine_ip:2375"
if [[ "${TEST_CONNHELPER:-}" = "ssh" ]];then
if [ "${TEST_CONNHELPER:-}" = "ssh" ];then
engine_host="ssh://penguin@${engine_ip}"
fi
(
@ -46,18 +46,18 @@ function setup {
echo "$engine_host"
}
function is_swarm_enabled {
is_swarm_enabled() {
docker info 2> /dev/null | grep -q 'Swarm: active'
}
function cleanup {
cleanup() {
local project=$1
local network="${project}_default"
docker network disconnect "$network" "$(hostname)"
COMPOSE_PROJECT_NAME=$1 COMPOSE_FILE=$2 docker-compose down -v --rmi local >&2
}
function runtests {
runtests() {
local engine_host=$1
# shellcheck disable=SC2086
@ -94,7 +94,7 @@ case "$cmd" in
;;
test)
engine_host=${2-}
if [[ -z "${engine_host}" ]]; then
if [ -z "${engine_host}" ]; then
echo "missing parameter docker engine host"
echo "Usage: $0 test ENGINE_HOST"
exit 3

View File

@ -6,7 +6,7 @@ engine_host=$(./scripts/test/e2e/run setup)
testexit=0
test_cmd="test"
if [[ -n "${TEST_DEBUG-}" ]]; then
if [ -n "${TEST_DEBUG-}" ]; then
test_cmd="shell"
fi