From 508c00e155d1e483cc7afcd2fab0803b27b9db9c Mon Sep 17 00:00:00 2001 From: yukin01 <38382781+yukin01@users.noreply.github.com> Date: Fri, 15 Sep 2023 15:41:17 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20dyff=20summary=20=E3=81=AE=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E3=82=92=E8=AA=BF=E6=95=B4=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manifest-analyzer/dyff.sh | 18 +++++++++++++++--- manifest-analyzer/kustomize.sh | 6 ++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/manifest-analyzer/dyff.sh b/manifest-analyzer/dyff.sh index 6357a53..bbf85b7 100755 --- a/manifest-analyzer/dyff.sh +++ b/manifest-analyzer/dyff.sh @@ -9,15 +9,23 @@ head_manifest=head.yaml output_file=dyff.md function get_emoji() { - if [[ $1 -eq 0 ]]; then + if [[ $1 -eq 0 || $1 -eq 1 ]]; then echo ✅ - elif [[ $1 -eq 1 ]]; then - echo 💡 else echo 💥 fi } +function get_message() { + if [[ $1 -eq 0 ]]; then + echo "no changes detected 🎉" + elif [[ $1 -eq 1 ]]; then + echo "some changes detected 👀" + else + echo "dyff failed" + fi +} + diff_output="" if [[ -s "$base_manifest" ]]; then diff_output=$(dyff between "$base_manifest" "$head_manifest" --color off --set-exit-code 2>&1) @@ -31,6 +39,10 @@ rc=$? tee "$output_file" << EOS ### $(get_emoji $rc) dyff [$head_dir] +\`\`\` +$(get_message $rc) +\`\`\` +
show outputs \`\`\`diff diff --git a/manifest-analyzer/kustomize.sh b/manifest-analyzer/kustomize.sh index 33874d7..e5ab9cd 100755 --- a/manifest-analyzer/kustomize.sh +++ b/manifest-analyzer/kustomize.sh @@ -12,13 +12,15 @@ echo "kustomize head directory: $head_dir" echo "working directory: $(pwd)" if [[ -d "$base_dir" ]]; then - kustomize build "$base_dir" > "$base_manifest" + echo "kustomize build $base_dir" + kustomize build "$base_dir" -o "$base_manifest" else touch "$base_manifest" fi if [[ -d "$head_dir" ]]; then - kustomize build "$head_dir" > "$head_manifest" + echo "kustomize build $head_dir" + kustomize build "$head_dir" -o "$head_manifest" else echo "head directory not found: $head_dir" exit 1