scripts: makefile, dockerfile, travis, ...

This commit is contained in:
Fernandez Ludovic 2019-08-11 12:20:53 +02:00 committed by Traefiker Bot
parent 4c5e7a238d
commit 51b0508512
12 changed files with 71 additions and 133 deletions

View file

@ -28,7 +28,7 @@ fi
# Build binaries
# shellcheck disable=SC2086
CGO_ENABLED=0 GOGC=off go build ${FLAGS[*]} -ldflags "-s -w \
-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" \
-X github.com/containous/traefik/pkg/v2/version.Version=$VERSION \
-X github.com/containous/traefik/pkg/v2/version.Codename=$CODENAME \
-X github.com/containous/traefik/pkg/v2/version.BuildDate=$DATE" \
-a -installsuffix nocgo -o dist/traefik ./cmd/traefik

View file

@ -1,6 +1,9 @@
#!/usr/bin/env bash
set -e
export GO111MODULE=on
export GOPROXY=https://proxy.golang.org
# List of bundles to create when no argument is passed
DEFAULT_BUNDLES=(
generate

View file

@ -1,59 +0,0 @@
#!/usr/bin/env bash
set -o errexit
set -o pipefail
set -o nounset
echo "Prune dependencies"
find vendor -name '*_test.go' -exec rm {} \;
find vendor -type f \( ! -iname 'licen[cs]e*' \
-a ! -iname '*notice*' \
-a ! -iname '*patent*' \
-a ! -iname '*copying*' \
-a ! -iname '*unlicense*' \
-a ! -iname '*copyright*' \
-a ! -iname '*copyleft*' \
-a ! -iname '*legal*' \
-a ! -iname 'disclaimer*' \
-a ! -iname 'third-party*' \
-a ! -iname 'thirdparty*' \
-a ! -iname '*.go' \
-a ! -iname '*.c' \
-a ! -iname '*.s' \
-a ! -iname '*.pl' \
-a ! -iname '*.cc' \
-a ! -iname '*.cpp' \
-a ! -iname '*.cxx' \
-a ! -iname '*.h' \
-a ! -iname '*.hh' \
-a ! -iname '*.hpp' \
-a ! -iname '*.hxx' \
-a ! -wholename 'vendor/k8s.io/code-generator/*' \
-a ! -iname '*.s' \) -exec rm -f {} +
find . -type d \( -iname '*Godeps*' \) -exec rm -rf {} +
find vendor -type l \( ! -iname 'licen[cs]e*' \
-a ! -iname '*notice*' \
-a ! -iname '*patent*' \
-a ! -iname '*copying*' \
-a ! -iname '*unlicense*' \
-a ! -iname '*copyright*' \
-a ! -iname '*copyleft*' \
-a ! -iname '*legal*' \
-a ! -iname 'disclaimer*' \
-a ! -iname 'third-party*' \
-a ! -iname 'thirdparty*' \
-a ! -iname '*.go' \
-a ! -iname '*.c' \
-a ! -iname '*.S' \
-a ! -iname '*.cc' \
-a ! -iname '*.cpp' \
-a ! -iname '*.cxx' \
-a ! -iname '*.h' \
-a ! -iname '*.hh' \
-a ! -iname '*.hpp' \
-a ! -iname '*.hxx' \
-a ! -iname '*.s' \) -exec rm -f {} +

View file

@ -2,6 +2,7 @@
HACK_DIR="$( cd "$( dirname "${0}" )" && pwd -P)"; export HACK_DIR
REPO_ROOT=${HACK_DIR}/..
TRAEFIK_MODULE_VERSION=v2
rm -rf "${REPO_ROOT}"/vendor
go mod vendor
@ -9,16 +10,19 @@ chmod +x "${REPO_ROOT}"/vendor/k8s.io/code-generator/*.sh
"${REPO_ROOT}"/vendor/k8s.io/code-generator/generate-groups.sh \
all \
github.com/containous/traefik/pkg/provider/kubernetes/crd/generated \
github.com/containous/traefik/pkg/provider/kubernetes/crd \
github.com/containous/traefik/${TRAEFIK_MODULE_VERSION}/pkg/provider/kubernetes/crd/generated \
github.com/containous/traefik/${TRAEFIK_MODULE_VERSION}/pkg/provider/kubernetes/crd \
traefik:v1alpha1 \
--go-header-file "${HACK_DIR}"/boilerplate.go.tmpl \
"$@"
deepcopy-gen \
--input-dirs github.com/containous/traefik/pkg/config/dynamic \
--input-dirs github.com/containous/traefik/pkg/tls \
--input-dirs github.com/containous/traefik/pkg/types \
--input-dirs github.com/containous/traefik/${TRAEFIK_MODULE_VERSION}/pkg/config/dynamic \
--input-dirs github.com/containous/traefik/${TRAEFIK_MODULE_VERSION}/pkg/tls \
--input-dirs github.com/containous/traefik/${TRAEFIK_MODULE_VERSION}/pkg/types \
--output-package github.com/containous/traefik \
-O zz_generated.deepcopy --go-header-file "${HACK_DIR}"/boilerplate.go.tmpl
cp -r "${REPO_ROOT}"/"${TRAEFIK_MODULE_VERSION:?}"/* "${REPO_ROOT}"; rm -rf "${REPO_ROOT}"/"${TRAEFIK_MODULE_VERSION:?}"
rm -rf "${REPO_ROOT}"/vendor

View file

@ -4,26 +4,11 @@ set -o pipefail
set -o nounset
SCRIPT_DIR="$( cd "$( dirname "${0}" )" && pwd -P)"; export SCRIPT_DIR
vendor_dir="./vendor/"
# We run dep install to and see if we have a diff afterwards
echo "checking ${vendor_dir} for unintentional changes..."
echo "checking go modules for unintentional changes..."
dep ensure -v
("${SCRIPT_DIR}"/prune-dep.sh)
go mod tidy
git diff --exit-code go.mod
git diff --exit-code go.sum
# Let see if the working directory is clean
diffs="$(git status --porcelain -- ${vendor_dir} 2>/dev/null)"
if [[ "$diffs" ]]; then
{
echo "The result of 'dep ensure' for vendor directory '${vendor_dir}' differs"
echo
echo "$diffs"
echo
echo 'Please vendor your package(s) with dep.'
echo
} >&2
exit 2
fi
echo 'Congratulations! All vendoring changes are done the right way.'
echo 'Congratulations! All go modules changes are done the right way.'