Move code to pkg

This commit is contained in:
Ludovic Fernandez 2019-03-15 09:42:03 +01:00 committed by Traefiker Bot
parent bd4c822670
commit f1b085fa36
465 changed files with 656 additions and 680 deletions

View file

@ -27,7 +27,7 @@ fi
# Build binaries
CGO_ENABLED=0 GOGC=off go build $FLAGS -ldflags "-s -w \
-X github.com/containous/traefik/version.Version=$VERSION \
-X github.com/containous/traefik/version.Codename=$CODENAME \
-X github.com/containous/traefik/version.BuildDate=$DATE" \
-X github.com/containous/traefik/pkg/version.Version=$VERSION \
-X github.com/containous/traefik/pkg/version.Codename=$CODENAME \
-X github.com/containous/traefik/pkg/version.BuildDate=$DATE" \
-a -installsuffix nocgo -o dist/traefik ./cmd/traefik

View file

@ -20,7 +20,7 @@ fi
echo "Building ${VERSION} ${CODENAME} ${DATE}"
GIT_REPO_URL='github.com/containous/traefik/version'
GIT_REPO_URL='github.com/containous/traefik/pkg/version'
GO_BUILD_CMD="go build -ldflags"
GO_BUILD_OPT="-s -w -X ${GIT_REPO_URL}.Version=${VERSION} -X ${GIT_REPO_URL}.Codename=${CODENAME} -X ${GIT_REPO_URL}.BuildDate=${DATE}"

View file

@ -20,7 +20,7 @@ fi
echo "Building ${VERSION} ${CODENAME} ${DATE}"
GIT_REPO_URL='github.com/containous/traefik/version'
GIT_REPO_URL='github.com/containous/traefik/pkg/version'
GO_BUILD_CMD="go build -ldflags"
GO_BUILD_OPT="-s -w -X ${GIT_REPO_URL}.Version=${VERSION} -X ${GIT_REPO_URL}.Codename=${CODENAME} -X ${GIT_REPO_URL}.BuildDate=${DATE}"

View file

@ -8,8 +8,11 @@ TESTFLAGS="${TESTFLAGS} -test.timeout=20m -check.v"
if [ -n "$VERBOSE" ]; then
TESTFLAGS="${TESTFLAGS} -v"
elif [ -n "$VERBOSE_INTEGRATION" ]; then
TESTFLAGS="${TESTFLAGS} -v"
fi
cd integration
echo "Testing against…"
docker version

View file

@ -10,53 +10,23 @@ RED=$'\033[31m'
GREEN=$'\033[32m'
TEXTRESET=$'\033[0m' # reset the foreground colour
# This helper function walks the current directory looking for directories
# holding certain files ($1 parameter), and prints their paths on standard
# output, one per line.
find_dirs() {
find . -not \( \
\( \
-path './integration/*' \
-o -path './old/*' \
-o -path './vendor/*' \
-o -path './.git/*' \
\) \
-prune \
\) -name "$1" -print0 | xargs -0n1 dirname | sort -u
}
# -failfast -timeout=5m
TESTFLAGS="-cover -coverprofile=cover.out ${TESTFLAGS}"
if [ -n "$VERBOSE" ]; then
TESTFLAGS="${TESTFLAGS} -v"
elif [ -n "$VERBOSE_UNIT" ]; then
TESTFLAGS="${TESTFLAGS} -v"
fi
if [ -z "$TESTDIRS" ]; then
TESTDIRS=$(find_dirs '*_test.go')
fi
set +e
TESTS_FAILED=()
go test ${TESTFLAGS} ./pkg/...
for dir in $TESTDIRS; do
echo '+ go test' $TESTFLAGS "${dir}"
go test ${TESTFLAGS} ${dir}
if [ $? != 0 ]; then
TESTS_FAILED+=("$dir")
echo
echo "${RED}Tests failed: $dir${TEXTRESET}"
sleep 1 # give it a second, so observers watching can take note
fi
done
echo
# if some tests fail, we want the bundlescript to fail, but we want to
# try running ALL the tests first, hence TESTS_FAILED
if [ "${#TESTS_FAILED[@]}" -gt 0 ]; then
echo "${RED}Test failures in: ${TESTS_FAILED[@]}${TEXTRESET}"
echo
false
CODE=$?
if [ ${CODE} != 0 ]; then
echo "${RED}Tests failed [code ${CODE}].${TEXTRESET}"
exit ${CODE}
else
echo "${GREEN}Test success${TEXTRESET}"
echo
true
echo "${GREEN}Tests succeed.${TEXTRESET}"
fi

View file

@ -5,10 +5,10 @@ REPO_ROOT=${HACK_DIR}/..
${REPO_ROOT}/vendor/k8s.io/code-generator/generate-groups.sh \
all \
github.com/containous/traefik/provider/kubernetes/crd/generated \
github.com/containous/traefik/provider/kubernetes/crd \
github.com/containous/traefik/pkg/provider/kubernetes/crd/generated \
github.com/containous/traefik/pkg/provider/kubernetes/crd \
traefik:v1alpha1 \
--go-header-file ${HACK_DIR}/boilerplate.go.tmpl \
$@
deepcopy-gen --input-dirs github.com/containous/traefik/config -O zz_generated.deepcopy --go-header-file ${HACK_DIR}/boilerplate.go.tmpl
deepcopy-gen --input-dirs github.com/containous/traefik/pkg/config -O zz_generated.deepcopy --go-header-file ${HACK_DIR}/boilerplate.go.tmpl