Skip to content

[Fleet] added a logic to use destinationId when tagging imported SOs#147439

Merged
juliaElastic merged 5 commits intoelastic:mainfrom
juliaElastic:fix/tag-asset-not-found
Dec 14, 2022
Merged

[Fleet] added a logic to use destinationId when tagging imported SOs#147439
juliaElastic merged 5 commits intoelastic:mainfrom
juliaElastic:fix/tag-asset-not-found

Conversation

@juliaElastic
Copy link
Contributor

@juliaElastic juliaElastic commented Dec 13, 2022

Summary

Fixes #147364

When installing an integration, and some assets already exist in Kibana, the imported SOs will recieve a newly generated ID. This caused a problem previously when the tagging logic didn't find the SOs with their original ID.
The fix takes the new destinationId of those SOs, so the tagging can complete successfully.

Steps to verify

  1. Add system integration in default space
  2. Enroll an agent and wait for system metrics to be ingested
  3. Create an Admin space
  4. Remove the system package policy, and uninstall the system package from Default space
  5. Go to Admin space and add system integration again
  6. Verify that the integration is added successfully, assets are created in Admin space and assets are tagged with Managed and System tags.

Checklist

@juliaElastic juliaElastic added release_note:skip Skip the PR/issue when compiling release notes v8.7.0 labels Dec 13, 2022
@juliaElastic juliaElastic self-assigned this Dec 13, 2022
@juliaElastic juliaElastic requested a review from a team as a code owner December 13, 2022 13:51
@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Dec 13, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@juliaElastic
Copy link
Contributor Author

Jenkins, test this

@juliaElastic
Copy link
Contributor Author

@elasticmachine merge upstream

@juliaElastic
Copy link
Contributor Author

@elasticmachine merge upstream

@kibana-ci
Copy link

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #38 / discover/group1 discover sidebar renders field groups should render even when retrieving documents failed with an error

Metrics [docs]

Unknown metric groups

ESLint disabled in files

id before after diff
osquery 1 2 +1

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
fleet 60 66 +6
osquery 109 115 +6
securitySolution 445 451 +6
total +20

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
fleet 69 75 +6
osquery 110 117 +7
securitySolution 521 527 +6
total +21

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @juliaElastic

@nchaulet nchaulet self-requested a review December 14, 2022 13:55
Copy link
Member

@nchaulet nchaulet 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 to me 🚀

@juliaElastic juliaElastic merged commit 7cee9ff into elastic:main Dec 14, 2022
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Dec 14, 2022
elastic#147439)

## Summary

Fixes elastic#147364

When installing an integration, and some assets already exist in Kibana,
the imported SOs will recieve a newly generated ID. This caused a
problem previously when the tagging logic didn't find the SOs with their
original ID.
The fix takes the new `destinationId` of those SOs, so the tagging can
complete successfully.

**Steps to verify**
1. Add system integration in default space
2. Enroll an agent and wait for system metrics to be ingested
3. Create an Admin space
4. Remove the system package policy, and uninstall the system package
from Default space
5. Go to Admin space and add system integration again
6. Verify that the integration is added successfully, assets are created
in Admin space and assets are tagged with Managed and System tags.

### 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

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 7cee9ff)
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Dec 14, 2022
elastic#147439)

## Summary

Fixes elastic#147364

When installing an integration, and some assets already exist in Kibana,
the imported SOs will recieve a newly generated ID. This caused a
problem previously when the tagging logic didn't find the SOs with their
original ID.
The fix takes the new `destinationId` of those SOs, so the tagging can
complete successfully.

**Steps to verify**
1. Add system integration in default space
2. Enroll an agent and wait for system metrics to be ingested
3. Create an Admin space
4. Remove the system package policy, and uninstall the system package
from Default space
5. Go to Admin space and add system integration again
6. Verify that the integration is added successfully, assets are created
in Admin space and assets are tagged with Managed and System tags.

