diff --git a/scripts/build/cross b/scripts/build/cross index 919390dff3..51c22c3607 100755 --- a/scripts/build/cross +++ b/scripts/build/cross @@ -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[@]}" diff --git a/scripts/gen/windows-resources b/scripts/gen/windows-resources index 5fdc1b4ade..66d20f396a 100755 --- a/scripts/gen/windows-resources +++ b/scripts/gen/windows-resources @@ -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" \ diff --git a/scripts/test/e2e/entry b/scripts/test/e2e/entry index bbd1d3dd8f..98500fc070 100755 --- a/scripts/test/e2e/entry +++ b/scripts/test/e2e/entry @@ -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-}" diff --git a/scripts/test/e2e/load-image b/scripts/test/e2e/load-image index 8aa56489ef..5245a211d1 100755 --- a/scripts/test/e2e/load-image +++ b/scripts/test/e2e/load-image @@ -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-} diff --git a/scripts/test/e2e/run b/scripts/test/e2e/run index 7f689b0ede..a9c5cc2683 100755 --- a/scripts/test/e2e/run +++ b/scripts/test/e2e/run @@ -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 diff --git a/scripts/test/e2e/wrapper b/scripts/test/e2e/wrapper index 9e0342918c..5e2992506e 100755 --- a/scripts/test/e2e/wrapper +++ b/scripts/test/e2e/wrapper @@ -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