@@ -8,7 +8,7 @@ DEBUG="${DEBUG:-true}"
8
8
9
9
function debug_log() {
10
10
if [ " $DEBUG " = " true" ]; then
11
- printf " [DEBUG] %s" " $1 "
11
+ printf " [DEBUG] %s \n " " $1 "
12
12
fi
13
13
}
14
14
@@ -20,25 +20,27 @@ function safe_dirname() {
20
20
echo " $1 " | sed ' s/[^a-zA-Z0-9.]/_/g'
21
21
}
22
22
23
+ function safe_filename() {
24
+ echo " $1 " | sed ' s/[^a-zA-Z0-9.]/_/g'
25
+ }
26
+
23
27
function build {
24
28
local ref=" $1 "
25
- local safe_ref=$( safe_dirname " $ref " )
29
+ local safe_ref=$( safe_filename " $ref " )
26
30
echo " Checking out ref: $ref "
27
31
git checkout " $ref " --quiet
32
+ mkdir -p " $TMP_DIR /$safe_ref "
28
33
for envpath in $( get_targets) ; do
29
-
30
34
local relative_path=" ${envpath# $ROOT_DIR / } "
31
- local build_dir=" $TMP_DIR /$safe_ref /$relative_path "
32
- printf " Creating build directory: %s\n" " $build_dir "
33
- mkdir -p " $build_dir "
34
- local output_file=" $build_dir /manifests.yaml"
35
- printf " Running kustomize for %s\n" " $envpath "
35
+ local safe_path=$( safe_filename " $relative_path " )
36
+ local output_file=" $TMP_DIR /$safe_ref /${safe_path} .yaml"
37
+ echo " Running kustomize for $envpath "
36
38
kustomize build " $envpath " -o " $output_file "
37
39
38
- # debug_log "Contents of $output_file:"
39
- # debug_log "$(cat "$output_file")"
40
- # debug_log "End of $output_file"
41
- # debug_log "------------------------------------"
40
+ # debug_log "Contents of $output_file:"
41
+ # debug_log "$(cat "$output_file")"
42
+ # debug_log "End of $output_file"
43
+ # debug_log "------------------------------------"
42
44
done
43
45
}
44
46
0 commit comments