mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-10 08:20:59 +00:00
Fix root var and add sanity check
This commit is contained in:
@@ -4,8 +4,8 @@ MYGOBIN = $(shell go env GOPATH)/bin
|
||||
endif
|
||||
export PATH := $(MYGOBIN):$(PATH)
|
||||
|
||||
export KUSTOMIZE_ROOT=$(shell pwd | sed 's|kustomize/.*|kustomize/|')
|
||||
|
||||
# only set this if not already set, so importing makefiles can override it
|
||||
export KUSTOMIZE_ROOT ?= $(shell pwd | sed -E 's|(.*\/kustomize).*|\1|')
|
||||
include $(KUSTOMIZE_ROOT)/Makefile-tools.mk
|
||||
|
||||
.PHONY: lint test fix fmt tidy vet
|
||||
|
||||
@@ -15,8 +15,10 @@ fi
|
||||
|
||||
cmd=$1
|
||||
|
||||
seen=""
|
||||
kustomize_root=$(pwd | sed 's|kustomize/.*|kustomize/|')
|
||||
seen=()
|
||||
# Hack scripts must be run from the root of the repository.
|
||||
KUSTOMIZE_ROOT=$(pwd)
|
||||
export KUSTOMIZE_ROOT
|
||||
|
||||
# verify all modules pass validation
|
||||
for i in $(find . -name go.mod -not -path "./site/*"); do
|
||||
@@ -25,18 +27,25 @@ for i in $(find . -name go.mod -not -path "./site/*"); do
|
||||
|
||||
set +x
|
||||
dir=$(pwd)
|
||||
module="${dir#$kustomize_root}"
|
||||
module="${dir#$KUSTOMIZE_ROOT}"
|
||||
echo -e "\n----------------------------------------------------------"
|
||||
echo "Running command in $module"
|
||||
echo -e "----------------------------------------------------------"
|
||||
set -x
|
||||
|
||||
bash -c "$cmd"
|
||||
seen+=" - $module\n"
|
||||
seen+=("$module")
|
||||
popd
|
||||
done
|
||||
|
||||
set +x
|
||||
echo -e "\n\n----------------------------------------------------------"
|
||||
echo -e "SUCCESS: Ran '$cmd' on the following modules:"
|
||||
echo -e "$seen"
|
||||
printf " - %s\n" "${seen[@]}"
|
||||
|
||||
EXPECTED_MODULE_COUNT=44
|
||||
if [[ "${#seen[@]}" -ne $EXPECTED_MODULE_COUNT ]]; then
|
||||
echo
|
||||
echo "SANITY CHECK FAILURE: Expected to see $EXPECTED_MODULE_COUNT modules, but saw ${#seen[@]}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../Makefile-modules.mk
|
||||
3
kustomize/Makefile
Normal file
3
kustomize/Makefile
Normal file
@@ -0,0 +1,3 @@
|
||||
export KUSTOMIZE_ROOT=$(shell cd .. && pwd)
|
||||
|
||||
include ../Makefile-modules.mk
|
||||
Reference in New Issue
Block a user