Makefiles for all modules

This commit is contained in:
Katrina Verey
2022-04-01 15:45:48 -04:00
parent 2a9adbeb1e
commit 0d32543ebd
49 changed files with 152 additions and 41 deletions

View File

@@ -1,22 +0,0 @@
#!/usr/bin/env bash
# Copyright 2019 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0
set -x
set -e
# verify all modules pass validation
for i in $(find . -name go.mod -not -path "./site/*"); do
pushd .
cd $(dirname $i);
go list -m -json all > /dev/null
go mod tidy -v
popd
done
# Need better check. This is repeated git diff check
# more pain than benefit for most people 25Apr2020
## verify no changes to go.mods -- these should be part of the PR
# find . -name go.sum | xargs git checkout --
# git add .
# git diff-index HEAD --exit-code

42
hack/for-each-module.sh Executable file
View File

@@ -0,0 +1,42 @@
#!/usr/bin/env bash
# Copyright 2019 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0
set -x
set -e
set -o pipefail
set -o nounset
if [[ -z "${1-}" ]] ; then
echo "Usage: $0 <cmd>"
echo "Example: $0 lint"
exit 1
fi
cmd=$1
seen=""
kustomize_root=$(pwd | sed 's|kustomize/.*|kustomize/|')
# verify all modules pass validation
for i in $(find . -name go.mod -not -path "./site/*"); do
pushd .
cd $(dirname $i);
set +x
dir=$(pwd)
module="${dir#$kustomize_root}"
echo -e "\n----------------------------------------------------------"
echo "Running command in $module"
echo -e "----------------------------------------------------------"
set -x
bash -c "$cmd"
seen+=" - $module\n"
popd
done
set +x
echo -e "\n\n----------------------------------------------------------"
echo -e "SUCCESS: Ran '$cmd' on the following modules:"
echo -e "$seen"