@@ -11,10 +11,44 @@ if [[ -z "$CHARTS_DIR" ]]; then
1111 exit 1
1212fi
1313
14+ # Charts maintained by Wire (should not contain bitnami refs)
15+ # These charts are excluded from patching to avoid masking potential issues
16+ PATCH_EXCLUDE_LIST=(
17+ " wire-server"
18+ " wire-server-enterprise"
19+ " backoffice"
20+ " ldap-scim-bridge"
21+ " account-pages"
22+ " webapp"
23+ " team-settings"
24+ " sftd"
25+ " calling-test"
26+ " migrate-features"
27+ " wire-utility"
28+ " fake-aws"
29+ " fake-aws-s3"
30+ " fake-aws-sqs"
31+ " demo-smtp"
32+ " inbucket"
33+ )
34+
1435echo " Patching bitnami repository references in: $CHARTS_DIR "
36+ echo " Excluded charts: ${PATCH_EXCLUDE_LIST[*]} "
1537
1638patched_count=0
1739file_count=0
40+ skipped_count=0
41+
42+ # Function to check if chart should be excluded from patching
43+ is_excluded_chart () {
44+ local chart_name=" $1 "
45+ for excluded in " ${PATCH_EXCLUDE_LIST[@]} " ; do
46+ if [[ " $chart_name " == " $excluded " ]]; then
47+ return 0 # true - chart is excluded
48+ fi
49+ done
50+ return 1 # false - chart should be patched
51+ }
1852
1953# Function to patch a single file
2054patch_file () {
@@ -31,6 +65,12 @@ patch_file() {
3165 chart_name=" unknown"
3266 fi
3367
68+ # Check if this chart should be excluded from patching
69+ if is_excluded_chart " $chart_name " ; then
70+ rm " $temp_file "
71+ return 2 # Special return code for skipped charts
72+ fi
73+
3474 # Apply sed replacements for various image reference patterns
3575 sed -e ' s|repository: bitnami/|repository: bitnamilegacy/|g' \
3676 -e ' s|repository: docker\.io/bitnami/|repository: docker.io/bitnamilegacy/|g' \
@@ -73,31 +113,45 @@ echo "Scanning and patching files..."
73113# Process values.yaml files
74114while IFS= read -r -d ' ' file; do
75115 file_count=$(( file_count + 1 ))
76- if patch_file " $file " ; then
116+ patch_file " $file "
117+ rc=$?
118+ if [[ $rc -eq 0 ]]; then
77119 patched_count=$(( patched_count + 1 ))
120+ elif [[ $rc -eq 2 ]]; then
121+ skipped_count=$(( skipped_count + 1 ))
78122 fi
79123done < <( find " $CHARTS_DIR " -name " values.yaml" -print0)
80124
81125# Process Chart.yaml files
82126while IFS= read -r -d ' ' file; do
83127 file_count=$(( file_count + 1 ))
84- if patch_file " $file " ; then
128+ patch_file " $file "
129+ rc=$?
130+ if [[ $rc -eq 0 ]]; then
85131 patched_count=$(( patched_count + 1 ))
132+ elif [[ $rc -eq 2 ]]; then
133+ skipped_count=$(( skipped_count + 1 ))
86134 fi
87135done < <( find " $CHARTS_DIR " -name " Chart.yaml" -print0)
88136
89137# Process template files (for direct image references)
90138while IFS= read -r -d ' ' file; do
91139 file_count=$(( file_count + 1 ))
92- if patch_file " $file " ; then
140+ patch_file " $file "
141+ rc=$?
142+ if [[ $rc -eq 0 ]]; then
93143 patched_count=$(( patched_count + 1 ))
144+ elif [[ $rc -eq 2 ]]; then
145+ skipped_count=$(( skipped_count + 1 ))
94146 fi
95147done < <( find " $CHARTS_DIR " -path " */templates/*.yaml" -print0)
96148
97149echo
98150echo " === Patching Summary ==="
99151echo " Files processed: $file_count "
152+ echo " Files skipped (excluded charts): $skipped_count "
100153echo " Files modified: $patched_count "
154+ echo " Files unchanged: $(( file_count - skipped_count - patched_count)) "
101155
102156if [[ $patched_count -gt 0 ]]; then
103157 echo
0 commit comments