File tree Expand file tree Collapse file tree 3 files changed +37
-7
lines changed
Expand file tree Collapse file tree 3 files changed +37
-7
lines changed Original file line number Diff line number Diff line change 8181 run : |
8282 bin/compare.sh --diff-output tmp/diff-output.txt
8383 diff_text=$(cat tmp/diff-output.txt)
84- format_code='```'
84+ format_code_start='```diff'
85+ format_code_end='```'
8586 comment_text="Comparison of Helm chart templating output:
86- $format_code
87+ $format_code_start
8788 $diff_text
88- $format_code "
89+ $format_code_end "
8990 gh pr comment ${{ github.event.pull_request.number }} --body "$comment_text"
Original file line number Diff line number Diff line change 22set -ue
33
44# Usage: bin/compare.sh -l name=loki
5+ # Optional: --diff-output <filename> writes the final diff to a file and skips common chart version information
56# Deps: dyff, helmfile
67# brew install homeport/tap/dyff
78# brew install helmfile
@@ -48,7 +49,7 @@ git -c core.hooksPath=/dev/null checkout $branchB
4849# order of arguments matters so new changes are green color
4950echo " Comparing $targetDirB with $targetDirA "
5051if [ -n " $diffOutput " ]; then
51- " ${script_dir} /dyff.sh" " $targetDirB " " $targetDirA " > " $diffOutput "
52+ " ${script_dir} /dyff.sh" " $targetDirB " " $targetDirA " --exclude-chart-versions > " $diffOutput "
5253 cat " $diffOutput "
5354else
5455 " ${script_dir} /dyff.sh" " $targetDirB " " $targetDirA "
Original file line number Diff line number Diff line change 11#! /bin/bash
22set -ue
33
4- targetDirA=$1
5- targetDirB=$2
4+ targetDirA=
5+ targetDirB=
6+ miscArgs=( --output github )
7+
8+ while [ $# -ne 0 ]
9+ do
10+ case " $1 " in
11+ --exclude-chart-versions)
12+ miscArgs=( " ${miscArgs[@]} " --exclude-regexp ' .*metadata.labels.helm.sh/chart' --exclude-regexp ' .*metadata.labels.app.kubernetes.io/version' )
13+ ;;
14+ * )
15+ if [ -z " $targetDirA " ]; then
16+ targetDirA=$1
17+ elif [ -z " $targetDirB " ]; then
18+ targetDirB=$1
19+ else
20+ echo " Extra argument $1 "
21+ return 1
22+ fi
23+ ;;
24+ esac
25+ shift
26+ done
27+ if [ -z " $targetDirA " ]; then
28+ echo " Missing first argument"
29+ return 1
30+ elif [ -z " $targetDirB " ]; then
31+ echo " Missing second argument"
32+ return 1
33+ fi
634
735set +e
836diff_output=$( diff -q -r " $targetDirA " " $targetDirB " )
@@ -22,6 +50,6 @@ echo "$diff_output" | while read -r line; do
2250 # Use dyff to compare the files
2351 dyff between " $second_path " " $first_path " --omit-header \
2452 --exclude " data.tls.key" --exclude " /data/ca.crt" --exclude " /data/tls.crt" --exclude " /data/tls.key" \
25- --exclude-regexp " /checksum" --exclude-regexp " /webhooks.*" --ignore-order-changes
53+ --exclude-regexp " /checksum" --exclude-regexp " /webhooks.*" --ignore-order-changes " ${miscArgs[@]} "
2654 fi
2755done
You can’t perform that action at this time.
0 commit comments