Skip to content

Commit b29c290

Browse files
committed
feat: add --atomic, --timeout, --skip-dependencies-repo-refresh for "bundle apply"
Signed-off-by: Ilya Lesikov <ilya@lesikov.com>
1 parent 9994f6e commit b29c290

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

cmd/werf/bundle/apply/apply.go

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"github.com/werf/werf/pkg/deploy/helm/command_helpers"
2525
"github.com/werf/werf/pkg/deploy/lock_manager"
2626
"github.com/werf/werf/pkg/deploy/secrets_manager"
27+
"github.com/werf/werf/pkg/util"
2728
"github.com/werf/werf/pkg/werf"
2829
"github.com/werf/werf/pkg/werf/global_warnings"
2930
)
@@ -87,6 +88,8 @@ func NewCmd(ctx context.Context) *cobra.Command {
8788
common.SetupSecretValues(&commonCmdData, cmd)
8889
common.SetupIgnoreSecretKey(&commonCmdData, cmd)
8990

91+
commonCmdData.SetupSkipDependenciesRepoRefresh(cmd)
92+
9093
common.SetupSaveDeployReport(&commonCmdData, cmd)
9194
common.SetupDeployReportPath(&commonCmdData, cmd)
9295

@@ -106,6 +109,15 @@ func NewCmd(ctx context.Context) *cobra.Command {
106109
}
107110
cmd.Flags().StringVarP(&cmdData.Tag, "tag", "", defaultTag, "Provide exact tag version or semver-based pattern, werf will install or upgrade to the latest version of the specified bundle ($WERF_TAG or latest by default)")
108111

112+
defaultTimeout, err := util.GetIntEnvVar("WERF_TIMEOUT")
113+
if err != nil || defaultTimeout == nil {
114+
defaultTimeout = new(int64)
115+
}
116+
cmd.Flags().IntVarP(&cmdData.Timeout, "timeout", "t", int(*defaultTimeout), "Resources tracking timeout in seconds ($WERF_TIMEOUT by default)")
117+
118+
cmd.Flags().BoolVarP(&cmdData.AutoRollback, "auto-rollback", "R", util.GetBoolEnvironmentDefaultFalse("WERF_AUTO_ROLLBACK"), "Enable auto rollback of the failed release to the previous deployed release version when current deploy process have failed ($WERF_AUTO_ROLLBACK by default)")
119+
cmd.Flags().BoolVarP(&cmdData.AutoRollback, "atomic", "", util.GetBoolEnvironmentDefaultFalse("WERF_ATOMIC"), "Enable auto rollback of the failed release to the previous deployed release version when current deploy process have failed ($WERF_ATOMIC by default)")
120+
109121
return cmd
110122
}
111123

@@ -195,8 +207,11 @@ func runApply(ctx context.Context) error {
195207
secretsManager := secrets_manager.NewSecretsManager(secrets_manager.SecretsManagerOptions{DisableSecretsDecryption: *commonCmdData.IgnoreSecretKey})
196208

197209
bundle, err := chart_extender.NewBundle(ctx, bundleTmpDir, helm_v3.Settings, helmRegistryClient, secretsManager, chart_extender.BundleOptions{
198-
SecretValueFiles: common.GetSecretValues(&commonCmdData),
199-
BuildChartDependenciesOpts: command_helpers.BuildChartDependenciesOptions{IgnoreInvalidAnnotationsAndLabels: true},
210+
SecretValueFiles: common.GetSecretValues(&commonCmdData),
211+
BuildChartDependenciesOpts: command_helpers.BuildChartDependenciesOptions{
212+
IgnoreInvalidAnnotationsAndLabels: true,
213+
SkipUpdate: *commonCmdData.SkipDependenciesRepoRefresh,
214+
},
200215
IgnoreInvalidAnnotationsAndLabels: true,
201216
ExtraAnnotations: userExtraAnnotations,
202217
ExtraLabels: userExtraLabels,

0 commit comments

Comments
 (0)