From d3f8ed74981c96c6ef7f7407d0e6744e38a1244b Mon Sep 17 00:00:00 2001 From: yxxhero Date: Mon, 9 Dec 2024 21:29:21 +0800 Subject: [PATCH] feat(apply): add ignore-release-not-found option Signed-off-by: yxxhero --- cmd/apply.go | 1 + pkg/config/apply.go | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/cmd/apply.go b/cmd/apply.go index b019e6f2..a4c7480d 100644 --- a/cmd/apply.go +++ b/cmd/apply.go @@ -72,6 +72,7 @@ func NewApplyCmd(globalCfg *config.GlobalImpl) *cobra.Command { f.BoolVar(&applyOptions.SkipSchemaValidation, "skip-schema-validation", false, `pass --skip-schema-validation to "helm template" or "helm upgrade --install"`) f.StringVar(&applyOptions.Cascade, "cascade", "", "pass cascade to helm exec, default: background") f.StringArrayVar(&applyOptions.SuppressOutputLineRegex, "suppress-output-line-regex", nil, "a list of regex patterns to suppress output lines from the diff output") + f.BoolVar(&applyOptions.IgnoreReleaseNotFound, "ignore-release-not-found", false, "Treat release not found as a successful uninstall") return cmd } diff --git a/pkg/config/apply.go b/pkg/config/apply.go index fdb157e0..72ff0da4 100644 --- a/pkg/config/apply.go +++ b/pkg/config/apply.go @@ -70,6 +70,8 @@ type ApplyOptions struct { SyncArgs string // HideNotes is the hide notes flag HideNotes bool + // Ignore release not found + IgnoreReleaseNotFound bool } // NewApply creates a new Apply @@ -257,6 +259,12 @@ func (a *ApplyImpl) SyncArgs() string { return a.ApplyOptions.SyncArgs } +// Hide Notes returns the HideNotes. func (a *ApplyImpl) HideNotes() bool { return a.ApplyOptions.HideNotes } + +// IgnoreDeprecationWarnings returns the IgnoreDeprecationWarnings. +func (a *ApplyImpl) IgnoreReleaseNotFound() bool { + return a.ApplyOptions.IgnoreReleaseNotFound +}