Skip to content

Commit

Permalink
fix(deploy): hooks might run twice
Browse files Browse the repository at this point in the history
Signed-off-by: Ilya Lesikov <ilya@lesikov.com>
  • Loading branch information
ilya-lesikov committed Dec 4, 2024
1 parent cdfd488 commit 5888927
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions cmd/werf/bundle/apply/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,7 @@ func runApply(ctx context.Context) error {
wcompops, wfailops, wcancops, criterrs, noncriterrs := runFailureDeployPlan(
ctx,
releaseNamespace.Name(),
deployType,
plan,
taskStore,
resProcessor,
Expand All @@ -640,6 +641,7 @@ func runApply(ctx context.Context) error {
logStore,
releaseName,
releaseNamespace,
deployType,
newRel,
prevDeployedRelease,
newRevision,
Expand Down Expand Up @@ -728,6 +730,7 @@ func createReleaseNamespace(
func runFailureDeployPlan(
ctx context.Context,
releaseNamespace string,
deployType helmcommon.DeployType,
failedPlan *pln.Plan,
taskStore *statestore.TaskStore,
resProcessor *resrcprocssr.DeployableResourcesProcessor,
Expand All @@ -742,6 +745,7 @@ func runFailureDeployPlan(
log.Default.Info(ctx, "Building failure deploy plan")
failurePlanBuilder := plnbuilder.NewDeployFailurePlanBuilder(
releaseNamespace,
deployType,
failedPlan,
taskStore,
resProcessor.DeployableHookResourcesInfos(),
Expand Down Expand Up @@ -803,6 +807,7 @@ func runRollbackPlan(
logStore *kubeutil.Concurrent[*logstore.LogStore],
releaseName string,
releaseNamespace *resrc.ReleaseNamespace,
deployType helmcommon.DeployType,
failedRelease, prevDeployedRelease *rls.Release,
failedRevision int,
history *rlshistor.History,
Expand Down Expand Up @@ -959,6 +964,7 @@ func runRollbackPlan(
wcompops, wfailops, wcancops, criterrs, noncriterrs := runFailureDeployPlan(
ctx,
releaseNamespace.Name(),
deployType,
rollbackPlan,
taskStore,
resProcessor,
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ require (
github.com/werf/kubedog v0.12.4-0.20240625172905-6d4f29eae23b
github.com/werf/lockgate v0.1.1
github.com/werf/logboek v0.6.1
github.com/werf/nelm v0.0.0-20241203133739-b17579a47913
github.com/werf/nelm v0.0.0-20241204104852-2cf9da3c9b77
go.opentelemetry.io/otel v1.24.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.24.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1403,8 +1403,8 @@ github.com/werf/lockgate v0.1.1 h1:S400JFYjtWfE4i4LY9FA8zx0fMdfui9DPrBiTciCrx4=
github.com/werf/lockgate v0.1.1/go.mod h1:0yIFSLq9ausy6ejNxF5uUBf/Ib6daMAfXuCaTMZJzIE=
github.com/werf/logboek v0.6.1 h1:oEe6FkmlKg0z0n80oZjLplj6sXcBeLleCkjfOOZEL2g=
github.com/werf/logboek v0.6.1/go.mod h1:Gez5J4bxekyr6MxTmIJyId1F61rpO+0/V4vjCIEIZmk=
github.com/werf/nelm v0.0.0-20241203133739-b17579a47913 h1:CQfWJELeldZaDZcNLdCOID+0YSbI9JruPJrh2fKiiOs=
github.com/werf/nelm v0.0.0-20241203133739-b17579a47913/go.mod h1:rJQpFmToqj6twEeTcV7NtXACXqzuobvzjVocuCtIAms=
github.com/werf/nelm v0.0.0-20241204104852-2cf9da3c9b77 h1:MRsVutT9bsGYbX4BOF1UPq8r1HeHp6OaPKHuyIlxCHQ=
github.com/werf/nelm v0.0.0-20241204104852-2cf9da3c9b77/go.mod h1:rJQpFmToqj6twEeTcV7NtXACXqzuobvzjVocuCtIAms=
github.com/xanzy/go-gitlab v0.31.0/go.mod h1:sPLojNBn68fMUWSxIJtdVVIP8uSBYqesTfDUseX11Ug=
github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4=
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
Expand Down

0 comments on commit 5888927

Please sign in to comment.