Skip to content

[9.4] (backport #16169) [mage] Load .package-version by default only for select targets - #16186

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

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

Conversation

@mergify

@mergify mergify Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Makes reading .package-version opt-in per mage target instead of applying it on every settings load.

Previously, LoadSettings() unconditionally applied .package-version overrides (manifest URL, versions, Snapshot=true) unless USE_PACKAGE_VERSION=false was set. Every target saw these values, including ones with no component dependencies, which silently clobbered explicit SNAPSHOT=false and BEAT_VERSION settings (#16026, #15972, #15924).

Now the overrides live in Settings.WithPackageVersionOverrides(), called only by targets that need consistency with the published snapshot build: package (and cloud:image), downloadManifest, ironbank, cloud:load/cloud:push, and the integration test runners. All other targets (helm:package, packageAgentCore, plain builds) never read the file, and USE_PACKAGE_VERSION has no effect on them.

Behavior changes:

  • Explicit env vars (AGENT_PACKAGE_VERSION, BEAT_VERSION, AGENT_VERSION, AGENT_STACK_VERSION) win over .package-version instead of being overwritten.
  • An explicit SNAPSHOT value that contradicts .package-version is an error on opt-in targets instead of being silently ignored.
  • MANIFEST_URL alone disables the overrides; combining it with an explicit USE_PACKAGE_VERSION=true is an error. MANIFEST_URL=... mage package no longer requires USE_PACKAGE_VERSION=false.
  • package passes its resolved settings to dependency targets via context so packageAgentCore names the core archive with the same version.
  • Crossbuild containers receive the resolved BEAT_VERSION instead of USE_PACKAGE_VERSION, so the inner mage invocation doesn't re-derive values from .package-version.

CI cleanup: removed the helm-charts.sh workaround for #16026 and the now-redundant USE_PACKAGE_VERSION=false opt-outs in build-agent-core.sh and package.sh. beats_tests.sh keeps its opt-out, which still applies to the integration runner.

Why is it important?

SNAPSHOT=false was silently ignored by the Helm chart pipeline, producing snapshot-named artifacts from release tags. The root cause - global overrides that most targets never needed - also produced the BEAT_VERSION leak in the serverless Beats tests and required scattered opt-outs in CI scripts.

Related issues

@mergify mergify Bot added the backport label Aug 13, 2026
@mergify
mergify Bot requested review from a team as code owners August 13, 2026 10:22
@mergify
mergify Bot requested review from macdewee and ycombinator and removed request for a team August 13, 2026 10:22
@github-actions github-actions Bot added Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team skip-changelog chore Tasks that just need to be done, they are neither bug, nor enhancements labels Aug 13, 2026
@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

swiatekm
swiatekm previously approved these changes Aug 13, 2026
@swiatekm
swiatekm enabled auto-merge (squash) August 13, 2026 10:35
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Add WithPackageVersionOverrides() to Helm.Package so the chart version
matches the other snapshot artifacts in the same DRA run. The GHA-triggered
Helm chart release workflows disable this via USE_PACKAGE_VERSION=false,
since those builds derive the version from the release tag rather than
.package-version.

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

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

Copy link
Copy Markdown

💔 Build Failed

Failed CI Steps

History

cc @swiatekm

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

TL;DR

This build is failing for two non-PR-code reasons: (1) check-ci detects a dirty beats submodule in the job workspace, and (2) the Kubernetes integration matrix is failing during OBLT ESS cluster provisioning (cluster config ... not found in all clusters). Immediate action: re-run failed jobs and treat the Kubernetes fan-out as infrastructure/transient unless it reproduces consistently on retry.

Remediation

  • For check-ci, enforce submodule sync before make check-ci (for example, git submodule update --init --recursive --checkout) so git diff-index --exit-code HEAD -- does not fail on beats pointer drift.
  • For Kubernetes OBLT failures, add bounded retry around ESS cluster creation/availability checks in .buildkite/scripts/steps/ess_oblt-cli.sh (the oblt-cli cluster create custom ... --wait 20 path), then re-run the failed matrix jobs.
Investigation details

Root Cause

Two distinct classes of failure are present:

  1. Configuration/workspace state (check-ci)

    • check-ci fails in make check-ci (Makefile:42) because the workspace is dirty at submodule beats when git diff-index --exit-code HEAD -- runs (Makefile:79).
    • Log shows submodule SHA mismatch in-job, then hard failure:
      • /tmp/gh-aw/buildkite-logs/elastic-agent-check-ci.txt:125-137 (submodule diff)
      • /tmp/gh-aw/buildkite-logs/elastic-agent-check-ci.txt:139-141 (Modified: [beats], make: *** [Makefile:42: check-ci] Error 1)
  2. Infrastructure/transient provisioning (kubernetes fan-out)

    • Multiple jobs successfully download artifacts, then fail waiting for OBLT-created ESS cluster visibility with:
      • cluster config for 'cluster_name=...' not found in all clusters
    • Example evidence:
      • /tmp/gh-aw/buildkite-logs/elastic-agent-kubernetestier1v12815amd64complete.txt:114
      • /tmp/gh-aw/buildkite-logs/elastic-agent-kubernetestier2v1361amd64service.txt:114
    • The failing path is the ESS bootstrap invoked by .buildkite/scripts/steps/integration_tests_oblt-cli.sh:43 via ess_up, implemented in .buildkite/scripts/steps/ess_oblt-cli.sh:13-33.

Evidence

  • Build: https://buildkite.com/elastic/elastic-agent/builds/44884
  • Jobs/steps:
    • check-ci
    • :kubernetes:tier1:* and :kubernetes:tier2:* matrix steps
  • Key log excerpts:
    • Error: some files are not up-to-date ... Modified: [beats]
    • cluster config for 'cluster_name=...' not found in all clusters

Verification

  • Not run (analysis based on provided Buildkite logs and current PR diff).

Follow-up

  • I did not find an existing flaky-test labeled issue matching this exact cluster config ... not found in all clusters signature in elastic/elastic-agent.

What is this? | From workflow: PR Buildkite Detective

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

@swiatekm
swiatekm merged commit d982904 into 9.4 Aug 14, 2026
23 checks passed
@swiatekm
swiatekm deleted the mergify/bp/9.4/pr-16169 branch August 14, 2026 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport chore Tasks that just need to be done, they are neither bug, nor enhancements skip-changelog 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.

2 participants