mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 10:20:51 +00:00
Rename *-hack-tools.sh -> *-internal-modules.sh
Prep to add more such modules
This commit is contained in:
parent
3aa319c894
commit
105e8f8467
@ -21,19 +21,27 @@ set -o pipefail
|
|||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
|
|
||||||
|
# These are "internal" modules. For various reasons, we want them to be
|
||||||
|
# decoupled from their parent modules.
|
||||||
|
MODULES=(
|
||||||
|
hack/tools
|
||||||
|
)
|
||||||
|
|
||||||
# Explicitly opt into go modules, even though we're inside a GOPATH directory
|
# Explicitly opt into go modules, even though we're inside a GOPATH directory
|
||||||
export GO111MODULE=on
|
export GO111MODULE=on
|
||||||
|
|
||||||
# Detect problematic GOPROXY settings that prevent lookup of dependencies
|
# Detect problematic GOPROXY settings that prevent lookup of dependencies
|
||||||
if [[ "${GOPROXY:-}" == "off" ]]; then
|
if [[ "${GOPROXY:-}" == "off" ]]; then
|
||||||
kube::log::error "Cannot run hack/update-hack-tools.sh with \$GOPROXY=off"
|
kube::log::error "Cannot run hack/update-internal-modules.sh with \$GOPROXY=off"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
kube::golang::verify_go_version
|
kube::golang::verify_go_version
|
||||||
|
|
||||||
pushd "${KUBE_ROOT}/hack/tools" >/dev/null
|
for mod in "${MODULES[@]}"; do
|
||||||
echo "=== tidying go.mod/go.sum in hack/tools"
|
pushd "${KUBE_ROOT}/${mod}" >/dev/null
|
||||||
|
echo "=== tidying go.mod/go.sum in ${mod}"
|
||||||
go mod edit -fmt
|
go mod edit -fmt
|
||||||
go mod tidy
|
go mod tidy
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
|
done
|
@ -21,24 +21,26 @@ set -o pipefail
|
|||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||||
source "${KUBE_ROOT}/hack/lib/init.sh"
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
|
|
||||||
_tmpdir="$(kube::realpath "$(mktemp -d -t verify-hack-tools.XXXXXX)")"
|
kube::util::ensure_clean_working_dir
|
||||||
kube::util::trap_add "rm -rf ${_tmpdir}" EXIT
|
|
||||||
|
_tmpdir="$(kube::realpath "$(mktemp -d -t verify-internal-modules.XXXXXX)")"
|
||||||
|
#kube::util::trap_add "rm -rf ${_tmpdir}" EXIT
|
||||||
|
|
||||||
_tmp_gopath="${_tmpdir}/go"
|
_tmp_gopath="${_tmpdir}/go"
|
||||||
_tmp_kuberoot="${_tmp_gopath}/src/k8s.io/kubernetes"
|
_tmp_kuberoot="${_tmp_gopath}/src/k8s.io/kubernetes"
|
||||||
_tmp_hack="${_tmp_gopath}/src/k8s.io/kubernetes/hack"
|
git worktree add -f "${_tmp_kuberoot}" HEAD
|
||||||
mkdir -p "${_tmp_hack}/.."
|
kube::util::trap_add "git worktree remove -f ${_tmp_kuberoot}" EXIT
|
||||||
cp -a "${KUBE_ROOT}/hack" "${_tmp_hack}/.."
|
|
||||||
|
|
||||||
pushd "${_tmp_kuberoot}" >/dev/null
|
pushd "${_tmp_kuberoot}" >/dev/null
|
||||||
./hack/update-hack-tools.sh
|
./hack/update-internal-modules.sh
|
||||||
popd
|
popd
|
||||||
|
|
||||||
diff=$(diff -Naupr "${KUBE_ROOT}/hack" "${_tmp_kuberoot}/hack" || true)
|
git -C "${_tmp_kuberoot}" add -N .
|
||||||
|
diff=$(git -C "${_tmp_kuberoot}" diff HEAD || true)
|
||||||
|
|
||||||
if [[ -n "${diff}" ]]; then
|
if [[ -n "${diff}" ]]; then
|
||||||
echo "${diff}" >&2
|
echo "${diff}" >&2
|
||||||
echo >&2
|
echo >&2
|
||||||
echo "Run ./hack/update-hack-tools.sh" >&2
|
echo "Run ./hack/update-internal-modules.sh" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
Loading…
Reference in New Issue
Block a user