Skip to content

[9.4] (backport #15924) [ci] Prevent Agent version leaking when triggering serverless Beats tests - #15973

Merged
swiatekm merged 3 commits into
9.4from
mergify/bp/9.4/pr-15924
Aug 10, 2026
Merged

swiatekm merged 3 commits into
9.4from
mergify/bp/9.4/pr-15924

Conversation

@mergify

@mergify mergify Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

On a version bump PRs like #15426, version/version.go is changed to the next patch (p) while Beats main is still the previous patch ( p - 1 ).

Based on the Elastic Agent version, BEAT_VERSION sets to p. That leaks into the Beats mage package call, producing filebeat-p-SNAPSHOT, but the runner still expects (p -1)-SNAPSHOT from the Beats checkout.


This is an automatic backport of pull request #15924 done by Mergify.

@mergify mergify Bot added the backport label Aug 3, 2026
@mergify
mergify Bot requested review from a team as code owners August 3, 2026 19:25
@mergify mergify Bot added the backport label Aug 3, 2026
@mergify
mergify Bot requested review from swiatekm and ycombinator and removed request for a team August 3, 2026 19:25
@mergify mergify Bot assigned ebeahan Aug 3, 2026
@github-actions

This comment has been minimized.

@mergify

mergify Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

This pull request has not been merged yet. Could you please review and merge it @ebeahan? 🙏

…ble local package metadata

The script was always cloning beats main, so the beats build version
would diverge from what the integration runner expects on maintenance
branches (9.4, 9.5) where beats main has moved ahead.

Use the Buildkite-provided branch name directly: the PR base branch
when running in PR context, otherwise the current branch. Branch names
are kept in sync between elastic-agent and beats.

Also disable reading from .package-version in these tests to prevent
local metadata from leaking into the Beats build.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@infra-vault-gh-plugin-prod

infra-vault-gh-plugin-prod Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

⏳ Build in-progress, with failures

Failed CI Steps

History

cc @ebeahan

@swiatekm
swiatekm enabled auto-merge (squash) August 10, 2026 11:55
@github-actions

Copy link
Copy Markdown
Contributor

TL;DR

This build is failing due to a Beats submodule state mismatch during CI checkout/build, not a serverless test assertion. The immediate fix is to force-sync beats to the gitlink commit before check-ci and container packaging steps run.

Remediation

  • In CI checkout flow, force-reset the beats submodule after the PR merge checkout (for example in .buildkite/hooks/post-checkout after the merge step):
    • git submodule sync --recursive
    • git submodule update --init --recursive --force beats
  • Re-run Buildkite check-ci, :package: amd64: Containers, and :package: arm64: Containers.
Investigation details

Root Cause

check-ci fails on a dirty worktree because beats does not match the superproject gitlink commit, and packaging then compiles against an inconsistent Beats checkout.

Relevant code paths:

  • .buildkite/scripts/steps/check-ci.sh:10-11 runs make check-ci
  • Makefile:42 runs mage -v check and Makefile:75-79 enforces a clean tree via git diff-index --exit-code
  • .buildkite/integration.pipeline.yml:118-125 and :137-143 run .buildkite/scripts/steps/integration-package.sh for amd64/arm64 containers

Evidence

diff --git a/beats b/beats
-Subproject commit 086a3819d17e45058856e0a8e1e64a531d8addd7
+Subproject commit 29aee21ddb4ba6417f1b07586ad5f49900824192
Error: ... Modified: [beats]
make: *** [Makefile:42: check-ci] Error 1
  • Job/step: :package: amd64: Containers
  • Key log excerpt (/tmp/gh-aw/buildkite-logs/elastic-agent-package-amd64-containers.txt):
../../beats/libbeat/autodiscover/providers/kubernetes/kubernetes.go:26:2: could not import sync/atomic (open : no such file or directory)
../../beats/x-pack/metricbeat/module/azure/monitor_service.go:56:10: undefined: BuildCloudConfig
../../beats/x-pack/metricbeat/module/azure/monitor_service.go:62:16: undefined: metricsBatchEndpoint
  • Job/step: :package: arm64: Containers
  • Key log excerpt (/tmp/gh-aw/buildkite-logs/elastic-agent-package-arm64-containers.txt):
../../beats/x-pack/metricbeat/module/azure/monitor_service.go:56:10: undefined: BuildCloudConfig
../../beats/x-pack/metricbeat/module/azure/monitor_service.go:62:16: undefined: metricsBatchEndpoint
../../beats/x-pack/metricbeat/module/azure/monitor_service.go:318:19: undefined: metricsBatchEndpoint

Verification

Not run locally; analysis is based on Buildkite failure artifacts and repository scripts.

Follow-up

I checked for matching flaky-test issues and did not find one matching this error signature. Existing flaky-test issue #4407 tracks a different failure mode (missing serverless package artifacts), not this submodule/compile mismatch.


What is this? | From workflow: PR Buildkite Detective

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

@swiatekm
swiatekm merged commit e047e45 into 9.4 Aug 10, 2026
20 checks passed
@swiatekm
swiatekm deleted the mergify/bp/9.4/pr-15924 branch August 10, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants