Skip to content

Commit 26eb30e

Browse files
authored
fix(deploy): improve deploy configuration hash handling (#957)
1 parent ce2517c commit 26eb30e

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

internal/stages/stage_2_pre-deploy.go

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ func (s *StageManager) RunPreDeployStage(ctx context.Context, stageLog *slog.Log
6969
}
7070
}
7171

72+
s.DeployConfig.Internal.Hash, err = s.DeployConfig.Hash()
73+
if err != nil {
74+
return fmt.Errorf("failed to hash deploy configuration: %w", err)
75+
}
76+
7277
if s.DeployConfig.ForceImagePull {
7378
stageLog.Debug("force image pull enabled, checking for image updates")
7479

@@ -136,17 +141,9 @@ func (s *StageManager) RunPreDeployStage(ctx context.Context, stageLog *slog.Log
136141
}
137142

138143
// Compare deployConfig hashes
139-
s.DeployConfig.Internal.Hash, err = s.DeployConfig.Hash()
140-
if err != nil {
141-
return fmt.Errorf("failed to hash deploy configuration: %w", err)
142-
}
143-
144-
deployConfigChanged := false
145-
146-
if curDeployConfigHash != s.DeployConfig.Internal.Hash {
144+
deployConfigChanged := curDeployConfigHash != s.DeployConfig.Internal.Hash
145+
if deployConfigChanged {
147146
stageLog.Debug("deploy configuration has changed", slog.String("new_hash", s.DeployConfig.Internal.Hash), slog.String("old_hash", curDeployConfigHash))
148-
149-
deployConfigChanged = true
150147
}
151148

152149
if !deployConfigChanged && !filesChanged && !secretsChanged && !imagesChanged {

0 commit comments

Comments
 (0)