Skip to content

Commit db6d7cd

Browse files
CopilotAlexsJones
andauthored
Fix: Log correct oldHash value when updating results (#761)
* Initial plan * Fix: Capture oldHash before updating to log correct values Co-authored-by: AlexsJones <1235925+AlexsJones@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: AlexsJones <1235925+AlexsJones@users.noreply.github.com>
1 parent 90a5064 commit db6d7cd

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

pkg/resources/results.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ func CreateOrUpdateResult(ctx context.Context, c client.Client, res v1alpha1.Res
144144
}
145145

146146
// Content has changed - update the result
147+
// Capture the old hash before updating
148+
oldHash := existing.Status.ContentHash
147149
existing.Spec = res.Spec
148150
existing.Labels = res.Labels
149151
if err := c.Update(ctx, &existing); err != nil {
@@ -154,7 +156,7 @@ func CreateOrUpdateResult(ctx context.Context, c client.Client, res v1alpha1.Res
154156
if err := c.Status().Update(ctx, &existing); err != nil {
155157
return err
156158
}
157-
logger.Info("Updated result", "name", res.Name, "oldHash", existing.Status.ContentHash, "newHash", newHash)
159+
logger.Info("Updated result", "name", res.Name, "oldHash", oldHash, "newHash", newHash)
158160
finalResult = &existing
159161
return nil
160162
})

0 commit comments

Comments
 (0)