mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-07-18 02:01:29 +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
|
endif
|
||||||
export PATH := $(MYGOBIN):$(PATH)
|
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
|
include $(KUSTOMIZE_ROOT)/Makefile-tools.mk
|
||||||
|
|
||||||
.PHONY: lint test fix fmt tidy vet
|
.PHONY: lint test fix fmt tidy vet
|
||||||
|
|||||||
@@ -15,8 +15,10 @@ fi
|
|||||||
|
|
||||||
cmd=$1
|
cmd=$1
|
||||||
|
|
||||||
seen=""
|
seen=()
|
||||||
kustomize_root=$(pwd | sed 's|kustomize/.*|kustomize/|')
|
# Hack scripts must be run from the root of the repository.
|
||||||
|
KUSTOMIZE_ROOT=$(pwd)
|
||||||
|
export KUSTOMIZE_ROOT
|
||||||
|
|
||||||
# verify all modules pass validation
|
# verify all modules pass validation
|
||||||
for i in $(find . -name go.mod -not -path "./site/*"); do
|
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
|
set +x
|
||||||
dir=$(pwd)
|
dir=$(pwd)
|
||||||
module="${dir#$kustomize_root}"
|
module="${dir#$KUSTOMIZE_ROOT}"
|
||||||
echo -e "\n----------------------------------------------------------"
|
echo -e "\n----------------------------------------------------------"
|
||||||
echo "Running command in $module"
|
echo "Running command in $module"
|
||||||
echo -e "----------------------------------------------------------"
|
echo -e "----------------------------------------------------------"
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
bash -c "$cmd"
|
bash -c "$cmd"
|
||||||
seen+=" - $module\n"
|
seen+=("$module")
|
||||||
popd
|
popd
|
||||||
done
|
done
|
||||||
|
|
||||||
set +x
|
set +x
|
||||||
echo -e "\n\n----------------------------------------------------------"
|
echo -e "\n\n----------------------------------------------------------"
|
||||||
echo -e "SUCCESS: Ran '$cmd' on the following modules:"
|
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