Skip to content

Commit

Permalink
fix: dyff summary の内容を調整する
Browse files Browse the repository at this point in the history
  • Loading branch information
yukin01 committed Sep 15, 2023
1 parent 96c63bc commit f75b510
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
16 changes: 13 additions & 3 deletions manifest-analyzer/dyff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -31,6 +39,8 @@ rc=$?
tee "$output_file" << EOS
### $(get_emoji $rc) dyff [$head_dir]
$(get_message $rc)
<details><summary>show outputs</summary>
\`\`\`diff
Expand Down
6 changes: 4 additions & 2 deletions manifest-analyzer/kustomize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f75b510

Please sign in to comment.