Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace dry_run flag with diff_only #2

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Deploy an helm chart
- `devel`: _Optional._ Allow development versions of chart to be installed. This is useful when wanting to install pre-release
charts (i.e. 1.0.2-rc1) without having to specify a version. (Default: false)
- `debug`: _Optional._ Dry run the helm install with the debug flag which logs interpolated chart templates. (Default: false)
- `dryrun`: _Optional._ Dry run the helm install without the debug flag enabled. Useful in combination with show_diff. (Default: false)
- `diff_only`: _Optional._ Only run the helm diff command without running helm upgrade. (Default: false)
- `check_is_ready`: _Optional._ Requires that `wait` is set to Default. Applies --wait without timeout. (Default: false)
- `wait_for_jobs`: _Optional._ Requires that `wait` is set to Default. Applies --wait and --wait-for-jobs without timeout. (Default: false)
- `atomic`: _Optional._ This flag will cause failed installs to purge the release, and failed upgrades to rollback to the previous release. (Default: false)
Expand Down
21 changes: 9 additions & 12 deletions assets/out
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ test_logs=$(jq -r '.params.test_logs // "false"' < $payload)
devel=$(jq -r '.params.devel // "false"' < $payload)
force=$(jq -r '.params.force // "false"' < $payload)
show_diff=$(jq -r '.params.show_diff // "false"' < $payload)
dryrun=$(jq -r '.params.dryrun // "false"' < $payload)
diff_only=$(jq -r '.params.diff_only // "false"' < $payload)
post_renderer=$(jq -r '.params.post_renderer // ""' < $payload)
reuse_values=$(jq -r '.params.reuse_values // "false"' < $payload)
reset_values=$(jq -r '.params.reset_values // "false"' < $payload)
Expand Down Expand Up @@ -180,10 +180,6 @@ helm_upgrade() {
upgrade_args+=("--dry-run")
fi

if [ "$dryrun" == "true" ]; then
upgrade_args+=("--dry-run")
fi

if [ -n "$version" ]; then
if [ -f "$source/$version" ]; then
version=$(cat $source/$version)
Expand Down Expand Up @@ -241,16 +237,17 @@ helm_upgrade() {
$helm_bin "${helm_depup_args[@]}" | tee "$logfile"
fi

if [ "$show_diff" = true ] ; then
if [ "$show_diff" = true ] || [ "$diff_only" = true ] ; then
echo "Release diff:"
$helm_bin diff --no-color=false "${helm_diff_args[@]}" | tee "$logfile"
fi

echo "Running command helm ${helm_echo_args[@]} | tee $logfile"
upgrade_result=$($helm_bin "${helm_args[@]}" | tee "$logfile")
echo "$upgrade_result"

deployed_release=$(echo $upgrade_result | head -n 1 | awk '{ print $2 }')
if [ "$diff_only" != true ] ; then
echo "Running command helm ${helm_echo_args[@]} | tee $logfile"
upgrade_result=$($helm_bin "${helm_args[@]}" | tee "$logfile")
echo "$upgrade_result"
deployed_release=$(echo $upgrade_result | head -n 1 | awk '{ print $2 }')
fi

if [ -n "$wait" ] && [ "$wait" -gt "0" ]; then
echo "Waiting for $wait Seconds"
Expand Down Expand Up @@ -325,7 +322,7 @@ else
echo "Installing $release"
helm_upgrade

if [ "$debug" != "true" ]; then
if [ "$debug" != "true" ] || [ "$diff_only" = "true" ] ; then
# If release is empty
if [ -z "$release" ]; then
release=$deployed_release
Expand Down
Loading