mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 20:53:33 +00:00
Merge pull request #48964 from ixdy/switch-to-kazel
Automatic merge from submit-queue Switch from gazel to kazel **What this PR does / why we need it**: switches to `kazel`, where all new development will be focused. Part of the effort for switching from `gazel` to `gazelle`. I'm imagining that we'll use `kube::util::go_install_from_commit` to version `gazelle` as well. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: x-ref #47558 **Release note**: ```release-note NONE ``` /release-note-none /assign @mikedanese @spxtr
This commit is contained in:
commit
3fb2d8248d
1
.kazelcfg.json
Symbolic link
1
.kazelcfg.json
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
build/root/.kazelcfg.json
|
@ -513,6 +513,23 @@ kube::util::ensure_godep_version() {
|
|||||||
godep version
|
godep version
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Installs the specified go package at a particular commit.
|
||||||
|
kube::util::go_install_from_commit() {
|
||||||
|
local -r pkg=$1
|
||||||
|
local -r commit=$2
|
||||||
|
|
||||||
|
kube::util::ensure-temp-dir
|
||||||
|
mkdir -p "${KUBE_TEMP}/go/src"
|
||||||
|
GOPATH="${KUBE_TEMP}/go" go get -d -u "${pkg}" 2>/dev/null
|
||||||
|
(
|
||||||
|
cd "${KUBE_TEMP}/go/src/${pkg}"
|
||||||
|
git checkout -q "${commit}"
|
||||||
|
GOPATH="${KUBE_TEMP}/go" go install "${pkg}"
|
||||||
|
)
|
||||||
|
PATH="${KUBE_TEMP}/go/bin:${PATH}"
|
||||||
|
hash -r # force bash to clear PATH cache
|
||||||
|
}
|
||||||
|
|
||||||
# Checks that the GOPATH is simple, i.e. consists only of one directory, not multiple.
|
# Checks that the GOPATH is simple, i.e. consists only of one directory, not multiple.
|
||||||
kube::util::ensure_single_dir_gopath() {
|
kube::util::ensure_single_dir_gopath() {
|
||||||
if [[ "${GOPATH}" == *:* ]]; then
|
if [[ "${GOPATH}" == *:* ]]; then
|
||||||
|
@ -20,21 +20,10 @@ set -o pipefail
|
|||||||
export KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
export KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
|
|
||||||
# Remove generated files prior to running gazel.
|
# Remove generated files prior to running kazel.
|
||||||
# TODO(spxtr): Remove this line once Bazel is the only way to build.
|
# TODO(spxtr): Remove this line once Bazel is the only way to build.
|
||||||
rm -f "${KUBE_ROOT}/pkg/generated/openapi/zz_generated.openapi.go"
|
rm -f "${KUBE_ROOT}/pkg/generated/openapi/zz_generated.openapi.go"
|
||||||
|
|
||||||
go get -u gopkg.in/mikedanese/gazel.v17/gazel
|
kube::util::go_install_from_commit github.com/kubernetes/repo-infra/kazel fd3ec969104295f8484a32114ce625955a67365d
|
||||||
|
|
||||||
for path in ${GOPATH//:/ }; do
|
kazel -root="$(kube::realpath ${KUBE_ROOT})"
|
||||||
if [[ -e "${path}/bin/gazel" ]]; then
|
|
||||||
gazel="${path}/bin/gazel"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [[ -z "${gazel:-}" ]]; then
|
|
||||||
echo "Couldn't find gazel on the GOPATH."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
"${gazel}" -root="$(kube::realpath ${KUBE_ROOT})"
|
|
||||||
|
@ -20,25 +20,13 @@ set -o pipefail
|
|||||||
export KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
export KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
|
|
||||||
go get gopkg.in/mikedanese/gazel.v17/gazel
|
# Remove generated files prior to running kazel.
|
||||||
|
|
||||||
# Remove generated files prior to running gazel.
|
|
||||||
# TODO(spxtr): Remove this line once Bazel is the only way to build.
|
# TODO(spxtr): Remove this line once Bazel is the only way to build.
|
||||||
rm -f "${KUBE_ROOT}/pkg/generated/openapi/zz_generated.openapi.go"
|
rm -f "${KUBE_ROOT}/pkg/generated/openapi/zz_generated.openapi.go"
|
||||||
|
|
||||||
for path in ${GOPATH//:/ }; do
|
kube::util::go_install_from_commit github.com/kubernetes/repo-infra/kazel fd3ec969104295f8484a32114ce625955a67365d
|
||||||
if [[ -e "${path}/bin/gazel" ]]; then
|
|
||||||
gazel="${path}/bin/gazel"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [[ -z "${gazel:-}" ]]; then
|
|
||||||
echo "Couldn't find gazel on the GOPATH."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
if ! kazel -validate -print-diff -root="$(kube::realpath ${KUBE_ROOT})" ; then
|
||||||
if ! "${gazel}" -validate -print-diff -root="$(kube::realpath ${KUBE_ROOT})" ; then
|
|
||||||
echo
|
echo
|
||||||
echo "Run ./hack/update-bazel.sh"
|
echo "Run ./hack/update-bazel.sh"
|
||||||
exit 1
|
exit 1
|
||||||
|
Loading…
Reference in New Issue
Block a user