forked from longhorn/longhorn-manager
-
Notifications
You must be signed in to change notification settings - Fork 1
Chart Update Script
Shuo Wu edited this page Sep 21, 2019
·
2 revisions
#!/bin/bash
set -e
echo "bash update_version.sh <required new version> <optional old version>"
echo "<required new version> is used to update image tag in longhorn repo"
echo "<optional old version> is used to update charts repo"
if [[ $# -le 0 ]]
then
echo "need to specify release version"
exit 1
fi
longhorn_dir="${GOPATH}/src/github.com/longhorn/longhorn"
values_file="${longhorn_dir}/chart/values.yaml"
chart_file="${longhorn_dir}/chart/Chart.yaml"
components=("engineTag\:" "managerTag\:" "uiTag\:")
version=$1
version_num=`echo ${version} | sed -r 's/^.{1}//'`
for c in ${components[@]}
do
sed -i "s/${c}.*/${c} ${version}/g" $values_file
done
sed -i "s/version\:.*/version\: ${version_num}/g" $chart_file
sed -i "s/appVersion\:.*/appVersion\: ${version}/g" $chart_file
echo "updated image version to ${version}"
if [[ $# -eq 2 ]]
then
old_version=$2
charts_dir="${GOPATH}/src/github.com/rancher/charts/proposed/longhorn"
if [ -e "${charts_dir}/${old_version}" ]; then
echo "${charts_dir}/${old_version} exists. will not update charts repo"
else
mv "${charts_dir}/latest" "${charts_dir}/${old_version}"
fi
rm -rf "${charts_dir}/latest"
cp -a "${longhorn_dir}/chart" "${charts_dir}/latest"
rm "${charts_dir}/latest/update_chart_version.sh"
echo "updated longhorn version from ${old_version} to ${version} in charts repo"
fi