### 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

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 7cee9ff)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.5
8.6

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 Dec 14, 2022
…ted SOs (#147439) (#147528)

# Backport

This will backport the following commits from `main` to `8.6`:
- [[Fleet] added a logic to use `destinationId` when tagging imported
SOs (#147439)](#147439)

<!--- Backport version: 8.9.7 -->

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

<!--BACKPORT [{"author":{"name":"Julia
Bardi","email":"90178898+juliaElastic@users.noreply.github.com"},"sourceCommit":{"committedDate":"2022-12-14T14:09:23Z","message":"[Fleet]
added a logic to use `destinationId` when tagging imported SOs
(#147439)\n\n## Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/147364\r\n\r\nWhen installing
an integration, and some assets already exist in Kibana,\r\nthe imported
SOs will recieve a newly generated ID. This caused a\r\nproblem
previously when the tagging logic didn't find the SOs with
their\r\noriginal ID.\r\nThe fix takes the new `destinationId` of those
SOs, so the tagging can\r\ncomplete successfully.\r\n\r\n**Steps to
verify**\r\n1. Add system integration in default space\r\n2. Enroll an
agent and wait for system metrics to be ingested\r\n3. Create an Admin
space\r\n4. Remove the system package policy, and uninstall the system
package\r\nfrom Default space\r\n5. Go to Admin space and add system
integration again\r\n6. Verify that the integration is added
successfully, assets are created\r\nin Admin space and assets are tagged
with Managed and System tags.\r\n\r\n\r\n### Checklist\r\n\r\n- [x]
[Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"7cee9fff787f1d647142d711f9f2618dd9dbc266","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","v8.6.0","v8.7.0","v8.5.4"],"number":147439,"url":"https://github.com/elastic/kibana/pull/147439","mergeCommit":{"message":"[Fleet]
added a logic to use `destinationId` when tagging imported SOs
(#147439)\n\n## Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/147364\r\n\r\nWhen installing
an integration, and some assets already exist in Kibana,\r\nthe imported
SOs will recieve a newly generated ID. This caused a\r\nproblem
previously when the tagging logic didn't find the SOs with
their\r\noriginal ID.\r\nThe fix takes the new `destinationId` of those
SOs, so the tagging can\r\ncomplete successfully.\r\n\r\n**Steps to
verify**\r\n1. Add system integration in default space\r\n2. Enroll an
agent and wait for system metrics to be ingested\r\n3. Create an Admin
space\r\n4. Remove the system package policy, and uninstall the system
package\r\nfrom Default space\r\n5. Go to Admin space and add system
integration again\r\n6. Verify that the integration is added
successfully, assets are created\r\nin Admin space and assets are tagged
with Managed and System tags.\r\n\r\n\r\n### Checklist\r\n\r\n- [x]
[Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"7cee9fff787f1d647142d711f9f2618dd9dbc266"}},"sourceBranch":"main","suggestedTargetBranches":["8.6","8.5"],"targetPullRequestStates":[{"branch":"8.6","label":"v8.6.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/147439","number":147439,"mergeCommit":{"message":"[Fleet]
added a logic to use `destinationId` when tagging imported SOs
(#147439)\n\n## Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/147364\r\n\r\nWhen installing
an integration, and some assets already exist in Kibana,\r\nthe imported
SOs will recieve a newly generated ID. This caused a\r\nproblem
previously when the tagging logic didn't find the SOs with
their\r\noriginal ID.\r\nThe fix takes the new `destinationId` of those
SOs, so the tagging can\r\ncomplete successfully.\r\n\r\n**Steps to
verify**\r\n1. Add system integration in default space\r\n2. Enroll an
agent and wait for system metrics to be ingested\r\n3. Create an Admin
space\r\n4. Remove the system package policy, and uninstall the system
package\r\nfrom Default space\r\n5. Go to Admin space and add system
integration again\r\n6. Verify that the integration is added
successfully, assets are created\r\nin Admin space and assets are tagged
with Managed and System tags.\r\n\r\n\r\n### Checklist\r\n\r\n- [x]
[Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"7cee9fff787f1d647142d711f9f2618dd9dbc266"}},{"branch":"8.5","label":"v8.5.4","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com>
jloleysens added a commit to jloleysens/kibana that referenced this pull request Dec 14, 2022
* main: (21 commits)
  [Profiling] Remove link to 'Other' bucket (elastic#147523)
  [Synthetics UI] Add missing configuration options to the add/edit monitor forms (elastic#147265)
  [DOCS] Updates what's new pages (elastic#147483)
  [Fleet][Endpoint][RBAC V2] Update fleet router and config to allow API access via RBAC controls (elastic#145361)
  [Guided onboarding] Update guide IDs (elastic#147348)
  [Synthetics] Add synthetics settings alerting default (elastic#147339)
  [Security Solution][Endpoint] Fix Policy form being displayed as Read Only when displayed in Fleet pages (elastic#147212)
  [Cases] Save draft user comment (elastic#146327)
  [API Docs] Fix `--plugin` filter (elastic#147500)
  [Fleet] added a logic to use `destinationId` when tagging imported SOs (elastic#147439)
  Do not skip UPDATE_TARGET_MAPPINGS if upgrading to a newer stack version (elastic#147503)
  [Discover] Validate if Data View time field exists on Alert creation / editing (elastic#146324)
  [Discover] Fix Discover navigation from Lens embeddable (elastic#147000)
  Allow users to Update API Keys (elastic#146237)
  Update dependency xstate to ^4.35.0 (main) (elastic#147463)
  [Behavioral Analytics] Remove feature flag to hide functionality (elastic#147429)
  [Fleet] Add agent policy `inactivity_timeout`experimental setting (elastic#147432)
  [APM] Switching service groups from grid to flex layout (elastic#147448)
  [Fleet] Add missing endpoints to openApi specs (elastic#147452)
  [AO] Allow providing custom time range for Alert Summary Widget (elastic#147253)
  ...
kibanamachine added a commit that referenced this pull request Dec 14, 2022
…ted SOs (#147439) (#147527)

# Backport

This will backport the following commits from `main` to `8.5`:
- [[Fleet] added a logic to use `destinationId` when tagging imported
SOs (#147439)](#147439)

<!--- Backport version: 8.9.7 -->

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

<!--BACKPORT [{"author":{"name":"Julia
Bardi","email":"90178898+juliaElastic@users.noreply.github.com"},"sourceCommit":{"committedDate":"2022-12-14T14:09:23Z","message":"[Fleet]
added a logic to use `destinationId` when tagging imported SOs
(#147439)\n\n## Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/147364\r\n\r\nWhen installing
an integration, and some assets already exist in Kibana,\r\nthe imported
SOs will recieve a newly generated ID. This caused a\r\nproblem
previously when the tagging logic didn't find the SOs with
their\r\noriginal ID.\r\nThe fix takes the new `destinationId` of those
SOs, so the tagging can\r\ncomplete successfully.\r\n\r\n**Steps to
verify**\r\n1. Add system integration in default space\r\n2. Enroll an
agent and wait for system metrics to be ingested\r\n3. Create an Admin
space\r\n4. Remove the system package policy, and uninstall the system
package\r\nfrom Default space\r\n5. Go to Admin space and add system
integration again\r\n6. Verify that the integration is added
successfully, assets are created\r\nin Admin space and assets are tagged
with Managed and System tags.\r\n\r\n\r\n### Checklist\r\n\r\n- [x]
[Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"7cee9fff787f1d647142d711f9f2618dd9dbc266","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","v8.6.0","v8.7.0","v8.5.4"],"number":147439,"url":"https://github.com/elastic/kibana/pull/147439","mergeCommit":{"message":"[Fleet]
added a logic to use `destinationId` when tagging imported SOs
(#147439)\n\n## Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/147364\r\n\r\nWhen installing
an integration, and some assets already exist in Kibana,\r\nthe imported
SOs will recieve a newly generated ID. This caused a\r\nproblem
previously when the tagging logic didn't find the SOs with
their\r\noriginal ID.\r\nThe fix takes the new `destinationId` of those
SOs, so the tagging can\r\ncomplete successfully.\r\n\r\n**Steps to
verify**\r\n1. Add system integration in default space\r\n2. Enroll an
agent and wait for system metrics to be ingested\r\n3. Create an Admin
space\r\n4. Remove the system package policy, and uninstall the system
package\r\nfrom Default space\r\n5. Go to Admin space and add system
integration again\r\n6. Verify that the integration is added
successfully, assets are created\r\nin Admin space and assets are tagged
with Managed and System tags.\r\n\r\n\r\n### Checklist\r\n\r\n- [x]
[Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"7cee9fff787f1d647142d711f9f2618dd9dbc266"}},"sourceBranch":"main","suggestedTargetBranches":["8.6","8.5"],"targetPullRequestStates":[{"branch":"8.6","label":"v8.6.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/147439","number":147439,"mergeCommit":{"message":"[Fleet]
added a logic to use `destinationId` when tagging imported SOs
(#147439)\n\n## Summary\r\n\r\nFixes
https://github.com/elastic/kibana/issues/147364\r\n\r\nWhen installing
an integration, and some assets already exist in Kibana,\r\nthe imported
SOs will recieve a newly generated ID. This caused a\r\nproblem
previously when the tagging logic didn't find the SOs with
their\r\noriginal ID.\r\nThe fix takes the new `destinationId` of those
SOs, so the tagging can\r\ncomplete successfully.\r\n\r\n**Steps to
verify**\r\n1. Add system integration in default space\r\n2. Enroll an
agent and wait for system metrics to be ingested\r\n3. Create an Admin
space\r\n4. Remove the system package policy, and uninstall the system
package\r\nfrom Default space\r\n5. Go to Admin space and add system
integration again\r\n6. Verify that the integration is added
successfully, assets are created\r\nin Admin space and assets are tagged
with Managed and System tags.\r\n\r\n\r\n### Checklist\r\n\r\n- [x]
[Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"7cee9fff787f1d647142d711f9f2618dd9dbc266"}},{"branch":"8.5","label":"v8.5.4","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com>
nreese pushed a commit to nreese/kibana that referenced this pull request Dec 16, 2022
elastic#147439)

## Summary

Fixes elastic#147364

When installing an integration, and some assets already exist in Kibana,
the imported SOs will recieve a newly generated ID. This caused a
problem previously when the tagging logic didn't find the SOs with their
original ID.
The fix takes the new `destinationId` of those SOs, so the tagging can
complete successfully.

**Steps to verify**
1. Add system integration in default space
2. Enroll an agent and wait for system metrics to be ingested
3. Create an Admin space
4. Remove the system package policy, and uninstall the system package
from Default space
5. Go to Admin space and add system integration again
6. Verify that the integration is added successfully, assets are created
in Admin space and assets are tagged with Managed and System tags.


### 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

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v8.5.4 v8.6.0 v8.7.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Fleet] Can't install package in a non-default space after removed from default space

5 participants