Skip to content

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

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

swiatekm merged 3 commits into
8.19from
mergify/bp/8.19/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 requested review from macdewee and removed request for a team August 3, 2026 19:25
@mergify mergify Bot assigned ebeahan Aug 3, 2026
@mergify
mergify Bot requested a review from samuelvl August 3, 2026 19:25
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

TL;DR

The Serverless Beats Tests job failed because the integration runner could not find the expected Filebeat snapshot artifact (filebeat-8.19.20-SNAPSHOT-linux-x86_64.tar.gz + .sha512). This matches a version-mismatch path where build-time version env leaks into the Beats packaging step.

Remediation

  • Ensure the executed .buildkite/scripts/steps/beats_tests.sh includes unset BEAT_VERSION immediately before SNAPSHOT=true ... mage package so Elastic Agent workspace version does not affect Beats package naming.
  • Re-run Trigger Serverless Beats Tests and confirm the expected files exist under /tmp/beats-build/beats/x-pack/filebeat/build/distributions/ before mage integration:testBeatServerless.
Investigation details

Root Cause

The failing check is emitted by Runner.validate() when required build artifacts are absent (pkg/testing/runner/runner.go:465-490).

In this run, the missing files were specifically:

  • /tmp/beats-build/beats/x-pack/filebeat/build/distributions/filebeat-8.19.20-SNAPSHOT-linux-x86_64.tar.gz
  • /tmp/beats-build/beats/x-pack/filebeat/build/distributions/filebeat-8.19.20-SNAPSHOT-linux-x86_64.tar.gz.sha512

The PR change in .buildkite/scripts/steps/beats_tests.sh:23 (unset BEAT_VERSION) is the correct mitigation for the known leak from .buildkite/scripts/common.sh:16-19 where BEAT_VERSION is initialized from Elastic Agent version/version.go. If that env leaks into Beats packaging, produced artifact names can diverge from what the integration runner expects.

Related historical flaky ticket: #4407 (same failure signature, closed as fixed).

Evidence

  • Build: https://buildkite.com/elastic/elastic-agent/builds/44156
  • Job/step: Serverless Beats Tests (beats-agent-serverless-tests, command .buildkite/scripts/steps/beats_tests.sh)
  • Key log excerpt:
    • Error: error running test: missing required Elastic Agent package builds for integration runner to execute: ... filebeat-8.19.20-SNAPSHOT-linux-x86_64.tar.gz ...

Verification

  • Not run in this workflow (read-only investigation from provided Buildkite artifacts and repository state).

Follow-up

  • If rerun still fails with the same message, capture and compare the actual package filenames produced by the preceding mage package step in the same job to confirm version drift source.

What is this? | From workflow: PR Buildkite Detective

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

@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? 🙏

swiatekm and others added 2 commits August 10, 2026 13:39
…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 (8.19, 9.x) 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>
@swiatekm
swiatekm enabled auto-merge (squash) August 10, 2026 11:54
@swiatekm
swiatekm merged commit f0ea013 into 8.19 Aug 10, 2026
16 checks passed
@swiatekm
swiatekm deleted the mergify/bp/8.19/pr-15924 branch August 10, 2026 13:21
@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

💛 Build succeeded, but was flaky

Failed CI Steps

History

cc @ebeahan

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