mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Revert "Bash scripts; use double brackets, fix bare variables, add quotes"
This reverts commit 297b30df5f
.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
3f2ecb5452
commit
c3650770cc
43 changed files with 144 additions and 143 deletions
|
@ -13,7 +13,7 @@ set -e
|
|||
# apparmor sucks and Docker needs to know that it's in a container (c) @tianon
|
||||
export container=docker
|
||||
|
||||
if [[ -d /sys/kernel/security ]] && ! mountpoint -q /sys/kernel/security; then
|
||||
if [ -d /sys/kernel/security ] && ! mountpoint -q /sys/kernel/security; then
|
||||
mount -t securityfs none /sys/kernel/security || {
|
||||
echo >&2 'Could not mount /sys/kernel/security.'
|
||||
echo >&2 'AppArmor detection and --privileged mode might break.'
|
||||
|
@ -25,7 +25,7 @@ if ! mountpoint -q /tmp; then
|
|||
mount -t tmpfs none /tmp
|
||||
fi
|
||||
|
||||
if [[ $# -gt 0 ]]; then
|
||||
if [ $# -gt 0 ]; then
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
|
|
|
@ -28,9 +28,9 @@ install_containerd() {
|
|||
make
|
||||
)
|
||||
|
||||
mkdir -p "${PREFIX}"
|
||||
mkdir -p ${PREFIX}
|
||||
|
||||
cp bin/containerd "${PREFIX}/containerd"
|
||||
cp bin/containerd-shim "${PREFIX}/containerd-shim"
|
||||
cp bin/ctr "${PREFIX}/ctr"
|
||||
cp bin/containerd ${PREFIX}/containerd
|
||||
cp bin/containerd-shim ${PREFIX}/containerd-shim
|
||||
cp bin/ctr ${PREFIX}/ctr
|
||||
}
|
||||
|
|
|
@ -8,13 +8,14 @@ install_dockercli() {
|
|||
|
||||
arch=$(uname -m)
|
||||
# No official release of these platforms
|
||||
if [ "$arch" != "x86_64" ] && [ "$arch" != "s390x" ]; then
|
||||
if [[ "$arch" != "x86_64" ]] && [[ "$arch" != "s390x" ]]; then
|
||||
build_dockercli
|
||||
return
|
||||
fi
|
||||
|
||||
url=https://download.docker.com/linux/static
|
||||
curl -Ls "${url}/${DOCKERCLI_CHANNEL}/${arch}/docker-${DOCKERCLI_VERSION}.tgz" | tar -xz docker/docker
|
||||
curl -Ls $url/$DOCKERCLI_CHANNEL/$arch/docker-$DOCKERCLI_VERSION.tgz | \
|
||||
tar -xz docker/docker
|
||||
mkdir -p ${PREFIX}
|
||||
mv docker/docker ${PREFIX}/
|
||||
rmdir docker
|
||||
|
@ -26,5 +27,5 @@ build_dockercli() {
|
|||
git checkout -q "v$DOCKERCLI_VERSION"
|
||||
mkdir -p "$GOPATH/src/github.com/docker"
|
||||
mv components/cli "$GOPATH/src/github.com/docker/cli"
|
||||
go build -buildmode=pie -o "${PREFIX}/docker" "github.com/docker/cli/cmd/docker"
|
||||
go build -buildmode=pie -o ${PREFIX}/docker github.com/docker/cli/cmd/docker
|
||||
}
|
||||
|
|
|
@ -7,6 +7,6 @@ install_gometalinter() {
|
|||
go get -d github.com/alecthomas/gometalinter
|
||||
cd "$GOPATH/src/github.com/alecthomas/gometalinter"
|
||||
git checkout -q "$GOMETALINTER_COMMIT"
|
||||
go build -buildmode=pie -o "${PREFIX}/gometalinter" "github.com/alecthomas/gometalinter"
|
||||
GOBIN=${PREFIX} "${PREFIX}/gometalinter" --install
|
||||
go build -buildmode=pie -o ${PREFIX}/gometalinter github.com/alecthomas/gometalinter
|
||||
GOBIN=${PREFIX} ${PREFIX}/gometalinter --install
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ TMP_GOPATH=${TMP_GOPATH:-""}
|
|||
|
||||
: ${PREFIX:="/usr/local/bin"}
|
||||
|
||||
if [[ -z "$TMP_GOPATH" ]]; then
|
||||
if [ -z "$TMP_GOPATH" ]; then
|
||||
export GOPATH="$(mktemp -d)"
|
||||
RM_GOPATH=1
|
||||
else
|
||||
|
@ -21,10 +21,10 @@ dir="$(dirname $0)"
|
|||
bin=$1
|
||||
shift
|
||||
|
||||
if [[ ! -f "${dir}/${bin}.installer" ]]; then
|
||||
if [ ! -f "${dir}/${bin}.installer" ]; then
|
||||
echo "Could not find installer for \"$bin\""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
. ${dir}/${bin}.installer
|
||||
install_${bin} "$@"
|
||||
. $dir/$bin.installer
|
||||
install_$bin "$@"
|
||||
|
|
|
@ -32,7 +32,7 @@ _install_proxy() {
|
|||
git clone https://github.com/docker/libnetwork.git "$GOPATH/src/github.com/docker/libnetwork"
|
||||
cd "$GOPATH/src/github.com/docker/libnetwork"
|
||||
git checkout -q "$LIBNETWORK_COMMIT"
|
||||
go build ${BUILD_MODE} -ldflags="$PROXY_LDFLAGS" -o ${PREFIX}/docker-proxy github.com/docker/libnetwork/cmd/proxy
|
||||
go build $BUILD_MODE -ldflags="$PROXY_LDFLAGS" -o ${PREFIX}/docker-proxy github.com/docker/libnetwork/cmd/proxy
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -25,6 +25,6 @@ install_runc() {
|
|||
target="$1"
|
||||
fi
|
||||
make BUILDTAGS="$RUNC_BUILDTAGS" "$target"
|
||||
mkdir -p "${PREFIX}"
|
||||
cp runc "${PREFIX}/runc"
|
||||
mkdir -p ${PREFIX}
|
||||
cp runc ${PREFIX}/runc
|
||||
}
|
||||
|
|
|
@ -9,6 +9,6 @@ install_tini() {
|
|||
git checkout -q "$TINI_COMMIT"
|
||||
cmake .
|
||||
make tini-static
|
||||
mkdir -p "${PREFIX}"
|
||||
cp tini-static "${PREFIX}/docker-init"
|
||||
mkdir -p ${PREFIX}
|
||||
cp tini-static ${PREFIX}/docker-init
|
||||
}
|
||||
|
|
|
@ -8,5 +8,5 @@ install_tomlv() {
|
|||
echo "Install tomlv version $TOMLV_COMMIT"
|
||||
git clone https://github.com/BurntSushi/toml.git "$GOPATH/src/github.com/BurntSushi/toml"
|
||||
cd "$GOPATH/src/github.com/BurntSushi/toml" && git checkout -q "$TOMLV_COMMIT"
|
||||
go build -v -buildmode=pie -o "${PREFIX}/tomlv" "github.com/BurntSushi/toml/cmd/tomlv"
|
||||
go build -v -buildmode=pie -o ${PREFIX}/tomlv github.com/BurntSushi/toml/cmd/tomlv
|
||||
}
|
||||
|
|
|
@ -7,5 +7,5 @@ install_vndr() {
|
|||
git clone https://github.com/LK4D4/vndr.git "$GOPATH/src/github.com/LK4D4/vndr"
|
||||
cd "$GOPATH/src/github.com/LK4D4/vndr"
|
||||
git checkout -q "$VNDR_COMMIT"
|
||||
go build -buildmode=pie -v -o "${PREFIX}/vndr" .
|
||||
go build -buildmode=pie -v -o ${PREFIX}/vndr .
|
||||
}
|
||||
|
|
32
hack/make.sh
32
hack/make.sh
|
@ -31,17 +31,17 @@ export PKG_CONFIG=${PKG_CONFIG:-pkg-config}
|
|||
# We're a nice, sexy, little shell script, and people might try to run us;
|
||||
# but really, they shouldn't. We want to be in a container!
|
||||
inContainer="AssumeSoInitially"
|
||||
if [[ "$(go env GOHOSTOS)" = 'windows' ]]; then
|
||||
if [[ -z "$FROM_DOCKERFILE" ]]; then
|
||||
if [ "$(go env GOHOSTOS)" = 'windows' ]; then
|
||||
if [ -z "$FROM_DOCKERFILE" ]; then
|
||||
unset inContainer
|
||||
fi
|
||||
else
|
||||
if [[ "$PWD" != "/go/src/$DOCKER_PKG" ]]; then
|
||||
if [ "$PWD" != "/go/src/$DOCKER_PKG" ]; then
|
||||
unset inContainer
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -z "$inContainer" ]]; then
|
||||
if [ -z "$inContainer" ]; then
|
||||
{
|
||||
echo "# WARNING! I don't seem to be running in a Docker container."
|
||||
echo "# The result of this command might be an incorrect build, and will not be"
|
||||
|
@ -67,11 +67,11 @@ DEFAULT_BUNDLES=(
|
|||
|
||||
VERSION=${VERSION:-dev}
|
||||
! BUILDTIME=$(date -u -d "@${SOURCE_DATE_EPOCH:-$(date +%s)}" --rfc-3339 ns 2> /dev/null | sed -e 's/ /T/')
|
||||
if [[ "$DOCKER_GITCOMMIT" ]]; then
|
||||
if [ "$DOCKER_GITCOMMIT" ]; then
|
||||
GITCOMMIT="$DOCKER_GITCOMMIT"
|
||||
elif command -v git &> /dev/null && [ -e .git ] && git rev-parse &> /dev/null; then
|
||||
GITCOMMIT=$(git rev-parse --short HEAD)
|
||||
if [[ -n "$(git status --porcelain --untracked-files=no)" ]]; then
|
||||
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
|
||||
GITCOMMIT="$GITCOMMIT-unsupported"
|
||||
echo "#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
||||
echo "# GITCOMMIT = $GITCOMMIT"
|
||||
|
@ -90,14 +90,14 @@ else
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$AUTO_GOPATH" ]]; then
|
||||
if [ "$AUTO_GOPATH" ]; then
|
||||
rm -rf .gopath
|
||||
mkdir -p .gopath/src/"$(dirname "${DOCKER_PKG}")"
|
||||
ln -sf ../../../.. .gopath/src/"${DOCKER_PKG}"
|
||||
export GOPATH="${PWD}/.gopath"
|
||||
fi
|
||||
|
||||
if [[ ! "$GOPATH" ]]; then
|
||||
if [ ! "$GOPATH" ]; then
|
||||
echo >&2 'error: missing GOPATH; please see https://golang.org/doc/code.html#GOPATH'
|
||||
echo >&2 ' alternatively, set AUTO_GOPATH=1'
|
||||
exit 1
|
||||
|
@ -137,7 +137,7 @@ fi
|
|||
# Use these flags when compiling the tests and final binary
|
||||
|
||||
IAMSTATIC='true'
|
||||
if [[ -z "$DOCKER_DEBUG" ]]; then
|
||||
if [ -z "$DOCKER_DEBUG" ]; then
|
||||
LDFLAGS='-w'
|
||||
fi
|
||||
|
||||
|
@ -148,12 +148,12 @@ EXTLDFLAGS_STATIC='-static'
|
|||
ORIG_BUILDFLAGS=( -tags "autogen netgo osusergo static_build $DOCKER_BUILDTAGS" -installsuffix netgo )
|
||||
# see https://github.com/golang/go/issues/9369#issuecomment-69864440 for why -installsuffix is necessary here
|
||||
|
||||
BUILDFLAGS=( ${BUILDFLAGS} "${ORIG_BUILDFLAGS[@]}" )
|
||||
BUILDFLAGS=( $BUILDFLAGS "${ORIG_BUILDFLAGS[@]}" )
|
||||
|
||||
# Test timeout.
|
||||
if [[ "${DOCKER_ENGINE_GOARCH}" == "arm64" ]] || [[ "${DOCKER_ENGINE_GOARCH}" == "arm" ]]; then
|
||||
if [ "${DOCKER_ENGINE_GOARCH}" == "arm64" ] || [ "${DOCKER_ENGINE_GOARCH}" == "arm" ]; then
|
||||
: ${TIMEOUT:=10m}
|
||||
elif [[ "${DOCKER_ENGINE_GOARCH}" == "windows" ]]; then
|
||||
elif [ "${DOCKER_ENGINE_GOARCH}" == "windows" ]; then
|
||||
: ${TIMEOUT:=8m}
|
||||
else
|
||||
: ${TIMEOUT:=5m}
|
||||
|
@ -164,7 +164,7 @@ LDFLAGS_STATIC_DOCKER="
|
|||
-extldflags \"$EXTLDFLAGS_STATIC\"
|
||||
"
|
||||
|
||||
if [[ "$(uname -s)" = 'FreeBSD' ]]; then
|
||||
if [ "$(uname -s)" = 'FreeBSD' ]; then
|
||||
# Tell cgo the compiler is Clang, not GCC
|
||||
# https://code.google.com/p/go/source/browse/src/cmd/cgo/gcc.go?spec=svne77e74371f2340ee08622ce602e9f7b15f29d8d3&r=e6794866ebeba2bf8818b9261b54e2eef1c9e588#752
|
||||
export CC=clang
|
||||
|
@ -181,7 +181,7 @@ bundle() {
|
|||
}
|
||||
|
||||
main() {
|
||||
if [[ -z "${KEEPBUNDLE-}" ]]; then
|
||||
if [ -z "${KEEPBUNDLE-}" ]; then
|
||||
echo "Removing bundles/"
|
||||
rm -rf "bundles/*"
|
||||
echo
|
||||
|
@ -189,13 +189,13 @@ main() {
|
|||
mkdir -p bundles
|
||||
|
||||
# Windows and symlinks don't get along well
|
||||
if [[ "$(go env GOHOSTOS)" != 'windows' ]]; then
|
||||
if [ "$(go env GOHOSTOS)" != 'windows' ]; then
|
||||
rm -f bundles/latest
|
||||
# preserve latest symlink for backward compatibility
|
||||
ln -sf . bundles/latest
|
||||
fi
|
||||
|
||||
if [[ $# -lt 1 ]]; then
|
||||
if [ $# -lt 1 ]; then
|
||||
bundles=(${DEFAULT_BUNDLES[@]})
|
||||
else
|
||||
bundles=($@)
|
||||
|
|
|
@ -3,7 +3,7 @@ set -e
|
|||
|
||||
# a helper to provide ".exe" when it's appropriate
|
||||
binary_extension() {
|
||||
if [[ "$(go env GOOS)" = 'windows' ]]; then
|
||||
if [ "$(go env GOOS)" = 'windows' ]; then
|
||||
echo -n '.exe'
|
||||
fi
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ BINARY_FULLNAME="$BINARY_NAME$BINARY_EXTENSION"
|
|||
source "${MAKEDIR}/.go-autogen"
|
||||
|
||||
hash_files() {
|
||||
while [[ $# -gt 0 ]]; do
|
||||
while [ $# -gt 0 ]; do
|
||||
f="$1"
|
||||
shift
|
||||
dir="$(dirname "$f")"
|
||||
|
@ -40,7 +40,7 @@ hash_files() {
|
|||
(
|
||||
export GOGC=${DOCKER_BUILD_GOGC:-1000}
|
||||
|
||||
if [[ "$(go env GOOS)/$(go env GOARCH)" != "$(go env GOHOSTOS)/$(go env GOHOSTARCH)" ]]; then
|
||||
if [ "$(go env GOOS)/$(go env GOARCH)" != "$(go env GOHOSTOS)/$(go env GOHOSTARCH)" ]; then
|
||||
# must be cross-compiling!
|
||||
case "$(go env GOOS)/$(go env GOARCH)" in
|
||||
windows/amd64)
|
||||
|
@ -68,7 +68,7 @@ go build \
|
|||
$LDFLAGS_STATIC_DOCKER
|
||||
$DOCKER_LDFLAGS
|
||||
" \
|
||||
${GO_PACKAGE}
|
||||
$GO_PACKAGE
|
||||
)
|
||||
|
||||
echo "Created binary: $DEST/$BINARY_FULLNAME"
|
||||
|
|
|
@ -36,7 +36,7 @@ DOCKER_CLIENT_GOARCH=${DOCKER_CLIENT_GOARCH:=amd64}
|
|||
|
||||
DOCKERFILE='Dockerfile'
|
||||
|
||||
if [[ "${DOCKER_ENGINE_GOOS:-$DOCKER_CLIENT_GOOS}" = "windows" ]]; then
|
||||
if [ "${DOCKER_ENGINE_GOOS:-$DOCKER_CLIENT_GOOS}" = "windows" ]; then
|
||||
DOCKERFILE='Dockerfile.windows'
|
||||
fi
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ if ! docker image inspect emptyfs > /dev/null; then
|
|||
tar -cf layer.tar --files-from /dev/null
|
||||
)
|
||||
(
|
||||
[[ -n "$TESTDEBUG" ]] && set -x
|
||||
[ -n "$TESTDEBUG" ] && set -x
|
||||
tar -cC "$dir" . | docker load
|
||||
)
|
||||
rm -rf "$dir"
|
||||
|
|
|
@ -43,7 +43,7 @@ const (
|
|||
DVEOF
|
||||
|
||||
# Compile the Windows resources into the sources
|
||||
if [[ "$(go env GOOS)" = "windows" ]]; then
|
||||
if [ "$(go env GOOS)" = "windows" ]; then
|
||||
mkdir -p autogen/winresources/tmp autogen/winresources/docker autogen/winresources/dockerd
|
||||
cp hack/make/.resources-windows/resources.go autogen/winresources/docker/
|
||||
cp hack/make/.resources-windows/resources.go autogen/winresources/dockerd/
|
||||
|
@ -62,12 +62,12 @@ if [[ "$(go env GOOS)" = "windows" ]]; then
|
|||
|
||||
# Pass version and commit information into the resource compiler
|
||||
defs=
|
||||
[[ ! -z $VERSION ]] && defs="$defs -D DOCKER_VERSION=\"$VERSION\""
|
||||
[[ ! -z $VERSION_QUAD ]] && defs="$defs -D DOCKER_VERSION_QUAD=$VERSION_QUAD"
|
||||
[[ ! -z $GITCOMMIT ]] && defs="$defs -D DOCKER_COMMIT=\"$GITCOMMIT\""
|
||||
[ ! -z $VERSION ] && defs="$defs -D DOCKER_VERSION=\"$VERSION\""
|
||||
[ ! -z $VERSION_QUAD ] && defs="$defs -D DOCKER_VERSION_QUAD=$VERSION_QUAD"
|
||||
[ ! -z $GITCOMMIT ] && defs="$defs -D DOCKER_COMMIT=\"$GITCOMMIT\""
|
||||
|
||||
function makeres {
|
||||
${WINDRES} \
|
||||
$WINDRES \
|
||||
-i hack/make/.resources-windows/$1 \
|
||||
-o $3 \
|
||||
-F $2 \
|
||||
|
@ -76,7 +76,7 @@ if [[ "$(go env GOOS)" = "windows" ]]; then
|
|||
$defs
|
||||
}
|
||||
|
||||
${WINDMC} \
|
||||
$WINDMC \
|
||||
hack/make/.resources-windows/event_messages.mc \
|
||||
-h autogen/winresources/tmp \
|
||||
-r autogen/winresources/tmp
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
set -e
|
||||
|
||||
source "$MAKEDIR/.detect-daemon-osarch"
|
||||
if [[ "$DOCKER_ENGINE_GOOS" != "windows" ]]; then
|
||||
if [ "$DOCKER_ENGINE_GOOS" != "windows" ]; then
|
||||
bundle .ensure-emptyfs
|
||||
fi
|
||||
|
|
|
@ -7,7 +7,7 @@ export PATH="$base/binary-daemon:$base/dynbinary-daemon:$PATH"
|
|||
|
||||
export TEST_CLIENT_BINARY=docker
|
||||
|
||||
if [[ -n "$DOCKER_CLI_PATH" ]]; then
|
||||
if [ -n "$DOCKER_CLI_PATH" ]; then
|
||||
export TEST_CLIENT_BINARY=/usr/local/cli/$(basename "$DOCKER_CLI_PATH")
|
||||
fi
|
||||
|
||||
|
@ -19,11 +19,11 @@ fi
|
|||
|
||||
# This is a temporary hack for split-binary mode. It can be removed once
|
||||
# https://github.com/docker/docker/pull/22134 is merged into docker master
|
||||
if [[ "$(go env GOOS)" = 'windows' ]]; then
|
||||
if [ "$(go env GOOS)" = 'windows' ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ -z "$DOCKER_TEST_HOST" ]]; then
|
||||
if [ -z "$DOCKER_TEST_HOST" ]; then
|
||||
if docker version &> /dev/null; then
|
||||
echo >&2 'skipping daemon start, since daemon appears to be already started'
|
||||
return
|
||||
|
@ -43,7 +43,7 @@ export DOCKER_USERLANDPROXY=${DOCKER_USERLANDPROXY:-true}
|
|||
|
||||
# example usage: DOCKER_STORAGE_OPTS="dm.basesize=20G,dm.loopdatasize=200G"
|
||||
storage_params=""
|
||||
if [[ -n "$DOCKER_STORAGE_OPTS" ]]; then
|
||||
if [ -n "$DOCKER_STORAGE_OPTS" ]; then
|
||||
IFS=','
|
||||
for i in ${DOCKER_STORAGE_OPTS}; do
|
||||
storage_params="--storage-opt $i $storage_params"
|
||||
|
@ -53,24 +53,24 @@ fi
|
|||
|
||||
# example usage: DOCKER_REMAP_ROOT=default
|
||||
extra_params=""
|
||||
if [[ "$DOCKER_REMAP_ROOT" ]]; then
|
||||
if [ "$DOCKER_REMAP_ROOT" ]; then
|
||||
extra_params="--userns-remap $DOCKER_REMAP_ROOT"
|
||||
fi
|
||||
|
||||
# example usage: DOCKER_EXPERIMENTAL=1
|
||||
if [[ "$DOCKER_EXPERIMENTAL" ]]; then
|
||||
if [ "$DOCKER_EXPERIMENTAL" ]; then
|
||||
echo >&2 '# DOCKER_EXPERIMENTAL is set: starting daemon with experimental features enabled! '
|
||||
extra_params="$extra_params --experimental"
|
||||
fi
|
||||
|
||||
if [[ -z "$DOCKER_TEST_HOST" ]]; then
|
||||
if [ -z "$DOCKER_TEST_HOST" ]; then
|
||||
# Start apparmor if it is enabled
|
||||
if [[ -e "/sys/module/apparmor/parameters/enabled" ]] && [[ "$(cat /sys/module/apparmor/parameters/enabled)" == "Y" ]]; then
|
||||
if [ -e "/sys/module/apparmor/parameters/enabled" ] && [ "$(cat /sys/module/apparmor/parameters/enabled)" == "Y" ]; then
|
||||
# reset container variable so apparmor profile is applied to process
|
||||
# see https://github.com/docker/libcontainer/blob/master/apparmor/apparmor.go#L16
|
||||
export container=""
|
||||
(
|
||||
[[ -n "$TESTDEBUG" ]] && set -x
|
||||
[ -n "$TESTDEBUG" ] && set -x
|
||||
/etc/init.d/apparmor start
|
||||
)
|
||||
fi
|
||||
|
@ -79,15 +79,15 @@ if [[ -z "$DOCKER_TEST_HOST" ]]; then
|
|||
export DOCKER_HOST="unix://$(cd "$DEST" && pwd)/docker.sock"
|
||||
(
|
||||
echo "Starting dockerd"
|
||||
[[ -n "$TESTDEBUG" ]] && set -x
|
||||
[ -n "$TESTDEBUG" ] && set -x
|
||||
exec \
|
||||
dockerd --debug \
|
||||
--host "$DOCKER_HOST" \
|
||||
--storage-driver "$DOCKER_GRAPHDRIVER" \
|
||||
--pidfile "$DEST/docker.pid" \
|
||||
--userland-proxy="$DOCKER_USERLANDPROXY" \
|
||||
${storage_params} \
|
||||
${extra_params} \
|
||||
$storage_params \
|
||||
$extra_params \
|
||||
&> "$DEST/docker.log"
|
||||
) &
|
||||
else
|
||||
|
@ -97,19 +97,19 @@ fi
|
|||
# give it a little time to come up so it's "ready"
|
||||
tries=60
|
||||
echo "INFO: Waiting for daemon to start..."
|
||||
while ! ${TEST_CLIENT_BINARY} version &> /dev/null; do
|
||||
while ! $TEST_CLIENT_BINARY version &> /dev/null; do
|
||||
(( tries-- ))
|
||||
if [[ $tries -le 0 ]]; then
|
||||
if [ $tries -le 0 ]; then
|
||||
printf "\n"
|
||||
if [[ -z "$DOCKER_HOST" ]]; then
|
||||
if [ -z "$DOCKER_HOST" ]; then
|
||||
echo >&2 "error: daemon failed to start"
|
||||
echo >&2 " check $DEST/docker.log for details"
|
||||
else
|
||||
echo >&2 "error: daemon at $DOCKER_HOST fails to '$TEST_CLIENT_BINARY version':"
|
||||
${TEST_CLIENT_BINARY} version >&2 || true
|
||||
$TEST_CLIENT_BINARY version >&2 || true
|
||||
# Additional Windows CI debugging as this is a common error as of
|
||||
# January 2016
|
||||
if [[ "$(go env GOOS)" = 'windows' ]]; then
|
||||
if [ "$(go env GOOS)" = 'windows' ]; then
|
||||
echo >&2 "Container log below:"
|
||||
echo >&2 "---"
|
||||
# Important - use the docker on the CI host, not the one built locally
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [[ ! "$(go env GOOS)" = 'windows' ]]; then
|
||||
if [ ! "$(go env GOOS)" = 'windows' ]; then
|
||||
for pidFile in $(find "$DEST" -name docker.pid); do
|
||||
pid=$([[ -n "$TESTDEBUG" ]] && set -x; cat "$pidFile")
|
||||
pid=$([ -n "$TESTDEBUG" ] && set -x; cat "$pidFile")
|
||||
(
|
||||
[[ -n "$TESTDEBUG" ]] && set -x
|
||||
[ -n "$TESTDEBUG" ] && set -x
|
||||
kill "$pid"
|
||||
)
|
||||
if ! wait "$pid"; then
|
||||
|
@ -12,11 +12,11 @@ if [[ ! "$(go env GOOS)" = 'windows' ]]; then
|
|||
fi
|
||||
done
|
||||
|
||||
if [[ -z "$DOCKER_TEST_HOST" ]]; then
|
||||
if [ -z "$DOCKER_TEST_HOST" ]; then
|
||||
# Stop apparmor if it is enabled
|
||||
if [[ -e "/sys/module/apparmor/parameters/enabled" ]] && [[ "$(cat /sys/module/apparmor/parameters/enabled)" == "Y" ]]; then
|
||||
if [ -e "/sys/module/apparmor/parameters/enabled" ] && [ "$(cat /sys/module/apparmor/parameters/enabled)" == "Y" ]; then
|
||||
(
|
||||
[[ -n "$TESTDEBUG" ]] && set -x
|
||||
[ -n "$TESTDEBUG" ] && set -x
|
||||
/etc/init.d/apparmor stop
|
||||
)
|
||||
fi
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#
|
||||
# TESTFLAGS='-check.f DockerSuite.TestBuild*' ./hack/make.sh binary test-integration
|
||||
#
|
||||
if [[ -z ${MAKEDIR} ]]; then
|
||||
if [ -z $MAKEDIR ]; then
|
||||
export MAKEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
fi
|
||||
source "$MAKEDIR/.go-autogen"
|
||||
|
@ -26,11 +26,11 @@ run_test_integration() {
|
|||
|
||||
run_test_integration_suites() {
|
||||
local flags="-test.v -test.timeout=${TIMEOUT} $TESTFLAGS"
|
||||
for dir in ${integration_api_dirs}; do
|
||||
for dir in $integration_api_dirs; do
|
||||
if ! (
|
||||
cd ${dir}
|
||||
cd $dir
|
||||
echo "Running $PWD"
|
||||
test_env ./test.main ${flags}
|
||||
test_env ./test.main $flags
|
||||
); then exit 1; fi
|
||||
done
|
||||
}
|
||||
|
@ -45,12 +45,12 @@ run_test_integration_legacy_suites() {
|
|||
}
|
||||
|
||||
build_test_suite_binaries() {
|
||||
if [[ ${DOCKER_INTEGRATION_TESTS_VERIFIED-} ]]; then
|
||||
if [ ${DOCKER_INTEGRATION_TESTS_VERIFIED-} ]; then
|
||||
echo "Skipping building test binaries; as DOCKER_INTEGRATION_TESTS_VERIFIED is set"
|
||||
return
|
||||
fi
|
||||
build_test_suite_binary ./integration-cli "test.main"
|
||||
for dir in ${integration_api_dirs}; do
|
||||
for dir in $integration_api_dirs; do
|
||||
build_test_suite_binary "$dir" "test.main"
|
||||
done
|
||||
}
|
||||
|
@ -64,13 +64,13 @@ build_test_suite_binary() {
|
|||
}
|
||||
|
||||
cleanup_test_suite_binaries() {
|
||||
[[ -n "$TESTDEBUG" ]] && return
|
||||
[ -n "$TESTDEBUG" ] && return
|
||||
echo "Removing test suite binaries"
|
||||
find integration* -name test.main | xargs -r rm
|
||||
}
|
||||
|
||||
repeat() {
|
||||
for i in $(seq 1 ${TEST_REPEAT}); do
|
||||
for i in $(seq 1 $TEST_REPEAT); do
|
||||
echo "Running integration-test (iteration $i)"
|
||||
$@
|
||||
done
|
||||
|
@ -80,7 +80,7 @@ repeat() {
|
|||
test_env() {
|
||||
(
|
||||
set -e
|
||||
[[ -n "$TESTDEBUG" ]] && set -x
|
||||
[ -n "$TESTDEBUG" ] && set -x
|
||||
env -i \
|
||||
DEST="$ABS_DEST" \
|
||||
DOCKER_API_VERSION="$DOCKER_API_VERSION" \
|
||||
|
@ -107,15 +107,15 @@ test_env() {
|
|||
|
||||
|
||||
error_on_leaked_containerd_shims() {
|
||||
if [[ "$(go env GOOS)" == 'windows' ]]; then
|
||||
if [ "$(go env GOOS)" == 'windows' ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
leftovers=$(ps -ax -o pid,cmd |
|
||||
awk '$2 == "containerd-shim" && $4 ~ /.*\/bundles\/.*\/test-integration/ { print $1 }')
|
||||
if [[ -n "$leftovers" ]]; then
|
||||
if [ -n "$leftovers" ]; then
|
||||
ps aux
|
||||
kill -9 ${leftovers} 2> /dev/null
|
||||
kill -9 $leftovers 2> /dev/null
|
||||
echo "!!!! WARNING you have left over shim(s), Cleanup your test !!!!"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -7,21 +7,21 @@ copy_binaries() {
|
|||
# Add nested executables to bundle dir so we have complete set of
|
||||
# them available, but only if the native OS/ARCH is the same as the
|
||||
# OS/ARCH of the build target
|
||||
if [[ "$(go env GOOS)/$(go env GOARCH)" != "$(go env GOHOSTOS)/$(go env GOHOSTARCH)" ]]; then
|
||||
if [ "$(go env GOOS)/$(go env GOARCH)" != "$(go env GOHOSTOS)/$(go env GOHOSTARCH)" ]; then
|
||||
return
|
||||
fi
|
||||
if [[ ! -x /usr/local/bin/runc ]]; then
|
||||
if [ ! -x /usr/local/bin/runc ]; then
|
||||
return
|
||||
fi
|
||||
echo "Copying nested executables into $dir"
|
||||
for file in containerd containerd-shim ctr runc docker-init docker-proxy; do
|
||||
cp -f `which "$file"` "$dir/"
|
||||
if [[ "$hash" == "hash" ]]; then
|
||||
if [ "$hash" == "hash" ]; then
|
||||
hash_files "$dir/$file"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
[[ -z "$KEEPDEST" ]] && rm -rf "$DEST"
|
||||
[ -z "$KEEPDEST" ] && rm -rf "$DEST"
|
||||
source "${MAKEDIR}/.binary"
|
||||
copy_binaries "$DEST" 'hash'
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
set -e
|
||||
|
||||
# if we have our linux/amd64 version compiled, let's symlink it in
|
||||
if [[ -x "$DEST/../binary-daemon/dockerd-$VERSION" ]]; then
|
||||
if [ -x "$DEST/../binary-daemon/dockerd-$VERSION" ]; then
|
||||
arch=$(go env GOHOSTARCH)
|
||||
mkdir -p "$DEST/linux/${arch}"
|
||||
(
|
||||
|
@ -14,7 +14,7 @@ fi
|
|||
|
||||
DOCKER_CROSSPLATFORMS=${DOCKER_CROSSPLATFORMS:-"linux/amd64 windows/amd64"}
|
||||
|
||||
for platform in ${DOCKER_CROSSPLATFORMS}; do
|
||||
for platform in $DOCKER_CROSSPLATFORMS; do
|
||||
(
|
||||
export KEEPDEST=1
|
||||
export DEST="$DEST/$platform" # bundles/VERSION/cross/GOOS/GOARCH/docker-VERSION
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
if [[ ${platform} == "windows/amd64" ]]; then
|
||||
if [ $platform == "windows/amd64" ]; then
|
||||
source "${MAKEDIR}/containerutility"
|
||||
fi
|
||||
|
|
|
@ -6,7 +6,7 @@ rm -rf "$DEST"
|
|||
install_binary() {
|
||||
local file="$1"
|
||||
local target="${DOCKER_MAKE_INSTALL_PREFIX:=/usr/local}/bin/"
|
||||
if [[ "$(go env GOOS)" == "linux" ]]; then
|
||||
if [ "$(go env GOOS)" == "linux" ]; then
|
||||
echo "Installing $(basename $file) to ${target}"
|
||||
mkdir -p "$target"
|
||||
cp -f -L "$file" "$target"
|
||||
|
|
|
@ -13,7 +13,7 @@ DOCKER_USERLANDPROXY=${DOCKER_USERLANDPROXY:-true}
|
|||
|
||||
# example usage: DOCKER_STORAGE_OPTS="dm.basesize=20G,dm.loopdatasize=200G"
|
||||
storage_params=""
|
||||
if [[ -n "$DOCKER_STORAGE_OPTS" ]]; then
|
||||
if [ -n "$DOCKER_STORAGE_OPTS" ]; then
|
||||
IFS=','
|
||||
for i in ${DOCKER_STORAGE_OPTS}; do
|
||||
storage_params="--storage-opt $i $storage_params"
|
||||
|
@ -23,22 +23,22 @@ fi
|
|||
|
||||
|
||||
listen_port=2375
|
||||
if [[ -n "$DOCKER_PORT" ]]; then
|
||||
if [ -n "$DOCKER_PORT" ]; then
|
||||
IFS=':' read -r -a ports <<< "$DOCKER_PORT"
|
||||
listen_port="${ports[-1]}"
|
||||
fi
|
||||
|
||||
extra_params="$DOCKERD_ARGS"
|
||||
if [[ "$DOCKER_REMAP_ROOT" ]]; then
|
||||
if [ "$DOCKER_REMAP_ROOT" ]; then
|
||||
extra_params="$extra_params --userns-remap $DOCKER_REMAP_ROOT"
|
||||
fi
|
||||
|
||||
args="--debug \
|
||||
--host tcp://0.0.0.0:${listen_port} --host unix:///var/run/docker.sock \
|
||||
--storage-driver "${DOCKER_GRAPHDRIVER}" \
|
||||
--userland-proxy="${DOCKER_USERLANDPROXY}" \
|
||||
--storage-driver "$DOCKER_GRAPHDRIVER" \
|
||||
--userland-proxy="$DOCKER_USERLANDPROXY" \
|
||||
$storage_params \
|
||||
$extra_params"
|
||||
|
||||
echo dockerd ${args}
|
||||
exec dockerd ${args}
|
||||
echo dockerd $args
|
||||
exec dockerd $args
|
||||
|
|
|
@ -8,7 +8,7 @@ source hack/make/.integration-test-helpers
|
|||
bundle .integration-daemon-start
|
||||
|
||||
dockerPy='/docker-py'
|
||||
[[ -d "$dockerPy" ]] || {
|
||||
[ -d "$dockerPy" ] || {
|
||||
dockerPy="$DEST/docker-py"
|
||||
git clone https://github.com/docker/docker-py.git "$dockerPy"
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ source hack/make/.integration-test-helpers
|
|||
bundle .integration-daemon-start
|
||||
bundle .integration-daemon-setup
|
||||
|
||||
testexit=0
|
||||
local testexit=0
|
||||
( repeat run_test_integration ) || testexit=$?
|
||||
|
||||
# Always run cleanup, even if the subshell fails
|
||||
|
@ -16,6 +16,6 @@ source hack/make/.integration-test-helpers
|
|||
cleanup_test_suite_binaries
|
||||
error_on_leaked_containerd_shims
|
||||
|
||||
exit ${testexit}
|
||||
exit $testexit
|
||||
|
||||
) 2>&1 | tee -a "$DEST/test.log"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
set -e -u -o pipefail
|
||||
|
||||
ARCH=$(uname -m)
|
||||
if [[ "$ARCH" == "x86_64" ]]; then
|
||||
if [ "$ARCH" == "x86_64" ]; then
|
||||
ARCH="amd64"
|
||||
fi
|
||||
|
||||
|
@ -45,7 +45,7 @@ run_test_integration_legacy_suites() {
|
|||
test_env() {
|
||||
(
|
||||
set -e +u
|
||||
[[ -n "$TESTDEBUG" ]] && set -x
|
||||
[ -n "$TESTDEBUG" ] && set -x
|
||||
env -i \
|
||||
DOCKER_API_VERSION="$DOCKER_API_VERSION" \
|
||||
DOCKER_INTEGRATION_DAEMON_DEST="$DOCKER_INTEGRATION_DAEMON_DEST" \
|
||||
|
|
|
@ -24,7 +24,7 @@ for pkg in $pkg_list; do
|
|||
-cover \
|
||||
-coverprofile=profile.out \
|
||||
-covermode=atomic \
|
||||
${TESTFLAGS} \
|
||||
$TESTFLAGS \
|
||||
"${pkg}"
|
||||
|
||||
if test -f profile.out; then
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
set -e -o pipefail
|
||||
|
||||
if [[ -z "$VALIDATE_UPSTREAM" ]]; then
|
||||
if [ -z "$VALIDATE_UPSTREAM" ]; then
|
||||
# this is kind of an expensive check, so let's not do this twice if we
|
||||
# are running more than one validate bundlescript
|
||||
|
||||
|
@ -18,12 +18,12 @@ if [[ -z "$VALIDATE_UPSTREAM" ]]; then
|
|||
VALIDATE_COMMIT_DIFF="$VALIDATE_UPSTREAM...$VALIDATE_HEAD"
|
||||
|
||||
validate_diff() {
|
||||
if [[ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]]; then
|
||||
if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then
|
||||
git diff "$VALIDATE_COMMIT_DIFF" "$@"
|
||||
fi
|
||||
}
|
||||
validate_log() {
|
||||
if [[ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]]; then
|
||||
if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then
|
||||
git log "$VALIDATE_COMMIT_LOG" "$@"
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
|
||||
export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
. ${SCRIPTDIR}/default
|
||||
. ${SCRIPTDIR}/vendor
|
||||
. $SCRIPTDIR/default
|
||||
. $SCRIPTDIR/vendor
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
changelogFile=${1:-CHANGELOG.md}
|
||||
|
||||
if [[ ! -r "$changelogFile" ]]; then
|
||||
if [ ! -r "$changelogFile" ]; then
|
||||
echo "Unable to read file $changelogFile" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
changelogFile=${1:-CHANGELOG.md}
|
||||
|
||||
if [[ ! -r "$changelogFile" ]]; then
|
||||
if [ ! -r "$changelogFile" ]; then
|
||||
echo "Unable to read file $changelogFile" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -21,13 +21,13 @@ check_dco() {
|
|||
grep -qE "$dcoRegex"
|
||||
}
|
||||
|
||||
if [[ ${adds} -eq 0 && ${dels} -eq 0 ]]; then
|
||||
if [ $adds -eq 0 -a $dels -eq 0 ]; then
|
||||
echo '0 adds, 0 deletions; nothing to validate! :)'
|
||||
else
|
||||
commits=( $(validate_log --format='format:%H%n') )
|
||||
badCommits=()
|
||||
for commit in "${commits[@]}"; do
|
||||
if [[ -z "$(git log -1 --format='format:' --name-status "$commit")" ]]; then
|
||||
if [ -z "$(git log -1 --format='format:' --name-status "$commit")" ]; then
|
||||
# no content (ie, Merge commit, etc)
|
||||
continue
|
||||
fi
|
||||
|
@ -35,7 +35,7 @@ else
|
|||
badCommits+=( "$commit" )
|
||||
fi
|
||||
done
|
||||
if [[ ${#badCommits[@]} -eq 0 ]]; then
|
||||
if [ ${#badCommits[@]} -eq 0 ]; then
|
||||
echo "Congratulations! All commits are properly signed with the DCO!"
|
||||
else
|
||||
{
|
||||
|
|
|
@ -4,14 +4,14 @@
|
|||
|
||||
export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
. ${SCRIPTDIR}/dco
|
||||
. ${SCRIPTDIR}/default-seccomp
|
||||
. ${SCRIPTDIR}/gometalinter
|
||||
. ${SCRIPTDIR}/pkg-imports
|
||||
. ${SCRIPTDIR}/swagger
|
||||
. ${SCRIPTDIR}/swagger-gen
|
||||
. ${SCRIPTDIR}/test-imports
|
||||
. ${SCRIPTDIR}/toml
|
||||
. ${SCRIPTDIR}/changelog-well-formed
|
||||
. ${SCRIPTDIR}/changelog-date-descending
|
||||
. ${SCRIPTDIR}/deprecate-integration-cli
|
||||
. $SCRIPTDIR/dco
|
||||
. $SCRIPTDIR/default-seccomp
|
||||
. $SCRIPTDIR/gometalinter
|
||||
. $SCRIPTDIR/pkg-imports
|
||||
. $SCRIPTDIR/swagger
|
||||
. $SCRIPTDIR/swagger-gen
|
||||
. $SCRIPTDIR/test-imports
|
||||
. $SCRIPTDIR/toml
|
||||
. $SCRIPTDIR/changelog-well-formed
|
||||
. $SCRIPTDIR/changelog-date-descending
|
||||
. $SCRIPTDIR/deprecate-integration-cli
|
||||
|
|
|
@ -7,12 +7,12 @@ IFS=$'\n'
|
|||
files=( $(validate_diff --diff-filter=ACMR --name-only -- 'profiles/seccomp' || true) )
|
||||
unset IFS
|
||||
|
||||
if [[ ${#files[@]} -gt 0 ]]; then
|
||||
if [ ${#files[@]} -gt 0 ]; then
|
||||
# We run 'go generate' and see if we have a diff afterwards
|
||||
go generate ./profiles/seccomp/ >/dev/null
|
||||
# Let see if the working directory is clean
|
||||
diffs="$(git status --porcelain -- profiles/seccomp 2>/dev/null)"
|
||||
if [[ "$diffs" ]]; then
|
||||
if [ "$diffs" ]; then
|
||||
{
|
||||
echo 'The result of go generate ./profiles/seccomp/ differs'
|
||||
echo
|
||||
|
|
|
@ -9,7 +9,7 @@ new_tests=$(
|
|||
grep -E '^\+func (.*) Test' || true
|
||||
)
|
||||
|
||||
if [[ -z "$new_tests" ]]; then
|
||||
if [ -z "$new_tests" ]; then
|
||||
echo 'Congratulations! No new tests added to integration-cli.'
|
||||
exit
|
||||
fi
|
||||
|
|
|
@ -10,4 +10,4 @@ SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|||
|
||||
gometalinter \
|
||||
${GOMETALINTER_OPTS} \
|
||||
--config ${SCRIPTDIR}/gometalinter.json ./...
|
||||
--config $SCRIPTDIR/gometalinter.json ./...
|
||||
|
|
|
@ -19,7 +19,7 @@ for f in "${files[@]}"; do
|
|||
done
|
||||
done
|
||||
|
||||
if [[ ${#badFiles[@]} -eq 0 ]]; then
|
||||
if [ ${#badFiles[@]} -eq 0 ]; then
|
||||
echo 'Congratulations! "./pkg/..." is safely isolated from internal code.'
|
||||
else
|
||||
{
|
||||
|
|
|
@ -7,7 +7,7 @@ IFS=$'\n'
|
|||
files=( $(validate_diff --diff-filter=ACMR --name-only -- 'api/swagger.yaml' || true) )
|
||||
unset IFS
|
||||
|
||||
if [[ ${#files[@]} -gt 0 ]]; then
|
||||
if [ ${#files[@]} -gt 0 ]; then
|
||||
yamllint -c ${SCRIPTDIR}/.swagger-yamllint api/swagger.yaml
|
||||
swagger validate api/swagger.yaml
|
||||
fi
|
||||
|
|
|
@ -7,11 +7,11 @@ IFS=$'\n'
|
|||
files=( $(validate_diff --diff-filter=ACMR --name-only -- 'api/types/' 'api/swagger.yaml' || true) )
|
||||
unset IFS
|
||||
|
||||
if [[ ${#files[@]} -gt 0 ]]; then
|
||||
if [ ${#files[@]} -gt 0 ]; then
|
||||
${SCRIPTDIR}/../generate-swagger-api.sh 2> /dev/null
|
||||
# Let see if the working directory is clean
|
||||
diffs="$(git diff -- api/types/)"
|
||||
if [[ "$diffs" ]]; then
|
||||
if [ "$diffs" ]; then
|
||||
{
|
||||
echo 'The result of hack/generate-swagger-api.sh differs'
|
||||
echo
|
||||
|
|
|
@ -11,20 +11,20 @@ unset IFS
|
|||
badFiles=()
|
||||
for f in "${files[@]}"; do
|
||||
# skip check_test.go since it *does* use the testing package
|
||||
if [[ "$f" = "integration-cli/check_test.go" ]]; then
|
||||
if [ "$f" = "integration-cli/check_test.go" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# we use "git show" here to validate that what's committed doesn't contain golang built-in testing
|
||||
if git show "$VALIDATE_HEAD:$f" | grep -q testing.T; then
|
||||
if [[ "$(echo $f | grep '_test')" ]]; then
|
||||
if [ "$(echo $f | grep '_test')" ]; then
|
||||
# allow testing.T for non- _test files
|
||||
badFiles+=( "$f" )
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ ${#badFiles[@]} -eq 0 ]]; then
|
||||
if [ ${#badFiles[@]} -eq 0 ]; then
|
||||
echo 'Congratulations! No testing.T found.'
|
||||
else
|
||||
{
|
||||
|
|
|
@ -15,7 +15,7 @@ for f in "${files[@]}"; do
|
|||
fi
|
||||
done
|
||||
|
||||
if [[ ${#badFiles[@]} -eq 0 ]]; then
|
||||
if [ ${#badFiles[@]} -eq 0 ]; then
|
||||
echo 'Congratulations! All toml source files changed here have valid syntax.'
|
||||
else
|
||||
{
|
||||
|
|
|
@ -8,12 +8,12 @@ validate_vendor_diff(){
|
|||
files=( $(validate_diff --diff-filter=ACMR --name-only -- 'vendor.conf' 'vendor/' || true) )
|
||||
unset IFS
|
||||
|
||||
if [[ ${#files[@]} -gt 0 ]]; then
|
||||
if [ ${#files[@]} -gt 0 ]; then
|
||||
# recreate vendor/
|
||||
vndr
|
||||
# check if any files have changed
|
||||
diffs="$(git status --porcelain -- vendor 2>/dev/null)"
|
||||
if [[ "$diffs" ]]; then
|
||||
if [ "$diffs" ]; then
|
||||
{
|
||||
echo 'The result of vndr differs'
|
||||
echo
|
||||
|
@ -38,7 +38,7 @@ validate_vendor_used() {
|
|||
for f in $pkgs; do
|
||||
if ls -d vendor/$f > /dev/null 2>&1; then
|
||||
found=$(find vendor/$f -iregex '.*LICENSE.*' -or -iregex '.*COPYRIGHT.*' -or -iregex '.*COPYING.*' | wc -l)
|
||||
if [[ ${found} -eq 0 ]]; then
|
||||
if [ $found -eq 0 ]; then
|
||||
echo "WARNING: could not find copyright information for $f"
|
||||
fi
|
||||
else
|
||||
|
|
Loading…
Add table
Reference in a new issue