Skip to content

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

DataStreamRootPath: dataStreamPath,
Variant: variantFlag,
StackVersion: stackVersion.Version(),
AgentVersion: stackVersion.Version(),
Copy link
Contributor Author

@teresaromero teresaromero Nov 5, 2025

Choose a reason for hiding this comment

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

The service cmd needs an agent version definition? or the default (same as stack) is used?

Copy link
Member

Choose a reason for hiding this comment

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

I guess deployers that manage their own agents could use this version, though not sure if we need a different setting for stack and agent version 🤔

In any case this is internal by now, right? No change for users.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right now there is no "agent version" param, its all dependent of the stackVersion. With this separation, the agent version by default will be the same as the stack version, unless the flag is introduced

@elasticmachine
Copy link
Collaborator

elasticmachine commented Nov 6, 2025

@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
if url, ok := config.Parameters[stack.ParamServerlessFleetURL]; ok {
fleetURL = url
}
if version, ok := config.Parameters[stack.ParamServerlessLocalStackVersion]; ok {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

in this case, we get the value from the config, we need to add a new param to define agent-version at the config file, isnt it? the flag value will be overriden by the config file one

cc @mrodm @jsoriano

Copy link
Member

Choose a reason for hiding this comment

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

the flag value will be overriden by the config file one

I think it should be the other way around, if a user is setting a flag in the command line, this value should be prioritized over the one in config files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right now the code overrides the default value of stack version with the config one

This param (stackVersion) is originated at the test case mapping from the default stack version (kibana client).

Now there is a flag introduced to modify the agent version in the tests. 🤔 So...
If the test specifies agent-version this should override the value at the config for the stack version. Should there also be an agent-version param at the config to be more specific?

Copy link
Member

Choose a reason for hiding this comment

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

Right now the code overrides the default value of stack version with the config one

Umm, you are right, this seems unexpected to me 🤔 let's keep this behaviour then by now.

Should there also be an agent-version param at the config to be more specific?

Yes, we should probably record the agent-version used on stack up, and use it in these cases.

@teresaromero teresaromero marked this pull request as ready for review November 6, 2025 13:23
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

3 participants