Skip to content

Conversation

arsiesys
Copy link

While using github integration for branch-planner, I noticed that a comment with the plan was posted after each reconcilation of the plan (interval: 1m) even when no changes were made.

The branch planner was posting duplicate comments on pull requests because isNewPlan() only checked if the LastPlanAt timestamp changed, not whether the actual plan content (LastPlannedRevision) changed.

This caused the informer to repeatedly detect the same plan as "new" across reconciliation loops, triggering duplicate git provider comments for the same terraform plan.

Changes:

  • Add early return if LastPlannedRevision is empty to avoid processing incomplete status updates
  • Check both LastPlanAt timestamp AND LastPlannedRevision when determining if a plan is truly new
  • Only post comments when the plan revision actually changes, not just the timestamp

This ensures comments are posted once per unique plan, preventing spam on pull requests during reconciliation loops.

…sion

The branch planner was posting duplicate comments on pull requests because
isNewPlan() only checked if the LastPlanAt timestamp changed, not whether
the actual plan content (LastPlannedRevision) changed.

This caused the informer to repeatedly detect the same plan as "new" across
reconciliation loops, triggering duplicate git provider comments for the
same terraform plan.

Changes:
- Add early return if LastPlannedRevision is empty to avoid processing
  incomplete status updates
- Check both LastPlanAt timestamp AND LastPlannedRevision when determining
  if a plan is truly new
- Only post comments when the plan revision actually changes, not just
  the timestamp

This ensures comments are posted once per unique plan, preventing spam on
pull requests during reconciliation loops.

Signed-off-by: Loic Yavercovski <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant