Skip to content

Add support for multiple upgrade artifact source URIs - #7682

Open
lorienhu wants to merge 9 commits into
mainfrom
lhu-multiple-artifact-uris
Open

Add support for multiple upgrade artifact source URIs#7682
lorienhu wants to merge 9 commits into
mainfrom
lhu-multiple-artifact-uris

Conversation

@lorienhu

@lorienhu lorienhu commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

What is the problem this PR solves?

Currently, only one source for upgrade artifacts can be specified, meaning upgrades fail if that source is down.

How does this PR solve the problem?

Adds support for sending multiple upgrade artifact source URIs in an upgrade action with a new sources that deprecates source_uri. Backwards compatibility is maintained.

Design Checklist

  • I have ensured my design is stateless and will work when multiple fleet-server instances are behind a load balancer.
  • I have or intend to scale test my changes, ensuring it will work reliably with 100K+ agents connected.
  • I have included fail safe mechanisms to limit the load on fleet-server: rate limiting, circuit breakers, caching, load shedding, etc.

Checklist

  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in ./changelog/fragments using the changelog tool

Related issues

@lorienhu lorienhu self-assigned this Aug 22, 2026
@lorienhu
lorienhu requested a review from a team as a code owner August 22, 2026 00:37
@lorienhu lorienhu added enhancement New feature or request backport-skip Skip notification from the automated backport with mergify Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team labels Aug 22, 2026
Comment thread internal/pkg/api/handleCheckin.go
Comment thread internal/pkg/api/handleCheckin_test.go
@lorienhu
lorienhu requested a review from ycombinator August 31, 2026 20:50
Comment thread model/openapi.yml

@ycombinator ycombinator left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could we add a test case for where neither sources nor source_uri is set?

@ycombinator ycombinator left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also, this is more of a naming nit, but would source_uris be more consistent than sources?

@github-actions github-actions Bot mentioned this pull request Sep 3, 2026
@lorienhu
lorienhu force-pushed the lhu-multiple-artifact-uris branch from cfd892e to 2eeb96d Compare September 8, 2026 18:49
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@lorienhu

lorienhu commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

Also, this is more of a naming nit, but would source_uris be more consistent than sources?

I picked sources because the naming for sourceURI vs actual sourceURI was colliding in downloadArtifact before with the old name, since it's technically the base path/base URI.

@github-actions

This comment has been minimized.

@lorienhu
lorienhu force-pushed the lhu-multiple-artifact-uris branch from 104cc1d to 676b0ca Compare September 10, 2026 22:29
@lorienhu

Copy link
Copy Markdown
Contributor Author

Could we add a test case for where neither sources nor source_uri is set?

Added anyway for clarity, but this just means neither is in the action, following the previously existing behaviour.

@lorienhu
lorienhu force-pushed the lhu-multiple-artifact-uris branch from 676b0ca to c8561be Compare September 10, 2026 22:56
@github-actions

Copy link
Copy Markdown
Contributor

TL;DR

The failing MacOS unit-test job never reaches test execution: Buildkite fails in checkout because it pins commit 676b0ca... and then cannot resolve it in the fetched PR ref (fatal: reference is not a tree). Immediate action is to rerun the PR build on the current head commit and avoid stale commit pinning during PR checkout.

Remediation

  • Re-run Buildkite for PR Add support for multiple upgrade artifact source URIs #7682 so checkout uses current PR head (c8561be8bb0231096cba445533d2a0f271dd364f).
  • In CI checkout logic, avoid hard-checking out a stale status-event SHA for PR builds; use the fetched PR head (FETCH_HEAD) or fetch the specific SHA before checkout.
Investigation details

Root Cause

This failure is in checkout/bootstrap, not in Fleet Server code or unit tests.

The failed step fetches refs/pull/7682/head successfully, then attempts:

  • git checkout -f 676b0ca995253e4e72bfd929a08df9bc7ba59254
  • and fails with fatal: reference is not a tree

That indicates the job is trying to check out a SHA that is not present in the local fetched object graph for that PR ref at execution time.

PR context confirms head is now c8561be8bb0231096cba445533d2a0f271dd364f and commit history has moved, which is consistent with stale commit pinning in the CI checkout step.

Evidence

  • Build: https://buildkite.com/elastic/fleet-server/builds/16774
  • Job/step: :smartbear-testexecute: Run unit tests: MacOS 13
  • Key log excerpt:
    • git fetch -v --prune -- origin refs/pull/7682/head
    • # FETCH_HEAD is now c8561be8bb0231096cba445533d2a0f271dd364f
    • git checkout -f 676b0ca995253e4e72bfd929a08df9bc7ba59254
    • fatal: reference is not a tree: 676b0ca995253e4e72bfd929a08df9bc7ba59254

Verification

  • Not run locally; conclusion is based on direct Buildkite log evidence and PR metadata.

Follow-up

  • If this repeats after rerun, treat as CI checkout configuration/race issue (event SHA drift after force-push) rather than a product-code regression.

What is this? | From workflow: PR Buildkite Detective

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-skip Skip notification from the automated backport with mergify enhancement New feature or request Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Fleet Server] Allow multiple artifact URLs to be configured for a single policy

2 participants