Check GitHub status duplicates per context - #1387
Closed
itamar-marom wants to merge 1 commit into
Closed
itamar-marom wants to merge 1 commit into
itamar-marom wants to merge 1 commit into
Conversation
The GitHub notifier skipped posting a commit status when the latest status with the same context already had the same state and description. It looked for that status in the first 50 statuses of the commit only. Controllers emit an event with commit status metadata on every successful reconciliation, so once other contexts post more than 50 statuses on a commit, which happens when many Kustomizations or clusters report on the same revision, the previous status is never found and every event posts a new one. Read the combined status instead. It holds the latest status of each context, and is paged until the context is found, so the check no longer depends on how many statuses other contexts posted. Signed-off-by: Itamar Marom <46691031+itamar-marom@users.noreply.github.com> Assisted-by: Claude Code/claude-opus-5-5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The GitHub notifier skips posting a commit status when the latest status for the same context already has the same state and description. It looks for that status only among the first 50 statuses returned by
ListStatuses.kustomize-controller emits an event with commit status metadata on every successful reconciliation (
Reconciliation finished in ...), so the duplicate check is what keeps a Kustomization from posting a status every interval. Once a commit carries more than 50 statuses from other contexts, the previous status of a context falls off the first page. The check then never matches, and every event posts a new status. This happens as soon as enough Kustomizations or clusters report on the same revision, and it does not settle: each re-post pushes other contexts off the page too.We hit this rolling commit statuses out to 11 clusters reporting on one repository, with about 120 contexts at a 30s interval. A single commit collected 4,040 statuses in 30 minutes, about 170 per minute, all
successwith unchanged descriptions. With 12 contexts the same setup was stable.This change reads the combined status (
GET /repos/{owner}/{repo}/commits/{ref}/status) instead. It returns the latest status of each context and pages at up to 100 contexts. The notifier pages until it finds its context, so the result no longer depends on how many statuses other contexts have posted. The comparison itself (duplicateGithubStatus) is unchanged.TestGitHubPostDuplicateOnLaterPageserves both endpoints the way GitHub does: a status history in which the context's latest status sits behind 60 newer ones, and a combined status in which it is on page 2 after 100 other contexts. With the previous code, the unchanged case posts a duplicate. With this change, only a changed state, a changed description or a missing context posts.The GitLab, Gitea and Azure DevOps notifiers use a similar first-page check. This PR only changes GitHub.
make tidy fmt vet && make testpasses. Prepared with the assistance of Claude Code; the commit carries anAssisted-bytrailer.