mirror of
https://github.com/kubernetes-sigs/kind.git
synced 2025-11-30 23:16:04 +07:00
use go_container.sh more consistently
This commit is contained in:
2
go.mod
2
go.mod
@@ -1,5 +1,7 @@
|
||||
module sigs.k8s.io/kind
|
||||
|
||||
go 1.13
|
||||
|
||||
require (
|
||||
github.com/google/gofuzz v1.0.0
|
||||
github.com/google/uuid v1.1.1
|
||||
|
||||
@@ -22,16 +22,11 @@ set -o errexit -o nounset -o pipefail
|
||||
REPO_ROOT=$(git rev-parse --show-toplevel)
|
||||
cd "${REPO_ROOT}"
|
||||
|
||||
# enable modules and the proxy cache
|
||||
export GO111MODULE="on"
|
||||
GOPROXY="${GOPROXY:-https://proxy.golang.org}"
|
||||
export GOPROXY
|
||||
|
||||
# build and test kind
|
||||
hack/release/build/cross.sh
|
||||
go test -v ./...
|
||||
hack/go_container.sh go test -v ./...
|
||||
|
||||
# build and test kindnetd
|
||||
cd ./cmd/kindnetd
|
||||
go install -v .
|
||||
go test -v ./...
|
||||
"${REPO_ROOT}/hack/go_container.sh" go build -v -o /out/kindnetd .
|
||||
"${REPO_ROOT}/hack/go_container.sh" go test -v ./...
|
||||
|
||||
@@ -21,15 +21,13 @@ cd "${REPO_ROOT}"
|
||||
|
||||
# ensure we have up to date kind
|
||||
make build
|
||||
KIND="${REPO_ROOT}/bin/kind"
|
||||
|
||||
# generate tag
|
||||
DATE="$(date +v%Y%m%d)"
|
||||
TAG="${DATE}-$(git describe --always --dirty)"
|
||||
TAG="$(date +v%Y%m%d)-$(git describe --always --dirty)"
|
||||
IMAGE="kindest/base:${TAG}"
|
||||
|
||||
# build
|
||||
(set -x; "${KIND}" build base-image --image="${IMAGE}" --source="${REPO_ROOT}/images/base/")
|
||||
(set -x; "${REPO_ROOT}/bin/kind" build base-image --image="${IMAGE}" --source="${REPO_ROOT}/images/base/")
|
||||
|
||||
# push
|
||||
docker push "${IMAGE}"
|
||||
|
||||
@@ -21,7 +21,6 @@ cd "${REPO_ROOT}"
|
||||
|
||||
# ensure we have up to date kind
|
||||
make build
|
||||
KIND="${REPO_ROOT}/bin/kind"
|
||||
|
||||
# generate tag
|
||||
DATE="$(date +v%Y%m%d)"
|
||||
@@ -30,7 +29,7 @@ TAG="${DATE}-$(git describe --always --dirty)"
|
||||
# build
|
||||
KUBEROOT="${KUBEROOT:-${GOPATH}/src/k8s.io/kubernetes}"
|
||||
set -x
|
||||
"${KIND}" build node-image --image="kindest/node:${TAG}" --kube-root="${KUBEROOT}"
|
||||
"${REPO_ROOT}/bin/kind" build node-image --image="kindest/node:${TAG}" --kube-root="${KUBEROOT}"
|
||||
|
||||
# re-tag with kubernetes version
|
||||
IMG="kindest/node:${TAG}"
|
||||
|
||||
@@ -20,6 +20,6 @@ set -o errexit -o nounset -o pipefail
|
||||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)"
|
||||
cd "${REPO_ROOT}"
|
||||
|
||||
"${REPO_ROOT}"/hack/update/deps.sh
|
||||
"${REPO_ROOT}"/hack/update/generated.sh
|
||||
"${REPO_ROOT}"/hack/update/gofmt.sh
|
||||
hack/update/deps.sh
|
||||
hack/update/generated.sh
|
||||
hack/update/gofmt.sh
|
||||
|
||||
@@ -23,12 +23,7 @@ set -o errexit -o nounset -o pipefail
|
||||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)"
|
||||
cd "${REPO_ROOT}"
|
||||
|
||||
# enable modules and the proxy cache
|
||||
export GO111MODULE="on"
|
||||
GOPROXY="${GOPROXY:-https://proxy.golang.org}"
|
||||
export GOPROXY
|
||||
|
||||
go mod tidy
|
||||
|
||||
cd "hack/tools"
|
||||
go mod tidy
|
||||
# tidy all modules
|
||||
hack/go_container.sh go mod tidy
|
||||
SOURCE_DIR="${REPO_ROOT}/hack/tools" hack/go_container.sh go mod tidy
|
||||
SOURCE_DIR="${REPO_ROOT}/cmd/kindnetd" hack/go_container.sh go mod tidy
|
||||
@@ -20,26 +20,19 @@ set -o errexit -o nounset -o pipefail
|
||||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)"
|
||||
cd "${REPO_ROOT}"
|
||||
|
||||
# enable modules and the proxy cache
|
||||
export GO111MODULE="on"
|
||||
GOPROXY="${GOPROXY:-https://proxy.golang.org}"
|
||||
export GOPROXY
|
||||
|
||||
# build the generators
|
||||
BINDIR="${REPO_ROOT}/bin"
|
||||
# use the tools module
|
||||
# build the generators using the tools module
|
||||
cd "hack/tools"
|
||||
go build -o "${BINDIR}/defaulter-gen" k8s.io/code-generator/cmd/defaulter-gen
|
||||
go build -o "${BINDIR}/deepcopy-gen" k8s.io/code-generator/cmd/deepcopy-gen
|
||||
go build -o "${BINDIR}/conversion-gen" k8s.io/code-generator/cmd/conversion-gen
|
||||
"${REPO_ROOT}/hack/go_container.sh" go build -o /out/defaulter-gen k8s.io/code-generator/cmd/defaulter-gen
|
||||
"${REPO_ROOT}/hack/go_container.sh" go build -o /out/deepcopy-gen k8s.io/code-generator/cmd/deepcopy-gen
|
||||
"${REPO_ROOT}/hack/go_container.sh" go build -o /out/conversion-gen k8s.io/code-generator/cmd/conversion-gen
|
||||
# go back to the root
|
||||
cd "${REPO_ROOT}"
|
||||
|
||||
# turn off module mode before running the generators
|
||||
# https://github.com/kubernetes/code-generator/issues/69
|
||||
# we also need to populate vendor
|
||||
go mod tidy
|
||||
go mod vendor
|
||||
hack/go_container.sh go mod tidy
|
||||
hack/go_container.sh go mod vendor
|
||||
export GO111MODULE="off"
|
||||
|
||||
# fake being in a gopath
|
||||
@@ -53,15 +46,14 @@ export GOPATH="${FAKE_GOPATH}"
|
||||
cd "${FAKE_REPOPATH}"
|
||||
|
||||
# run the generators
|
||||
"${BINDIR}/deepcopy-gen" -i ./pkg/internal/apis/config/ -O zz_generated.deepcopy --go-header-file hack/tools/boilerplate.go.txt
|
||||
"${BINDIR}/defaulter-gen" -i ./pkg/internal/apis/config/ -O zz_generated.default --go-header-file hack/tools/boilerplate.go.txt
|
||||
bin/deepcopy-gen -i ./pkg/internal/apis/config/ -O zz_generated.deepcopy --go-header-file hack/tools/boilerplate.go.txt
|
||||
bin/defaulter-gen -i ./pkg/internal/apis/config/ -O zz_generated.default --go-header-file hack/tools/boilerplate.go.txt
|
||||
|
||||
"${BINDIR}/deepcopy-gen" -i ./pkg/apis/config/v1alpha3 -O zz_generated.deepcopy --go-header-file hack/tools/boilerplate.go.txt
|
||||
"${BINDIR}/defaulter-gen" -i ./pkg/apis/config/v1alpha3 -O zz_generated.default --go-header-file hack/tools/boilerplate.go.txt
|
||||
"${BINDIR}/conversion-gen" -i ./pkg/internal/apis/config/v1alpha3 -O zz_generated.conversion --go-header-file hack/tools/boilerplate.go.txt
|
||||
bin/deepcopy-gen -i ./pkg/apis/config/v1alpha3 -O zz_generated.deepcopy --go-header-file hack/tools/boilerplate.go.txt
|
||||
bin/defaulter-gen -i ./pkg/apis/config/v1alpha3 -O zz_generated.default --go-header-file hack/tools/boilerplate.go.txt
|
||||
bin/conversion-gen -i ./pkg/internal/apis/config/v1alpha3 -O zz_generated.conversion --go-header-file hack/tools/boilerplate.go.txt
|
||||
|
||||
# set module mode back, return to repo root and gofmt to ensure we format generated code
|
||||
export GO111MODULE="on"
|
||||
cd "${REPO_ROOT}"
|
||||
|
||||
# gofmt the tree
|
||||
find . -name "*.go" -type f -print0 | xargs -0 gofmt -s -w
|
||||
hack/update/gofmt.sh
|
||||
|
||||
@@ -21,4 +21,4 @@ set -o errexit -o nounset -o pipefail
|
||||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)"
|
||||
cd "${REPO_ROOT}"
|
||||
|
||||
find . -name "*.go" -type f -print0 | xargs -0 gofmt -s -w
|
||||
hack/go_container.sh sh -c "find . -name '*.go' -type f -print0 | xargs -0 gofmt -s -w"
|
||||
|
||||
Reference in New Issue
Block a user