fix: shellcheck
This commit is contained in:
parent
788f8fa951
commit
fd95560c66
5 changed files with 30 additions and 20 deletions
|
@ -4,11 +4,11 @@ set -e
|
|||
rm -f dist/traefik
|
||||
|
||||
FLAGS=()
|
||||
if [ -n "$VERBOSE" ]; then
|
||||
if [ -n "${VERBOSE}" ]; then
|
||||
FLAGS+=(-v)
|
||||
fi
|
||||
|
||||
if [ -z "$VERSION" ]; then
|
||||
if [ -z "${VERSION}" ]; then
|
||||
VERSION=$(git rev-parse HEAD)
|
||||
fi
|
||||
|
||||
|
@ -22,6 +22,7 @@ fi
|
|||
|
||||
# Build binaries
|
||||
# shellcheck disable=SC2086
|
||||
# shellcheck disable=SC2048
|
||||
CGO_ENABLED=0 GOGC=off go build ${FLAGS[*]} -ldflags "-s -w \
|
||||
-X github.com/traefik/traefik/v2/pkg/version.Version=$VERSION \
|
||||
-X github.com/traefik/traefik/v2/pkg/version.Codename=$CODENAME \
|
||||
|
|
|
@ -1,40 +1,46 @@
|
|||
#!/bin/bash -e
|
||||
# shellcheck disable=SC2046
|
||||
|
||||
set -e -o pipefail
|
||||
|
||||
PROJECT_MODULE="github.com/traefik/traefik"
|
||||
MODULE_VERSION="v2"
|
||||
IMAGE_NAME="kubernetes-codegen:latest"
|
||||
CURRENT_DIR="$(pwd)"
|
||||
|
||||
echo "Building codegen Docker image..."
|
||||
docker build --build-arg KUBE_VERSION=v0.20.2 --build-arg USER=$USER --build-arg UID=$(id -u) --build-arg GID=$(id -g) -f "./script/codegen.Dockerfile" \
|
||||
docker build --build-arg KUBE_VERSION=v0.20.2 \
|
||||
--build-arg USER="${USER}" \
|
||||
--build-arg UID="$(id -u)" \
|
||||
--build-arg GID="$(id -g)" \
|
||||
-f "./script/codegen.Dockerfile" \
|
||||
-t "${IMAGE_NAME}" \
|
||||
"."
|
||||
|
||||
echo "Generating Traefik clientSet code ..."
|
||||
cmd="/go/src/k8s.io/code-generator/generate-groups.sh all ${PROJECT_MODULE}/${MODULE_VERSION}/pkg/provider/kubernetes/crd/generated ${PROJECT_MODULE}/${MODULE_VERSION}/pkg/provider/kubernetes/crd traefik:v1alpha1 --go-header-file=/go/src/${PROJECT_MODULE}/script/boilerplate.go.tmpl"
|
||||
docker run --rm \
|
||||
-v "$(pwd):/go/src/${PROJECT_MODULE}" \
|
||||
-v "${CURRENT_DIR}:/go/src/${PROJECT_MODULE}" \
|
||||
-w "/go/src/${PROJECT_MODULE}" \
|
||||
"${IMAGE_NAME}" $cmd
|
||||
"${IMAGE_NAME}" ${cmd}
|
||||
|
||||
echo "Generating DeepCopy code ..."
|
||||
cmd="deepcopy-gen --input-dirs ${PROJECT_MODULE}/${MODULE_VERSION}/pkg/config/dynamic --input-dirs ${PROJECT_MODULE}/${MODULE_VERSION}/pkg/tls --input-dirs ${PROJECT_MODULE}/${MODULE_VERSION}/pkg/types --output-package ${PROJECT_MODULE}/${MODULE_VERSION} -O zz_generated.deepcopy --go-header-file=/go/src/${PROJECT_MODULE}/script/boilerplate.go.tmpl"
|
||||
docker run --rm \
|
||||
-v "$(pwd):/go/src/${PROJECT_MODULE}" \
|
||||
-v "${CURRENT_DIR}:/go/src/${PROJECT_MODULE}" \
|
||||
-w "/go/src/${PROJECT_MODULE}" \
|
||||
"${IMAGE_NAME}" $cmd
|
||||
"${IMAGE_NAME}" ${cmd}
|
||||
|
||||
echo "Generating the CRD definitions for the documentation ..."
|
||||
cmd="controller-gen crd:crdVersions=v1 paths=./pkg/provider/kubernetes/crd/traefik/v1alpha1/... output:dir=./docs/content/reference/dynamic-configuration/"
|
||||
docker run --rm \
|
||||
-v "$(pwd):/go/src/${PROJECT_MODULE}" \
|
||||
-v "${CURRENT_DIR}:/go/src/${PROJECT_MODULE}" \
|
||||
-w "/go/src/${PROJECT_MODULE}" \
|
||||
"${IMAGE_NAME}" $cmd
|
||||
"${IMAGE_NAME}" ${cmd}
|
||||
|
||||
echo "Concatenate the CRD definitions for publication and integration tests ..."
|
||||
cat $(pwd)/docs/content/reference/dynamic-configuration/traefik.containo.us_*.yaml > $(pwd)/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml
|
||||
cp -f $(pwd)/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml $(pwd)/integration/fixtures/k8s/01-traefik-crd.yml
|
||||
cat "${CURRENT_DIR}"/docs/content/reference/dynamic-configuration/traefik.containo.us_*.yaml > "${CURRENT_DIR}"/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml
|
||||
cp -f "${CURRENT_DIR}"/docs/content/reference/dynamic-configuration/kubernetes-crd-definition-v1.yml "${CURRENT_DIR}"/integration/fixtures/k8s/01-traefik-crd.yml
|
||||
|
||||
cp -r $(pwd)/${MODULE_VERSION}/* $(pwd)
|
||||
rm -rf $(pwd)/${MODULE_VERSION}
|
||||
cp -r "${CURRENT_DIR}/${MODULE_VERSION}"/* "${CURRENT_DIR}"
|
||||
rm -rf "${CURRENT_DIR:?}/${MODULE_VERSION}"
|
||||
|
|
|
@ -18,9 +18,9 @@ SCRIPT_DIR="$(cd "$(dirname "${0}")" && pwd -P)"
|
|||
|
||||
bundle() {
|
||||
local bundle="$1"; shift
|
||||
echo "---> Making bundle: $(basename "$bundle") (in $SCRIPT_DIR)"
|
||||
echo "---> Making bundle: $(basename "${bundle}") (in $SCRIPT_DIR)"
|
||||
# shellcheck source=/dev/null
|
||||
source "${SCRIPT_DIR}/$bundle"
|
||||
source "${SCRIPT_DIR}/${bundle}"
|
||||
}
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
|
@ -28,7 +28,8 @@ if [ $# -lt 1 ]; then
|
|||
else
|
||||
bundles=${*}
|
||||
fi
|
||||
# shellcheck disable=SC2048
|
||||
for bundle in ${bundles[*]}; do
|
||||
bundle "$bundle"
|
||||
bundle "${bundle}"
|
||||
echo
|
||||
done
|
||||
|
|
|
@ -5,9 +5,9 @@ export DEST=.
|
|||
|
||||
TESTFLAGS+=("-test.timeout=20m" -check.v)
|
||||
|
||||
if [ -n "$VERBOSE" ]; then
|
||||
if [ -n "${VERBOSE}" ]; then
|
||||
TESTFLAGS+=(-v)
|
||||
elif [ -n "$VERBOSE_INTEGRATION" ]; then
|
||||
elif [ -n "${VERBOSE_INTEGRATION}" ]; then
|
||||
TESTFLAGS+=(-v)
|
||||
fi
|
||||
|
||||
|
@ -16,4 +16,5 @@ echo "Testing against..."
|
|||
docker version
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
# shellcheck disable=SC2048
|
||||
CGO_ENABLED=0 go test -integration ${TESTFLAGS[*]}
|
||||
|
|
|
@ -8,15 +8,16 @@ TEXTRESET=$'\033[0m' # reset the foreground colour
|
|||
# -failfast -timeout=5m
|
||||
TESTFLAGS=(-cover "-coverprofile=cover.out" "${TESTFLAGS}")
|
||||
|
||||
if [ -n "$VERBOSE" ]; then
|
||||
if [ -n "${VERBOSE}" ]; then
|
||||
TESTFLAGS+=(-v)
|
||||
elif [ -n "$VERBOSE_UNIT" ]; then
|
||||
elif [ -n "${VERBOSE_UNIT}" ]; then
|
||||
TESTFLAGS+=(-v)
|
||||
fi
|
||||
|
||||
set +e
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
# shellcheck disable=SC2048
|
||||
go test ${TESTFLAGS[*]} ./pkg/...
|
||||
|
||||
CODE=$?
|
||||
|
|
Loading…
Reference in a new issue