Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fleet] Fix changing space for agent actions #203683

Merged

Conversation

nchaulet
Copy link
Member

@nchaulet nchaulet commented Dec 10, 2024

Summary

Resolve #194931

When reassigning a policy to different spaces we were not reassigning action that PR fix it.

How to test

Enable space awareness (feature flag + API call)
Create agent action in a space and update the policy spaces, it should update the action spaces, too and action should be visible in agent activity of the newly assigned space.

Screenshot 2024-12-10 at 11 34 23 AM

@nchaulet nchaulet added release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) labels Dec 10, 2024
@nchaulet nchaulet self-assigned this Dec 10, 2024
@nchaulet nchaulet requested a review from a team as a code owner December 10, 2024 19:48
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@nchaulet
Copy link
Member Author

@elasticmachine merge

@nchaulet
Copy link
Member Author

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

elasticmachine commented Dec 10, 2024

⏳ Build in-progress, with failures

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #108 / Indicator match execution logic API @ess @serverless Indicator match type rules, alert suppression Code execution path: events count is smaller than threats count deduplicates new alerts if they were previously created without suppression
  • [job] [logs] Fleet Cypress Tests #1 / Space aware policies creation should allow to update that policy to belong to both test and default space
  • [job] [logs] Fleet Cypress Tests #1 / Space aware policies creation should redirect to the agent policies list when removing the current space from a policy
  • [job] [logs] Fleet Cypress Tests #1 / Space aware policies creation should redirect to the agent policies list when removing the current space from a policy
  • [job] [logs] Fleet Cypress Tests #1 / Space aware policies creation the policy should be visible in the default space
  • [job] [logs] Jest Tests #1 / updateAgentPolicySpaces allow to change spaces
  • [job] [logs] Jest Tests #1 / updateAgentPolicySpaces allow to change spaces

History

cc @nchaulet

searchAfter = lastAgent.sort;

await esClient.updateByQuery({
index: AGENT_ACTIONS_INDEX,
Copy link
Contributor

Choose a reason for hiding this comment

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

we don't store spaces in .fleet-actions-results, right? so that doesn't have to be updated

Copy link
Contributor

@juliaElastic juliaElastic left a comment

Choose a reason for hiding this comment

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

LGTM

@nchaulet nchaulet merged commit 8d5cd4f into elastic:main Dec 12, 2024
9 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

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

@nchaulet nchaulet deleted the feature-fix-agent-actions-change-space branch December 12, 2024 13:24
@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.x Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

node scripts/backport --pr 203683

Questions ?

Please refer to the Backport tool documentation

@nchaulet
Copy link
Member Author

💚 All backports created successfully

Status Branch Result
8.x

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

Questions ?

Please refer to the Backport tool documentation

nchaulet added a commit to nchaulet/kibana that referenced this pull request Dec 12, 2024
(cherry picked from commit 8d5cd4f)

# Conflicts:
#	x-pack/plugins/fleet/server/services/spaces/agent_policy.ts
nchaulet added a commit that referenced this pull request Dec 13, 2024
# Backport

This will backport the following commits from `main` to `8.x`:
- [[Fleet] Fix changing space for agent actions
(#203683)](#203683)

<!--- Backport version: 8.9.8 -->

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

<!--BACKPORT [{"author":{"name":"Nicolas
Chaulet","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-12-12T13:23:50Z","message":"[Fleet]
Fix changing space for agent actions
(#203683)","sha":"8d5cd4f2d752a8d47c37225c91561af3763464d3","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","v9.0.0","backport:prev-minor"],"number":203683,"url":"https://github.com/elastic/kibana/pull/203683","mergeCommit":{"message":"[Fleet]
Fix changing space for agent actions
(#203683)","sha":"8d5cd4f2d752a8d47c37225c91561af3763464d3"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/203683","number":203683,"mergeCommit":{"message":"[Fleet]
Fix changing space for agent actions
(#203683)","sha":"8d5cd4f2d752a8d47c37225c91561af3763464d3"}}]}]
BACKPORT-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Fleet]: Agent activity not updating in new space on making changes in default space
4 participants