mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-29 09:40:49 +00:00
Makefiles for all modules
This commit is contained in:
42
hack/for-each-module.sh
Executable file
42
hack/for-each-module.sh
Executable 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"
|
||||
Reference in New Issue
Block a user