mirror of https://github.com/docker/cli.git
Merge pull request #349 from jphuynh/shellcheck-scripts
Add scripts folder to shellcheck
This commit is contained in:
commit
53d8886f9c
|
@ -11,4 +11,4 @@ echo "Building statically linked $TARGET"
|
||||||
export CGO_ENABLED=0
|
export CGO_ENABLED=0
|
||||||
go build -o "${TARGET}" --ldflags "${LDFLAGS}" "${SOURCE}"
|
go build -o "${TARGET}" --ldflags "${LDFLAGS}" "${SOURCE}"
|
||||||
|
|
||||||
ln -sf "$(basename ${TARGET})" build/docker
|
ln -sf "$(basename "${TARGET}")" build/docker
|
||||||
|
|
|
@ -18,7 +18,7 @@ jobs=(
|
||||||
)
|
)
|
||||||
|
|
||||||
# Outside of circleCI run all at once. On circleCI run two at a time because
|
# Outside of circleCI run all at once. On circleCI run two at a time because
|
||||||
# each continer has access to two cores.
|
# each container has access to two cores.
|
||||||
group=${CROSS_GROUP-"all"}
|
group=${CROSS_GROUP-"all"}
|
||||||
|
|
||||||
if [ "$group" == "all" ]; then
|
if [ "$group" == "all" ]; then
|
||||||
|
@ -29,5 +29,5 @@ if [ "$group" == "all" ]; then
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
declare -i start=$group*2
|
declare -i start="$group*2"
|
||||||
parallel ::: "${jobs[@]:$start:2}"
|
parallel ::: "${jobs[@]:$start:2}"
|
||||||
|
|
|
@ -11,4 +11,4 @@ echo "Building dynamically linked $TARGET"
|
||||||
export CGO_ENABLED=1
|
export CGO_ENABLED=1
|
||||||
go build -o "${TARGET}" -tags pkcs11 --ldflags "${LDFLAGS}" "${SOURCE}"
|
go build -o "${TARGET}" -tags pkcs11 --ldflags "${LDFLAGS}" "${SOURCE}"
|
||||||
|
|
||||||
ln -sf "$(basename ${TARGET})" build/docker
|
ln -sf "$(basename "${TARGET}")" build/docker
|
||||||
|
|
|
@ -8,7 +8,7 @@ go install ./vendor/github.com/cpuguy83/go-md2man
|
||||||
|
|
||||||
# Generate man pages from cobra commands
|
# Generate man pages from cobra commands
|
||||||
go build -o /tmp/gen-manpages github.com/docker/cli/man
|
go build -o /tmp/gen-manpages github.com/docker/cli/man
|
||||||
/tmp/gen-manpages --root $(pwd) --target $(pwd)/man/man1
|
/tmp/gen-manpages --root "$(pwd)" --target "$(pwd)/man/man1"
|
||||||
|
|
||||||
# Generate legacy pages from markdown
|
# Generate legacy pages from markdown
|
||||||
./man/md2man-all.sh -q
|
./man/md2man-all.sh -q
|
||||||
|
|
|
@ -5,4 +5,4 @@ set -eu -o pipefail
|
||||||
mkdir -p docs/yaml/gen
|
mkdir -p docs/yaml/gen
|
||||||
|
|
||||||
go build -o build/yaml-docs-generator github.com/docker/cli/docs/yaml
|
go build -o build/yaml-docs-generator github.com/docker/cli/docs/yaml
|
||||||
build/yaml-docs-generator --root $(pwd) --target $(pwd)/docs/yaml/gen
|
build/yaml-docs-generator --root "$(pwd)" --target "$(pwd)/docs/yaml/gen"
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
set -eu -o pipefail
|
set -eu -o pipefail
|
||||||
|
|
||||||
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
# shellcheck source=/go/src/github.com/docker/cli/scripts/build/.variables
|
||||||
source $SCRIPTDIR/../build/.variables
|
source $SCRIPTDIR/../build/.variables
|
||||||
|
|
||||||
RESOURCES=$SCRIPTDIR/../winresources
|
RESOURCES=$SCRIPTDIR/../winresources
|
||||||
|
@ -15,30 +16,28 @@ trap 'rm -rf $TEMPDIR' EXIT
|
||||||
|
|
||||||
if [ "$(go env GOHOSTOS)" == "windows" ]; then
|
if [ "$(go env GOHOSTOS)" == "windows" ]; then
|
||||||
WINDRES=windres
|
WINDRES=windres
|
||||||
WINDMC=windmc
|
|
||||||
else
|
else
|
||||||
# Cross compiling
|
# Cross compiling
|
||||||
WINDRES=x86_64-w64-mingw32-windres
|
WINDRES=x86_64-w64-mingw32-windres
|
||||||
WINDMC=x86_64-w64-mingw32-windmc
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Generate a Windows file version of the form major,minor,patch,build (with any part optional)
|
# 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=$(echo -n "$VERSION" | sed -re 's/^([0-9.]*).*$/\1/' | tr . ,)
|
||||||
|
|
||||||
# Pass version and commit information into the resource compiler
|
# Pass version and commit information into the resource compiler
|
||||||
defs=
|
defs=
|
||||||
[ ! -z $VERSION ] && defs="$defs -D DOCKER_VERSION=\"$VERSION\""
|
[ ! -z "$VERSION" ] && defs+=( "-D DOCKER_VERSION=\"$VERSION\"")
|
||||||
[ ! -z $VERSION_QUAD ] && defs="$defs -D DOCKER_VERSION_QUAD=$VERSION_QUAD"
|
[ ! -z "$VERSION_QUAD" ] && defs+=( "-D DOCKER_VERSION_QUAD=$VERSION_QUAD")
|
||||||
[ ! -z $GITCOMMIT ] && defs="$defs -D DOCKER_COMMIT=\"$GITCOMMIT\""
|
[ ! -z "$GITCOMMIT" ] && defs+=( "-D DOCKER_COMMIT=\"$GITCOMMIT\"")
|
||||||
|
|
||||||
function makeres {
|
function makeres {
|
||||||
$WINDRES \
|
"$WINDRES" \
|
||||||
-i $RESOURCES/$1 \
|
-i "$RESOURCES/$1" \
|
||||||
-o $3 \
|
-o "$3" \
|
||||||
-F $2 \
|
-F "$2" \
|
||||||
--use-temp-file \
|
--use-temp-file \
|
||||||
-I $TEMPDIR \
|
-I "$TEMPDIR" \
|
||||||
$defs
|
${defs[*]}
|
||||||
}
|
}
|
||||||
|
|
||||||
makeres docker.rc pe-x86-64 rsrc_amd64.syso
|
makeres docker.rc pe-x86-64 rsrc_amd64.syso
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -eu -o pipefail
|
set -eu -o pipefail
|
||||||
|
|
||||||
go test -tags daemon -v $@
|
go test -tags daemon -v "$@"
|
||||||
|
|
|
@ -3,14 +3,14 @@ set -eu -o pipefail
|
||||||
|
|
||||||
# install test dependencies once before running tests for each package. This
|
# install test dependencies once before running tests for each package. This
|
||||||
# reduces the runtime from 200s down to 23s
|
# reduces the runtime from 200s down to 23s
|
||||||
go test -i $@
|
go test -i "$@"
|
||||||
|
|
||||||
for pkg in $@; do
|
for pkg in "$@"; do
|
||||||
./scripts/test/unit \
|
./scripts/test/unit \
|
||||||
-cover \
|
-cover \
|
||||||
-coverprofile=profile.out \
|
-coverprofile=profile.out \
|
||||||
-covermode=atomic \
|
-covermode=atomic \
|
||||||
${pkg}
|
"${pkg}"
|
||||||
|
|
||||||
if test -f profile.out; then
|
if test -f profile.out; then
|
||||||
cat profile.out >> coverage.txt
|
cat profile.out >> coverage.txt
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
# shellcheck disable=SC2016
|
||||||
exec filewatcher -L 6 -x build -x script go test -timeout 10s -v './${dir}'
|
exec filewatcher -L 6 -x build -x script go test -timeout 10s -v './${dir}'
|
||||||
|
|
|
@ -3,13 +3,13 @@
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
DIFF_PATH=$1
|
DIFF_PATH=$1
|
||||||
DIFF=$(git status --porcelain -- $DIFF_PATH)
|
DIFF=$(git status --porcelain -- "$DIFF_PATH")
|
||||||
|
|
||||||
if [ "$DIFF" ]; then
|
if [ "$DIFF" ]; then
|
||||||
echo
|
echo
|
||||||
echo "These files were changed:"
|
echo "These files were changed:"
|
||||||
echo
|
echo
|
||||||
echo $DIFF
|
echo "$DIFF"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -eo pipefail
|
||||||
|
|
||||||
# Maintain an array of files to shellcheck not the best solution but will do for the time being
|
shellcheck contrib/completion/bash/docker
|
||||||
FILES=()
|
find scripts/ -type f | grep -v scripts/winresources | xargs shellcheck
|
||||||
FILES+=("contrib/completion/bash/docker")
|
|
||||||
FILES+=("scripts/validate/shellcheck")
|
|
||||||
|
|
||||||
for f in "${FILES[@]}"; do
|
|
||||||
shellcheck "$f"
|
|
||||||
done
|
|
||||||
|
|
Loading…
Reference in New Issue