Skip to content

Commit 0aaaf99

Browse files
authored
Update kustdiff
1 parent 3d94a6b commit 0aaaf99

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

kustdiff

+14-12
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ DEBUG="${DEBUG:-true}"
88

99
function debug_log() {
1010
if [ "$DEBUG" = "true" ]; then
11-
printf "[DEBUG] %s" "$1"
11+
printf "[DEBUG] %s \n" "$1"
1212
fi
1313
}
1414

@@ -20,25 +20,27 @@ function safe_dirname() {
2020
echo "$1" | sed 's/[^a-zA-Z0-9.]/_/g'
2121
}
2222

23+
function safe_filename() {
24+
echo "$1" | sed 's/[^a-zA-Z0-9.]/_/g'
25+
}
26+
2327
function build {
2428
local ref="$1"
25-
local safe_ref=$(safe_dirname "$ref")
29+
local safe_ref=$(safe_filename "$ref")
2630
echo "Checking out ref: $ref"
2731
git checkout "$ref" --quiet
32+
mkdir -p "$TMP_DIR/$safe_ref"
2833
for envpath in $(get_targets); do
29-
3034
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"
3638
kustomize build "$envpath" -o "$output_file"
3739

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 "------------------------------------"
4244
done
4345
}
4446

0 commit comments

Comments
 (0)