Skip to content

Add --agent-version flag for flexible Elastic Agent version configuration#3054

Merged
teresaromero merged 19 commits intoelastic:mainfrom
teresaromero:2852-stack-agent-version
Nov 13, 2025
Merged

Add --agent-version flag for flexible Elastic Agent version configuration#3054
teresaromero merged 19 commits intoelastic:mainfrom
teresaromero:2852-stack-agent-version

Conversation

@teresaromero
Copy link
Contributor

@teresaromero teresaromero commented Nov 5, 2025

This PR introduces a new --agent-version flag that allows users to specify a different Elastic Agent version from the stack version when running tests and booting up the stack.

What changed

Added --agent-version flag to stack up, stack update, and test system commands
The flag defaults to the stack version if not specified, maintaining backward compatibility
Environment variables (ELASTIC_AGENT_IMAGE_REF_OVERRIDE) and configuration file settings (stack.image_ref_overrides.elastic-agent) still take precedence over the flag
System tests now support running with different agent versions, making it easier to test compatibility with older agent versions

Why

With the new agent.version condition being introduced in package manifests to specify minimum compatible Elastic Agent versions, we need an easier way to test packages against different agent versions. Previously, you had to use environment variables or modify the config file. Now you can just pass --agent-version 8.10.0 to quickly test with a specific agent version.

This is especially useful for ensuring packages maintain compatibility with older agent versions without breaking changes.

Resolves #2852

@teresaromero teresaromero changed the title [DRAFT] New flag to set agent version at stack Add --agent-version flag for flexible Elastic Agent version configuration Nov 6, 2025
@teresaromero teresaromero marked this pull request as ready for review November 6, 2025 13:23
Copy link
Member

@jsoriano jsoriano left a comment

Choose a reason for hiding this comment

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

Looks good 👍 Would it be possible to add a test for this?

@teresaromero teresaromero requested a review from a team as a code owner November 13, 2025 09:11
@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

Copy link
Contributor

@mrodm mrodm left a comment

Choose a reason for hiding this comment

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

LGTM!

Being able to override the agent version now, I wonder if it would be good to add a new system test configuration to allow override the agent version for each system test. Thereby, each system test could run, if defined, with different Elastic Agent versions. WDYT ? @jsoriano @teresaromero

@teresaromero
Copy link
Contributor Author

Being able to override the agent version now, I wonder if it would be good to add a new system test configuration to allow override the agent version for each system test. Thereby, each system test could run, if defined, with different Elastic Agent versions. WDYT ? @jsoriano @teresaromero

As discussed offline, we could create a follow-up issue covering the options to:

  • save the agent version flag from the stack command into the profile and re-use it when running tests
  • create a config entry to be able to set this param into the system tests

@teresaromero teresaromero merged commit 9261e9f into elastic:main Nov 13, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow setting Elastic Agent version independently from stack version

4 participants