Skip to content

Commit 98b9c66

Browse files
authored
chore: check manifest addon charts images (#621)
1 parent a6bd731 commit 98b9c66

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

.github/utils/manifests_charts_image_check.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,54 @@ check_images() {
102102
done
103103
}
104104

105+
check_addon_charts_images() {
106+
chart_version_tmp=${1:-""}
107+
chart_name_tmp=${2:-""}
108+
chart_images_tmp=${3:-""}
109+
addon_charts_images=""
110+
charts_name=$(yq e "to_entries|map(.key)|.[]" ${MANIFESTS_FILE})
111+
for chart_name in $(echo "$charts_name"); do
112+
if [[ -z "$chart_name" || "$chart_name" == "#"* || "$chart_name" == "kata" ]]; then
113+
continue
114+
fi
115+
chart_versions=$(yq e '[.'${chart_name}'[].version] | join("|")' ${MANIFESTS_FILE})
116+
chart_index=0
117+
for chart_version in $(echo "$chart_versions" | sed 's/|/ /g'); do
118+
engine_type=$(yq e "."${chart_name}"[${chart_index}].type" ${MANIFESTS_FILE})
119+
if [[ "${engine_type}" == "engine" ]]; then
120+
addon_charts_image="apecloud/apecloud-addon-charts:${chart_name}-${chart_version}"
121+
addon_charts_images="${addon_charts_images}|${addon_charts_image}"
122+
fi
123+
chart_index=$(( $chart_index + 1 ))
124+
done
125+
done
126+
if [[ -n "$addon_charts_images" ]]; then
127+
repository=""
128+
check_flag_all=0
129+
for image in $( echo "$addon_charts_images" | sed 's/|/ /g'); do
130+
repository=$image
131+
echo "check image: $repository"
132+
check_flag=0
133+
for chart_image in $( echo "$chart_images_tmp" ); do
134+
if [[ "$chart_image" == "$repository" ]]; then
135+
check_flag=1
136+
break
137+
fi
138+
done
139+
140+
if [[ $check_flag -eq 0 ]]; then
141+
check_flag_all=1
142+
echo "$(tput -T xterm setaf 1)::error title=Not found ${chart_name_tmp} ${chart_version_tmp} image:$repository in manifests file:${MANIFESTS_FILE}$(tput -T xterm sgr0)"
143+
echo 1 > exit_result
144+
fi
145+
repository=""
146+
done
147+
if [[ $check_flag_all -eq 0 ]]; then
148+
echo "$(tput -T xterm setaf 2)Check addon charts in ${chart_name_tmp} ${chart_version_tmp} success$(tput -T xterm sgr0)"
149+
fi
150+
fi
151+
}
152+
105153
check_charts_images() {
106154
touch exit_result
107155
echo 0 > exit_result
@@ -153,6 +201,9 @@ check_charts_images() {
153201
continue
154202
;;
155203
esac
204+
if [[ "$chart_name" == "kubeblocks-cloud" ]]; then
205+
check_addon_charts_images "$chart_version" "$chart_name" "$chart_images" &
206+
fi
156207
check_images "$is_enterprise" "$chart_version" "$chart_name" "$chart_images" "$set_values" &
157208
chart_index=$(( $chart_index + 1 ))
158209
done

0 commit comments

Comments
 (0)