build: enclose shell variables in {}

enclose the shell variables in `{}` deploy.sh

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2021-06-08 15:03:17 +05:30 committed by Madhu Rajanna
parent 08c8272282
commit 3e9aafd730

View File

@ -61,29 +61,29 @@ push_helm_charts() {
# update information in Chart.yaml if the branch is not devel # update information in Chart.yaml if the branch is not devel
if [ "${BRANCH_NAME}" != "devel" ]; then if [ "${BRANCH_NAME}" != "devel" ]; then
# Replace appVersion: canary and version: *-canary with the actual version # Replace appVersion: canary and version: *-canary with the actual version
sed -i "s/\(\s.*canary\)/ $VERSION/" "charts/ceph-csi-$PACKAGE/Chart.yaml" sed -i "s/\(\s.*canary\)/ ${VERSION}/" "charts/ceph-csi-${PACKAGE}/Chart.yaml"
if [[ "$VERSION" == *"canary"* ]]; then if [[ "${VERSION}" == *"canary"* ]]; then
# Replace devel with the version branch # Replace devel with the version branch
sed -i "s/devel/$BRANCH_NAME/" "charts/ceph-csi-$PACKAGE/Chart.yaml" sed -i "s/devel/${BRANCH_NAME}/" "charts/ceph-csi-${PACKAGE}/Chart.yaml"
else else
# This is not a canary release, replace devel with the tagged branch # This is not a canary release, replace devel with the tagged branch
sed -i "s/devel/v$VERSION/" "charts/ceph-csi-$PACKAGE/templates/NOTES.txt" sed -i "s/devel/v${VERSION}/" "charts/ceph-csi-${PACKAGE}/templates/NOTES.txt"
sed -i "s/devel/v$VERSION/" "charts/ceph-csi-$PACKAGE/Chart.yaml" sed -i "s/devel/v${VERSION}/" "charts/ceph-csi-${PACKAGE}/Chart.yaml"
fi fi
fi fi
mkdir -p "$CHARTDIR/csi-charts/docs/$PACKAGE" mkdir -p "${CHARTDIR}/csi-charts/docs/${PACKAGE}"
cp -R "./charts/ceph-csi-$PACKAGE" "$CHARTDIR/csi-charts/docs/$PACKAGE" cp -R "./charts/ceph-csi-${PACKAGE}" "${CHARTDIR}/csi-charts/docs/${PACKAGE}"
pushd "$CHARTDIR/csi-charts/docs/$PACKAGE" >/dev/null pushd "${CHARTDIR}/csi-charts/docs/${PACKAGE}" >/dev/null
helm package "ceph-csi-$PACKAGE" helm package "ceph-csi-${PACKAGE}"
popd >/dev/null popd >/dev/null
pushd "$CHARTDIR/csi-charts/docs" >/dev/null pushd "${CHARTDIR}/csi-charts/docs" >/dev/null
helm repo index . helm repo index .
git add --all :/ && git commit -m "Update for helm charts $PACKAGE-$VERSION" git add --all :/ && git commit -m "Update for helm charts ${PACKAGE}-${VERSION}"
git push https://"$GITHUB_TOKEN"@github.com/ceph/csi-charts git push https://"${GITHUB_TOKEN}"@github.com/ceph/csi-charts
popd >/dev/null popd >/dev/null
} }
@ -97,7 +97,7 @@ build_push_images
CSI_CHARTS_DIR=$(mktemp -d) CSI_CHARTS_DIR=$(mktemp -d)
pushd "$CSI_CHARTS_DIR" >/dev/null pushd "${CSI_CHARTS_DIR}" >/dev/null
curl -L https://git.io/get_helm.sh | bash -s -- --version "${HELM_VERSION}" curl -L https://git.io/get_helm.sh | bash -s -- --version "${HELM_VERSION}"
@ -108,9 +108,9 @@ mkdir -p csi-charts/docs
popd >/dev/null popd >/dev/null
build_step "pushing RBD helm charts" build_step "pushing RBD helm charts"
push_helm_charts rbd "$CSI_CHARTS_DIR" push_helm_charts rbd "${CSI_CHARTS_DIR}"
build_step "pushing CephFS helm charts" build_step "pushing CephFS helm charts"
push_helm_charts cephfs "$CSI_CHARTS_DIR" push_helm_charts cephfs "${CSI_CHARTS_DIR}"
build_step_log "finished deployment!" build_step_log "finished deployment!"
[ -n "${CSI_CHARTS_DIR}" ] && rm -rf "${CSI_CHARTS_DIR}" [ -n "${CSI_CHARTS_DIR}" ] && rm -rf "${CSI_CHARTS_DIR}"