Skip to content

Conversation

@colleenmcginnis
Copy link
Contributor

In #2177, @Mpdreamz updated the logic to support speculative builds for the previous minor version. However, I think this resulted in losing support for speculative builds for the current minor version.

I'm seeing this in PRs like elastic/elastic-agent#11069 where before #2177 was merged the preview build worked as expected, but after it did not.

For the case of elastic/elastic-agent, today when the current version is 9.2.1 I'd expect PR previews to build for 9.1 and 9.2, but not for 9.0. Before making the changes in this PR, I ran assembler content-source match for each minor version:

9.0: Worked as expected (NO speculative build) Results:
$ .artifacts/publish/docs-builder/release/docs-builder assembler content-source match elastic/elastic-agent 9.0
info ::e.d.c.tionFileProvider:: ConfigurationSource.Local: located /Users/colleenmcginnis/GitHub/docs-builder/config
info ::m.h.Lifetime          :: Application started. Press Ctrl+C to shut down.
info ::m.h.Lifetime          :: Hosting environment: Production
info ::m.h.Lifetime          :: Content root path: /Users/colleenmcginnis/GitHub/docs-builder
info ::d.b.f.InfoLoggerFilter:: Configuration source: Local
info ::d.b.f.InfoLoggerFilter:: Version: 0.85.1-canary.0.1+dea2e731f5deb4fb046984fd5426fd558c52e844
info ::d.b.f.StopwatchFilter :: assembler content-source match :: Starting...
info ::e.d.a.c.atchingService::  Validating 'elastic/elastic-agent' '9.0' 
info ::e.d.c.a.a.tSourceMatch:: Active content-sources for elastic/elastic-agent. current: main, next: main, edge: main' 
info ::e.d.c.a.a.tSourceMatch:: Branch or tag 9.0 is a versioned branch
info ::e.d.c.a.a.tSourceMatch:: Current is not using versioned branches checking product info
info ::e.d.c.a.a.tSourceMatch:: NO speculative build 9.0 is lte product current '9.2.1'
info ::e.d.a.c.atchingService:: 'elastic/elastic-agent' '9.0' combination not found in configuration.
9.1: Worked as expected (speculative build) Results:
$ .artifacts/publish/docs-builder/release/docs-builder assembler content-source match elastic/elastic-agent 9.1 
info ::e.d.c.tionFileProvider:: ConfigurationSource.Local: located /Users/colleenmcginnis/GitHub/docs-builder/config
info ::m.h.Lifetime          :: Application started. Press Ctrl+C to shut down.
info ::m.h.Lifetime          :: Hosting environment: Production
info ::m.h.Lifetime          :: Content root path: /Users/colleenmcginnis/GitHub/docs-builder
info ::d.b.f.InfoLoggerFilter:: Configuration source: Local
info ::d.b.f.InfoLoggerFilter:: Version: 0.85.1-canary.0.1+dea2e731f5deb4fb046984fd5426fd558c52e844
info ::d.b.f.StopwatchFilter :: assembler content-source match :: Starting...
info ::e.d.a.c.atchingService::  Validating 'elastic/elastic-agent' '9.1' 
info ::e.d.c.a.a.tSourceMatch:: Active content-sources for elastic/elastic-agent. current: main, next: main, edge: main' 
info ::e.d.c.a.a.tSourceMatch:: Branch or tag 9.1 is a versioned branch
info ::e.d.c.a.a.tSourceMatch:: Current is not using versioned branches checking product info
info ::e.d.c.a.a.tSourceMatch:: Speculative build 9.1 is gte product current previous minor '9.1.0'
9.2: Did NOT work as expected (NO speculative build) Results:
$ .artifacts/publish/docs-builder/release/docs-builder assembler content-source match elastic/elastic-agent 9.2 
info ::e.d.c.tionFileProvider:: ConfigurationSource.Local: located /Users/colleenmcginnis/GitHub/docs-builder/config
info ::m.h.Lifetime          :: Application started. Press Ctrl+C to shut down.
info ::m.h.Lifetime          :: Hosting environment: Production
info ::m.h.Lifetime          :: Content root path: /Users/colleenmcginnis/GitHub/docs-builder
info ::d.b.f.InfoLoggerFilter:: Configuration source: Local
info ::d.b.f.InfoLoggerFilter:: Version: 0.85.1-canary.0.1+dea2e731f5deb4fb046984fd5426fd558c52e844
info ::d.b.f.StopwatchFilter :: assembler content-source match :: Starting...
info ::e.d.a.c.atchingService::  Validating 'elastic/elastic-agent' '9.2' 
info ::e.d.c.a.a.tSourceMatch:: Active content-sources for elastic/elastic-agent. current: main, next: main, edge: main' 
info ::e.d.c.a.a.tSourceMatch:: Branch or tag 9.2 is a versioned branch
info ::e.d.c.a.a.tSourceMatch:: Current is not using versioned branches checking product info
info ::e.d.c.a.a.tSourceMatch:: NO speculative build 9.2 is lte product current '9.2.1'
info ::e.d.a.c.atchingService:: 'elastic/elastic-agent' '9.2' combination not found in configuration.

I think this is because in if (v >= productVersion) we're comparing 9.2.0 to 9.2.1 when we should be checking that the branch (9.2) is greater than or equal to the latest minor (9.2.1 ➡️ 9.2).

After adding the changes in this PR I reran assembler content-source match for each minor version again and got the results I'd expect.

I also added fleet-server to the product list so this logic will also work on PRs in elastic/fleet-server (example).

Copy link
Member

@Mpdreamz Mpdreamz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this! One review comment

var productVersion = versioningSystem.Current;
var previousMinorVersion = new SemVersion(productVersion.Major, Math.Max(productVersion.Minor - 1, 0), 0);
if (v >= productVersion)
if (v.Minor >= productVersion.Minor)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should normalize the product version to Major.Minor this might cause issues if one of the majors differ.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for jumping in on this!

Copy link
Member

@Mpdreamz Mpdreamz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the assertion to match against the anchored product version (Major.Minor.0) and included a bunch more tests.

Copy link
Member

@reakaleek reakaleek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Mpdreamz Mpdreamz enabled auto-merge (squash) November 14, 2025 09:35
@Mpdreamz Mpdreamz merged commit e3e590e into main Nov 14, 2025
24 checks passed
@Mpdreamz Mpdreamz deleted the speculative-build-logic branch November 14, 2025 09:35
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.

4 participants