switch from grep to awk when extracting version numbers
Change-Id: Id184cfe745f346d943d5d89a5aeff9963a2a1a02
diff --git a/chart_version_check.sh b/chart_version_check.sh
index 66bdc83..e070375 100755
--- a/chart_version_check.sh
+++ b/chart_version_check.sh
@@ -93,8 +93,8 @@
if [ -n "$chart_yaml_diff" ]
then
echo "Changes to Chart.yaml in '$chartdir'"
- old_version_string=$(echo "$chart_yaml_diff" | grep -E '\-version:\s*\d+\.\d+\.\d+$')
- new_version_string=$(echo "$chart_yaml_diff" | grep -E '\+version:\s*\d+\.\d+\.\d+$')
+ old_version_string=$(echo "$chart_yaml_diff" | awk '/^\-version:/ { print $2 }')
+ new_version_string=$(echo "$chart_yaml_diff" | awk '/^\+version:/ { print $2 }')
if [ -n "$new_version_string" ]
then
diff --git a/helmrepo.sh b/helmrepo.sh
index 8c34d57..fbfb154 100755
--- a/helmrepo.sh
+++ b/helmrepo.sh
@@ -71,7 +71,7 @@
# assumes that helmlint.sh and chart_version_check.sh have been run
# pre-merge, which ensures that all charts are valid and have their
# version updated in Chart.yaml
- new_version_string=$(echo "$chart_yaml_diff" | grep -E '\+version:\s*\d+\.\d+\.\d+$')
+ new_version_string=$(echo "$chart_yaml_diff" | awk '/^\+version:/ { print $2 }')
echo "New version of chart ${chartdir}, creating package: ${new_version_string//+version:/}"
helm package --dependency-update --destination "${NEW_REPO_DIR}" "${chartdir}"
else