@@ -31,6 +31,12 @@ banner() {
3131 printf ' %s\n' " ╚════════════════════════════════════════════════════════════════════════╝"
3232}
3333
34+ # Print a separator line.
35+ separator () {
36+ printf ' ─%.0s' {1..72}
37+ printf ' \n'
38+ }
39+
3440# === Kubernetes Diagnostics ===
3541
3642# Display status of all pods and highlight non-running pods.
@@ -66,22 +72,19 @@ show_events() {
6672# Args: $1 (string, optional) - Number of log lines per pod (default: 30, 0 for all)
6773# $2 (string, optional) - Context prefix for section header (e.g., "Recent ")
6874# $3 (string, optional) - Whether to show previous container logs (default: false)
69- # $4 (string, optional) - Custom separator line
7075# Uses: TRENTO_NAMESPACE environment variable
7176# Outputs: Pod logs for each container
7277show_pod_logs () {
7378 local log_lines=" ${1:- 30} "
7479 local log_context=" ${2:- } "
7580 local show_previous=" ${3:- false} "
76- local separator=" ${4:- ────────────────────────────────────────────────────────────────────────} "
77-
7881 section " === ${log_context} Pod logs (last $log_lines lines each) ==="
7982 local pod
8083 for pod in $( kubectl get pods -n " $TRENTO_NAMESPACE " -o jsonpath=' {.items[*].metadata.name}' ) ; do
8184 echo " "
82- echo " $ separator"
85+ separator
8386 echo " Pod: $pod "
84- echo " $ separator"
87+ separator
8588 kubectl logs -n " $TRENTO_NAMESPACE " " $pod " --all-containers=true --tail=" $log_lines " --ignore-errors=true || echo " No logs available"
8689
8790 if [ " $show_previous " = " true" ]; then
@@ -102,9 +105,9 @@ show_failed_pod_logs() {
102105 if [ -n " $failed_pods " ]; then
103106 for pod in $failed_pods ; do
104107 echo " "
105- echo " ──────────────────────────────────────────────────────────────────────── "
108+ separator
106109 echo " Pod: $pod (last 100 lines)"
107- echo " ──────────────────────────────────────────────────────────────────────── "
110+ separator
108111 kubectl logs -n " $TRENTO_NAMESPACE " " $pod " --all-containers=true --tail=100 --ignore-errors=true || echo " No logs available"
109112 done
110113 else
@@ -150,7 +153,7 @@ compare_versions() {
150153 if [ " $chart_name " != " $current_chart " ]; then
151154 if [ -n " $current_chart " ]; then echo " " ; fi
152155 echo " 📦 Chart: ${chart_name} "
153- echo " ──────────────────────────────────────────────────────────────────────── "
156+ separator
154157 current_chart=" $chart_name "
155158 fi
156159
@@ -182,7 +185,7 @@ compare_versions() {
182185 done < " $new_images_file "
183186
184187 echo " "
185- echo " ──────────────────────────────────────────────────────────────────────── "
188+ separator
186189}
187190
188191# Extract and compare container versions between deployed pods and Helm chart.
@@ -602,6 +605,57 @@ process_obs_package() {
602605 return 0
603606}
604607
608+ # Compare OBS stable and main branches values.yaml
609+ # Args: $1 (string) - Path to stable branch values.yaml
610+ # $2 (string) - Path to main branch values.yaml
611+ # Returns: 0 if identical, 1 if different, 2 on error
612+ # Outputs: Formatted diff showing differences
613+ compare_obs_branches () {
614+ local stable_values=" $1 "
615+ local main_values=" $2 "
616+
617+ if [ ! -f " $stable_values " ]; then
618+ echo " ERROR: Stable values file not found: $stable_values " >&2
619+ return 2
620+ fi
621+
622+ if [ ! -f " $main_values " ]; then
623+ echo " ERROR: Main values file not found: $main_values " >&2
624+ return 2
625+ fi
626+
627+ banner " Comparing OBS stable vs main branch values.yaml "
628+
629+ local tmp_diff
630+ tmp_diff=" $( mktemp) "
631+
632+ local diff_rc=0
633+ diff -u " $stable_values " " $main_values " > " $tmp_diff " || diff_rc=$?
634+
635+ if [ " $diff_rc " -eq 0 ]; then
636+ echo " ✅ No differences between OBS stable and main branches"
637+ rm -f " $tmp_diff "
638+ return 0
639+ fi
640+
641+ if [ " $diff_rc " -ne 1 ]; then
642+ echo " ERROR: diff failed (exit $diff_rc ) while comparing $stable_values and $main_values " >&2
643+ if [ -s " $tmp_diff " ]; then
644+ cat " $tmp_diff "
645+ fi
646+ rm -f " $tmp_diff "
647+ return 2
648+ fi
649+
650+ section " === Differences found between OBS stable and main ==="
651+ cat " $tmp_diff "
652+ rm -f " $tmp_diff "
653+ echo " "
654+ separator
655+ echo " NOTE: These differences may indicate that stable needs to be updated"
656+ return 1
657+ }
658+
605659main () {
606660 case " ${1:- } " in
607661 post-install-diagnostics)
@@ -623,6 +677,10 @@ main() {
623677 shift
624678 process_obs_package " $@ "
625679 ;;
680+ compare-obs-branches)
681+ shift
682+ compare_obs_branches " $@ "
683+ ;;
626684 * )
627685 printf ' %s\n' " Usage: upgrade-test.sh <command>" >&2
628686 printf ' %s\n' " " >&2
@@ -633,6 +691,7 @@ main() {
633691 printf ' %s\n' " verify-api" >&2
634692 printf ' %s\n' " failure-diagnostics" >&2
635693 printf ' %s\n' " process-obs-package <git-url> [workspace-dir]" >&2
694+ printf ' %s\n' " compare-obs-branches <stable-values> <main-values>" >&2
636695 exit 1
637696 ;;
638697 esac
0 commit comments