Skip to content

Commit

Permalink
fix(skips): only update approved_version if commands/webhooks are wit…
Browse files Browse the repository at this point in the history
…h a deployed_version lookup

was updating approved_version every time it found a newer version if there was a deployed_version
lookup. we want this approved_version to track that commands/webhooks have been approved for the
deployed_service so that they aren't approved multiple times and rerun
we only want this approved_version for two cases
- skips (when there is a command and/or webhook and/or deployed_version lookup)
- approvals (when there is a command and/or webhook alongside a deployed_version lookup)
#62 (comment)
  • Loading branch information
JosephKav committed Jun 2, 2022
1 parent 9627dc9 commit 6972734
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions service/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (s *Service) UpdatedVersion() {
}
}
}
// Check that no COmmand(s) failed
// Check that no Command(s) failed
if s.Command != nil {
for key := range *s.Command {
// Default nil to true = failed
Expand All @@ -45,7 +45,12 @@ func (s *Service) UpdatedVersion() {
}
// Don't update DeployedVersion to LatestVersion if we have a lookup check
if s.DeployedVersionLookup != nil {
s.UpdateLatestApproved()
if s.Command != nil || s.WebHook != nil {
// Update ApprovedVersion if there are Commands/WebHooks that should update DeployedVersion
// (only having `deployed_version`,`command` or `webhook` would only use ApprovedVersion to track skips)
// They should have all ran/sent successfully at this point
s.UpdateLatestApproved()
}
return
}
s.SetDeployedVersion(s.Status.LatestVersion)
Expand Down

0 comments on commit 6972734

Please sign in to comment.