Skip to content

Fix speculative build matching for CD-workflow repositories - #3737

Merged
Mpdreamz merged 1 commit into
mainfrom
fix/speculative-builds-cd-workflow
Jul 28, 2026
Merged

Fix speculative build matching for CD-workflow repositories#3737
Mpdreamz merged 1 commit into
mainfrom
fix/speculative-builds-cd-workflow

Conversation

@Mpdreamz

Copy link
Copy Markdown
Member

Why

Repositories using the CD (continuous deployment) branching strategy — where current, next, and edge all point to main — were incorrectly getting speculative builds triggered for version branches like 9.5.

We already had logic to prevent this: the Match method checks whether a repo is "already publishing" to the link registry, and if so, skips speculative builds for version branches on CD-workflow repos. The guard was correct, but a key-format mismatch in the caller silently defeated it.

Surfaced via: https://github.com/elastic/kibana/actions/runs/30279228305/job/90021040764#step:5:1

Kibana is configured as a CD-workflow repo (current = next = edge = main), yet branch 9.5 matched as a speculative build because the alreadyPublishing flag was always false.

What

The link registry uses short repository names as keys (e.g. "kibana"), but the matching service was looking up the full GitHub name (e.g. "elastic/kibana"). ContainsKey silently returned false, so every repository appeared "not yet publishing" — bypassing the guard that blocks speculative builds for CD-workflow repos that are already in the registry.

Both Match() and GetProductByRepositoryName() already split the full name and use the short form. The registry lookup was the one place that didn't.

The fix extracts the short repository name before the lookup and adds logging for:

  • The registry key actually used (so this kind of mismatch is immediately visible)
  • The detected branching strategy (cd/continuous-deployment vs tagged-release)

Made with Cursor

The link registry lookup used the full repository name (e.g. "elastic/kibana")
but the registry keys are short names (e.g. "kibana"), so alreadyPublishing was
always false. This caused version branches like 9.5 to trigger speculative builds
on repos that publish continuously from main — a scenario we already accounted
for but the key mismatch silently bypassed.

Also logs the detected branching strategy (cd vs tagged-release) to make future
debugging easier.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@Mpdreamz
Mpdreamz requested a review from a team as a code owner July 28, 2026 11:15
@Mpdreamz
Mpdreamz requested a review from theletterf July 28, 2026 11:15
@Mpdreamz Mpdreamz added the bug label Jul 28, 2026
@Mpdreamz
Mpdreamz merged commit 39ca909 into main Jul 28, 2026
25 checks passed
@Mpdreamz
Mpdreamz deleted the fix/speculative-builds-cd-workflow branch July 28, 2026 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants