-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Release upgrade command. * Update README * Update contributing guide and plugin version Co-authored-by: Vadim Zabolotniy <zabolotniy.v.y@gmail.com>
- Loading branch information
1 parent
edce4ab
commit b3af1b0
Showing
5 changed files
with
97 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env bash | ||
|
||
help_text="helm release upgrade - Update release values without specifying the Helm Chart used for deployment. | ||
Usage: helm release upgrade [RELEASE NAME] [-d | --destination <TARGET CHART DIRECTORY>] [helm upgrade arguments]" | ||
|
||
function upgrade_release() { | ||
RELEASE=$1 | ||
shift | ||
if [[ -z $RELEASE ]]; then | ||
printf '%s\n' 'No release was provided.' | ||
exit_with_help "$help_text" | ||
fi | ||
chart_destination='/tmp' | ||
update_arguments=() | ||
for (( i=1; i<=$#; i++ )); | ||
do | ||
case "${!i}" in | ||
(-d|--destination) | ||
next=$((i+1)) | ||
if [[ -z "${!next}" ]]; then | ||
printf '%s\n' 'No destination was provided.' | ||
exit_with_help "$help_text" | ||
fi | ||
chart_destination="${!next}" | ||
;; | ||
(--destination*) | ||
chart_destination=`echo "${!i}" | sed -e 's/^[^=]*=//g'` | ||
;; | ||
(-h|--help) | ||
exit_with_help "$help_text" | ||
;; | ||
(*) | ||
update_arguments[${#update_arguments[@]}]="${!i}" | ||
;; | ||
esac | ||
done | ||
|
||
chart_directory=$(helm release pull $RELEASE --destination=$chart_destination --output=json | jq -r .chart_directory) | ||
if [[ -z $chart_directory ]]; then | ||
printf '%s\n' 'Failed to get release chart.' | ||
return 1; | ||
fi | ||
chart_path="$chart_destination/$chart_directory" | ||
|
||
helm dependency build $chart_path | ||
helm upgrade "$RELEASE" "$chart_path" "${update_arguments[@]}" | ||
|
||
rm -rf $chart_path | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters