File tree 1 file changed +12
-4
lines changed
1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 3
3
set -eux
4
4
5
5
TMP_DIR=" $( mktemp -d) "
6
+ ROOT_DIR=" ${1:- ./ clusters} " # Default to ./clusters if no argument is provided
6
7
7
8
function get_targets {
8
- find . -maxdepth 4 -name kustomization.yaml -exec dirname {} \;
9
- find . -mindepth 4 -maxdepth 4 -name kustomization.yaml -exec dirname {} \; | sort | uniq | grep variant
9
+ find " $ROOT_DIR " -maxdepth 4 -name kustomization.yaml -exec dirname {} \;
10
10
}
11
11
12
12
function build {
@@ -16,10 +16,10 @@ function build {
16
16
for envpath in $( get_targets) ; do
17
17
local build_dir
18
18
if ! [ -d " $envpath " ]; then continue ; fi
19
- build_dir=" $TMP_DIR /$ref /${envpath#* kustomize / } "
19
+ local build_dir=" $TMP_DIR /$ref /${envpath# $ROOT_DIR / } "
20
20
printf " \n\nCreating build directory: %s\n" " $build_dir "
21
21
mkdir -p " $build_dir "
22
- echo " Running kustomize"
22
+ printf " Running kustomize\n "
23
23
kustomize build " $envpath " -o " $build_dir "
24
24
done
25
25
}
@@ -44,4 +44,12 @@ function main {
44
44
printf " \n\nOutput: %s\n" " $escaped_output "
45
45
}
46
46
47
+ # Check if a directory is provided as an argument
48
+ if [ $# -ge 1 ]; then
49
+ ROOT_DIR=" $1 "
50
+ fi
51
+
52
+ echo " Using root directory: $ROOT_DIR "
53
+ main
54
+
47
55
main
You can’t perform that action at this time.
0 commit comments