@@ -28,40 +28,43 @@ FILE_TO_UPDATE_HELM_CHART_VERSION=(
2828)
2929
3030 usage () {
31- echo " Usage: $0 <ic_version > <helm_chart_version >"
31+ echo " Usage: $0 <current_ic_version > <current_helm_chart_version> <new_ic_version> <new_helm_chart_version >"
3232 exit 1
3333 }
3434
35- if ! command -v yq > /dev/null 2>&1 ; then
36- echo " ERROR: yq command not found in \$ PATH, cannot continue, exiting..."
37- exit 2
35+ current_ic_version=$1
36+ current_helm_chart_version=$2
37+ new_ic_version=$3
38+ new_helm_chart_version=$4
39+
40+ if [ -z " ${current_ic_version} " ]; then
41+ usage
3842fi
3943
40- ic_version=$1
41- helm_chart_version=$2
44+ if [ -z " ${current_helm_chart_version} " ]; then
45+ usage
46+ fi
4247
43- if [ -z " ${ic_version } " ]; then
48+ if [ -z " ${new_ic_version } " ]; then
4449 usage
4550fi
4651
47- if [ -z " ${helm_chart_version } " ]; then
52+ if [ -z " ${new_helm_chart_version } " ]; then
4853 usage
4954fi
5055
51- current_ic_version=$( yq ' .appVersion' < " ${HELM_CHART_PATH} /Chart.yaml" )
5256escaped_current_ic_version=$( printf ' %s' " $current_ic_version " | sed -e ' s/\./\\./g' ) ;
53- current_helm_chart_version=$( yq ' .version' < " ${HELM_CHART_PATH} /Chart.yaml" )
5457escaped_current_helm_chart_version=$( printf ' %s' " $current_helm_chart_version " | sed -e ' s/\./\\./g' ) ;
5558
5659echo " Updating versions: "
57- echo " ic_version: ${current_ic_version} -> ${ic_version } "
58- echo " helm_chart_version: ${current_helm_chart_version} -> ${helm_chart_version } "
60+ echo " ic_version: ${current_ic_version} -> ${new_ic_version } "
61+ echo " helm_chart_version: ${current_helm_chart_version} -> ${new_helm_chart_version } "
5962
60- regex_ic=" s#$escaped_current_ic_version #$ic_version #g"
61- regex_helm=" s#$escaped_current_helm_chart_version #$helm_chart_version #g"
63+ regex_ic=" s#$escaped_current_ic_version #$new_ic_version #g"
64+ regex_helm=" s#$escaped_current_helm_chart_version #$new_helm_chart_version #g"
6265
6366mv " ${HELM_CHART_PATH} /values.schema.json" " ${TMPDIR} /"
64- jq --arg version " ${ic_version } " \
67+ jq --arg version " ${new_ic_version } " \
6568 ' .properties.controller.properties.image.properties.tag.default = $version | .properties.controller.properties.image.properties.tag.examples[0] = $version | .properties.controller.examples[0].image.tag = $version | .properties.controller.properties.image.examples[0].tag = $version | .examples[0].controller.image.tag = $version' \
6669 ${TMPDIR} /values.schema.json \
6770 > " ${HELM_CHART_PATH} /values.schema.json"
0 commit comments