Skip to content

[Fleet] Reuse shared integration policies when duplicating agent policies#217872

Merged
jillguyonnet merged 1 commit intoelastic:mainfrom
jillguyonnet:fleet/215335-reuse-shared-integration-policies-on-duplication
Apr 11, 2025
Merged

[Fleet] Reuse shared integration policies when duplicating agent policies#217872
jillguyonnet merged 1 commit intoelastic:mainfrom
jillguyonnet:fleet/215335-reuse-shared-integration-policies-on-duplication

Conversation

@jillguyonnet
Copy link
Copy Markdown
Member

@jillguyonnet jillguyonnet commented Apr 10, 2025

Summary

Closes #215335

Currently, when an agent policy is duplicated, shared integration policies are also duplicated. This PR adds logic where the duplicated agent policy also shares these integration policies.

Testing

  • Run ES with an Entreprise license to avail of reusable integration policies.
  • Create an agent policy with a shared integration policy and a non-shared integration policy.
  • Duplicate the agent policy: the duplicated policy should only duplicate the non-shared integration policy and the shared integration policy should be reused.

Checklist

  • Unit or functional tests were updated or added to match the most common scenarios
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines

Identify risks

Incorrect package policies in duplicated agent policies.

@jillguyonnet jillguyonnet self-assigned this Apr 10, 2025
@jillguyonnet jillguyonnet added Team:Fleet Team label for Observability Data Collection Fleet team release_note:enhancement labels Apr 10, 2025
@elasticmachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Jest Tests #15 / Templates renders empty templates correctly
  • [job] [logs] Jest Tests #15 / TemplatesList renders template details correctly
  • [job] [logs] Fleet Cypress Tests #1 / View agents list Agent status filter should filter on healthy and unhealthy
  • [job] [logs] Fleet Cypress Tests #1 / View agents list Bulk actions should allow to bulk upgrade agents and cancel that upgrade

Metrics [docs]

✅ unchanged

cc @jillguyonnet

@jillguyonnet jillguyonnet marked this pull request as ready for review April 11, 2025 07:28
@jillguyonnet jillguyonnet requested a review from a team as a code owner April 11, 2025 07:28
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/fleet (Team:Fleet)

Copy link
Copy Markdown
Member

@criamico criamico left a comment

Choose a reason for hiding this comment

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

LGTM

@jillguyonnet
Copy link
Copy Markdown
Member Author

@kpollich Should this change be backported?

@juliaElastic
Copy link
Copy Markdown
Contributor

We should backport at least to 8.19

@jillguyonnet jillguyonnet added backport:version Backport to applied version labels v8.19.0 v9.0.0 v9.1.0 labels Apr 11, 2025
@jillguyonnet jillguyonnet merged commit 5c78ff1 into elastic:main Apr 11, 2025
22 checks passed
@jillguyonnet jillguyonnet deleted the fleet/215335-reuse-shared-integration-policies-on-duplication branch April 11, 2025 15:16
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.x, 9.0

