Skip to content

Conversation

mrodm
Copy link
Contributor

@mrodm mrodm commented Jul 22, 2025

This PR fixes the policy name used in Custom Agents (Deprecated). with-custom and system-flags steps in Buildkite.

The method needs to take into account also 9.x Elastic stacks.

This should just affect Custom Agents since in the other scenarios Elastic Agents are setup via Independent Elastic Agents (agentdeployer module).

Relates #2758

How to test this PR locally

cd test/packages/with-custom-agent/auditd_manager/
elastic-package stack up -v -d --version 9.0.3

# This command should finish successfully
elastic-package test system -v

elastic-package stack down -v

@mrodm mrodm self-assigned this Jul 22, 2025
@mrodm
Copy link
Contributor Author

mrodm commented Jul 22, 2025

test integrations

@elastic-vault-github-plugin-prod

Created or updated PR in integrations repository to test this version. Check elastic/integrations#14653

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @mrodm

@mrodm mrodm marked this pull request as ready for review July 22, 2025 21:05
@mrodm mrodm requested a review from a team July 22, 2025 21:05
Comment on lines 275 to 284
func getTokenPolicyName(stackVersion, policyName string) string {
if strings.HasPrefix(stackVersion, "7.") {
return ""
}
if policyName == "" {
policyName = defaulFleetTokenPolicyName
}
if strings.HasPrefix(stackVersion, "8.") {
return policyName
}
return ""
// For 8.x and later, we return the given policy name
return policyName
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Similar to the one defined in agentdeployer module.

func getTokenPolicyName(stackVersion, policyName string) string {
if strings.HasPrefix(stackVersion, "7.") {
return ""
}
return policyName
}

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.

Good one, thanks!

@mrodm mrodm merged commit b85a3d9 into elastic:main Jul 23, 2025
3 checks passed
@mrodm mrodm deleted the fix-custom-agent-9x branch July 23, 2025 09:27
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.

3 participants