https://github.com/elastic/kibana/actions/runs/14406384084

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Apr 11, 2025
…cies (elastic#217872)

## Summary

Closes elastic#215335

Currently, when an agent policy is duplicated, shared integration
policies are also duplicated. This PR adds logic where the duplicated
agent policy also shares these integration policies.

### Testing

* Run ES with an [Entreprise
license](https://www.elastic.co/subscriptions) to avail of reusable
integration policies.
* Create an agent policy with a shared integration policy and a
non-shared integration policy.
* Duplicate the agent policy: the duplicated policy should only
duplicate the non-shared integration policy and the shared integration
policy should be reused.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Identify risks

Incorrect package policies in duplicated agent policies.

(cherry picked from commit 5c78ff1)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Apr 11, 2025
…cies (elastic#217872)

## Summary

Closes elastic#215335

Currently, when an agent policy is duplicated, shared integration
policies are also duplicated. This PR adds logic where the duplicated
agent policy also shares these integration policies.

### Testing

* Run ES with an [Entreprise
license](https://www.elastic.co/subscriptions) to avail of reusable
integration policies.
* Create an agent policy with a shared integration policy and a
non-shared integration policy.
* Duplicate the agent policy: the duplicated policy should only
duplicate the non-shared integration policy and the shared integration
policy should be reused.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Identify risks

Incorrect package policies in duplicated agent policies.

(cherry picked from commit 5c78ff1)
@kibanamachine
Copy link
Copy Markdown
Contributor

💚 All backports created successfully

Status Branch Result
8.x
9.0

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Apr 11, 2025
…t policies (#217872) (#218002)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Fleet] Reuse shared integration policies when duplicating agent
policies (#217872)](#217872)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Jill
Guyonnet","email":"jill.guyonnet@elastic.co"},"sourceCommit":{"committedDate":"2025-04-11T15:16:17Z","message":"[Fleet]
Reuse shared integration policies when duplicating agent policies
(#217872)\n\n## Summary\n\nCloses
https://github.com/elastic/kibana/issues/215335\n\nCurrently, when an
agent policy is duplicated, shared integration\npolicies are also
duplicated. This PR adds logic where the duplicated\nagent policy also
shares these integration policies.\n\n### Testing\n\n* Run ES with an
[Entreprise\nlicense](https://www.elastic.co/subscriptions) to avail of
reusable\nintegration policies.\n* Create an agent policy with a shared
integration policy and a\nnon-shared integration policy.\n* Duplicate
the agent policy: the duplicated policy should only\nduplicate the
non-shared integration policy and the shared integration\npolicy should
be reused.\n\n### Checklist\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [ ] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n###
Identify risks\n\nIncorrect package policies in duplicated agent
policies.","sha":"5c78ff18484e77b5ec5a4ba2ab341ed65db4f21c","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","Team:Fleet","v9.0.0","backport:version","v9.1.0","v8.19.0"],"title":"[Fleet]
Reuse shared integration policies when duplicating agent
policies","number":217872,"url":"https://github.com/elastic/kibana/pull/217872","mergeCommit":{"message":"[Fleet]
Reuse shared integration policies when duplicating agent policies
(#217872)\n\n## Summary\n\nCloses
https://github.com/elastic/kibana/issues/215335\n\nCurrently, when an
agent policy is duplicated, shared integration\npolicies are also
duplicated. This PR adds logic where the duplicated\nagent policy also
shares these integration policies.\n\n### Testing\n\n* Run ES with an
[Entreprise\nlicense](https://www.elastic.co/subscriptions) to avail of
reusable\nintegration policies.\n* Create an agent policy with a shared
integration policy and a\nnon-shared integration policy.\n* Duplicate
the agent policy: the duplicated policy should only\nduplicate the
non-shared integration policy and the shared integration\npolicy should
be reused.\n\n### Checklist\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [ ] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n###
Identify risks\n\nIncorrect package policies in duplicated agent
policies.","sha":"5c78ff18484e77b5ec5a4ba2ab341ed65db4f21c"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/217872","number":217872,"mergeCommit":{"message":"[Fleet]
Reuse shared integration policies when duplicating agent policies
(#217872)\n\n## Summary\n\nCloses
https://github.com/elastic/kibana/issues/215335\n\nCurrently, when an
agent policy is duplicated, shared integration\npolicies are also
duplicated. This PR adds logic where the duplicated\nagent policy also
shares these integration policies.\n\n### Testing\n\n* Run ES with an
[Entreprise\nlicense](https://www.elastic.co/subscriptions) to avail of
reusable\nintegration policies.\n* Create an agent policy with a shared
integration policy and a\nnon-shared integration policy.\n* Duplicate
the agent policy: the duplicated policy should only\nduplicate the
non-shared integration policy and the shared integration\npolicy should
be reused.\n\n### Checklist\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [ ] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n###
Identify risks\n\nIncorrect package policies in duplicated agent
policies.","sha":"5c78ff18484e77b5ec5a4ba2ab341ed65db4f21c"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Jill Guyonnet <jill.guyonnet@elastic.co>
kibanamachine added a commit that referenced this pull request Apr 14, 2025
…t policies (#217872) (#218003)

# Backport

This will backport the following commits from `main` to `9.0`:
- [[Fleet] Reuse shared integration policies when duplicating agent
policies (#217872)](#217872)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Jill
Guyonnet","email":"jill.guyonnet@elastic.co"},"sourceCommit":{"committedDate":"2025-04-11T15:16:17Z","message":"[Fleet]
Reuse shared integration policies when duplicating agent policies
(#217872)\n\n## Summary\n\nCloses
https://github.com/elastic/kibana/issues/215335\n\nCurrently, when an
agent policy is duplicated, shared integration\npolicies are also
duplicated. This PR adds logic where the duplicated\nagent policy also
shares these integration policies.\n\n### Testing\n\n* Run ES with an
[Entreprise\nlicense](https://www.elastic.co/subscriptions) to avail of
reusable\nintegration policies.\n* Create an agent policy with a shared
integration policy and a\nnon-shared integration policy.\n* Duplicate
the agent policy: the duplicated policy should only\nduplicate the
non-shared integration policy and the shared integration\npolicy should
be reused.\n\n### Checklist\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [ ] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n###
Identify risks\n\nIncorrect package policies in duplicated agent
policies.","sha":"5c78ff18484e77b5ec5a4ba2ab341ed65db4f21c","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","Team:Fleet","v9.0.0","backport:version","v9.1.0","v8.19.0"],"title":"[Fleet]
Reuse shared integration policies when duplicating agent
policies","number":217872,"url":"https://github.com/elastic/kibana/pull/217872","mergeCommit":{"message":"[Fleet]
Reuse shared integration policies when duplicating agent policies
(#217872)\n\n## Summary\n\nCloses
https://github.com/elastic/kibana/issues/215335\n\nCurrently, when an
agent policy is duplicated, shared integration\npolicies are also
duplicated. This PR adds logic where the duplicated\nagent policy also
shares these integration policies.\n\n### Testing\n\n* Run ES with an
[Entreprise\nlicense](https://www.elastic.co/subscriptions) to avail of
reusable\nintegration policies.\n* Create an agent policy with a shared
integration policy and a\nnon-shared integration policy.\n* Duplicate
the agent policy: the duplicated policy should only\nduplicate the
non-shared integration policy and the shared integration\npolicy should
be reused.\n\n### Checklist\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [ ] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n###
Identify risks\n\nIncorrect package policies in duplicated agent
policies.","sha":"5c78ff18484e77b5ec5a4ba2ab341ed65db4f21c"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/217872","number":217872,"mergeCommit":{"message":"[Fleet]
Reuse shared integration policies when duplicating agent policies
(#217872)\n\n## Summary\n\nCloses
https://github.com/elastic/kibana/issues/215335\n\nCurrently, when an
agent policy is duplicated, shared integration\npolicies are also
duplicated. This PR adds logic where the duplicated\nagent policy also
shares these integration policies.\n\n### Testing\n\n* Run ES with an
[Entreprise\nlicense](https://www.elastic.co/subscriptions) to avail of
reusable\nintegration policies.\n* Create an agent policy with a shared
integration policy and a\nnon-shared integration policy.\n* Duplicate
the agent policy: the duplicated policy should only\nduplicate the
non-shared integration policy and the shared integration\npolicy should
be reused.\n\n### Checklist\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [ ] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n\n###
Identify risks\n\nIncorrect package policies in duplicated agent
policies.","sha":"5c78ff18484e77b5ec5a4ba2ab341ed65db4f21c"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Jill Guyonnet <jill.guyonnet@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
umbopepato pushed a commit to umbopepato/kibana that referenced this pull request Apr 14, 2025
…cies (elastic#217872)

## Summary

Closes elastic#215335

Currently, when an agent policy is duplicated, shared integration
policies are also duplicated. This PR adds logic where the duplicated
agent policy also shares these integration policies.

### Testing

* Run ES with an [Entreprise
license](https://www.elastic.co/subscriptions) to avail of reusable
integration policies.
* Create an agent policy with a shared integration policy and a
non-shared integration policy.
* Duplicate the agent policy: the duplicated policy should only
duplicate the non-shared integration policy and the shared integration
policy should be reused.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Identify risks

Incorrect package policies in duplicated agent policies.
@mistic mistic added v9.0.1 and removed v9.0.0 labels Apr 15, 2025
@mistic
Copy link
Copy Markdown
Contributor

mistic commented Apr 15, 2025

This PR didn't make it into the latest BC. Updating the labels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels release_note:enhancement Team:Fleet Team label for Observability Data Collection Fleet team v8.19.0 v9.0.1 v9.1.0

6 participants