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

[Archive Migrations] security_solution-timelines #142363

Merged

Conversation

wayneseymour
Copy link
Member

@wayneseymour wayneseymour commented Sep 30, 2022

Add new kbn archive with an index pattern
taken from the es archive.

Change the test to use both es and kbn archives.
Since all these objects are loaded into a space,
just delete the space afterwards instead of
unloading with es archiver.

The original list of types within the archive was:

config
index-pattern
siem-ui-timeline
siem-ui-timeline-note
siem-ui-timeline-pinned-event
space

Now, the index-pattern, the config and the space are gone.
So, the new kbn-archive contains only the index-pattern.

The space is programmatically created now.

Helps with: #102552

@wayneseymour wayneseymour requested a review from a team as a code owner September 30, 2022 14:19
@wayneseymour wayneseymour force-pushed the migrations/security_solution-timelines branch from c304957 to 9ced15f Compare September 30, 2022 14:20
@wayneseymour wayneseymour self-assigned this Sep 30, 2022
@wayneseymour wayneseymour added backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes test_xpack_functional v8.6.0 labels Sep 30, 2022
@wayneseymour wayneseymour force-pushed the migrations/security_solution-timelines branch 3 times, most recently from 33418f4 to e871def Compare October 3, 2022 14:09
@wayneseymour wayneseymour requested a review from LeeDr October 3, 2022 14:10
@LeeDr
Copy link

LeeDr commented Oct 3, 2022

@wayneseymour I guess x-pack/test/functional/es_archives/security_solution/timelines/7.15.0_space/data.json.gz contains Kibana saved objects that there isn't any API to create and so that's why they have to stay in the esArchive? Is it just one 'type' of saved objects or a couple?

I'm not really sure we should add a new kbnArchive in a case where we're not eliminating the esArchive completely.

@wayneseymour
Copy link
Member Author

wayneseymour commented Oct 3, 2022

@wayneseymour I guess x-pack/test/functional/es_archives/security_solution/timelines/7.15.0_space/data.json.gz contains Kibana saved objects that there isn't any API to create and so that's why they have to stay in the esArchive? Is it just one 'type' of saved objects or a couple?

The original list of types within the archive was:

  1. config
  2. index-pattern
  3. siem-ui-timeline
  4. siem-ui-timeline-note
  5. siem-ui-timeline-pinned-event
  6. space

Now, the index-pattern, the config and the space are gone.
So, the new kbn-archive contains only the index-pattern.
The space is programmatically created now.

@elastic/security-solution With a little help, perhaps we can programmatically create the timeline objects and delete the archive entirely? :)

Copy link

@LeeDr LeeDr left a comment

Choose a reason for hiding this comment

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

LGTM - code review only

@wayneseymour wayneseymour force-pushed the migrations/security_solution-timelines branch 2 times, most recently from a9499e7 to 7d590a5 Compare October 5, 2022 09:06
@wayneseymour
Copy link
Member Author

@elasticmachine merge upstream

@wayneseymour
Copy link
Member Author

@michaelolo24 I've added you to this pr as a reviewer after chatting with @jonathan-buttner

@@ -366,6 +383,12 @@ save_kbn() {
# node scripts/kbn_archiver.js --config x-pack/test/spaces_api_integration/security_and_spaces/config_basic.ts save x-pack/test/functional/fixtures/kbn_archiver/saved_objects/default_space --type search,index-pattern,visualization,dashboard,lens,map,graph-workspace,query,tag,url,canvas-workpad
}

load_my_kbn() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we keep these changes? is my-es-archive.json a file we are including in the kibana repo?

Copy link
Member Author

Choose a reason for hiding this comment

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

We can drop this! Good catch!

@wayneseymour wayneseymour force-pushed the migrations/security_solution-timelines branch from 42c3974 to 1cd6a65 Compare October 13, 2022 15:54
);
});

after(async () => await spacesService.delete('awesome-space'));
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add the esArchiver.unload() here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hrmm, well if they archives are loading into space then no....
Lemme triple check as you may be onto something.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, good thing you had me check!

I noticed two objects that should not have been within the archive. (awesome!)
Also, yes we should still be good only dropping the space.
This is because all the archives are loaded into that space && deleting a space drops all of the objects.

TLDR

Since it's on disk as a gzipped archive, I ran the following and then visually inspected it
node scripts/es_archiver.js edit x-pack/test/functional/es_archives/security_solution/timelines/7.15.0_space --config x-pack/test/api_integration/config.ts

jq '[.value.id]| .[]' x-pack/test/functional/es_archives/security_solution/timelines/7.15.0_space/data.json
"awesome-space:siem-ui-timeline:1211b430-25f8-11ec-a981-b77847c6ef30"
"awesome-space:siem-ui-timeline:120f9150-25f8-11ec-a981-b77847c6ef30"
"awesome-space:siem-ui-timeline:12205a30-25f8-11ec-a981-b77847c6ef30"
"awesome-space:siem-ui-timeline:12208140-25f8-11ec-a981-b77847c6ef30"
"awesome-space:siem-ui-timeline:1e2e9850-25f8-11ec-a981-b77847c6ef30"
"awesome-space:siem-ui-timeline-note:2d230670-25f8-11ec-a981-b77847c6ef30"
"awesome-space:siem-ui-timeline-pinned-event:2694b600-25f8-11ec-a981-b77847c6ef30"
"awesome-space:siem-ui-timeline-note:323df0c0-25f8-11ec-a981-b77847c6ef30"

Unless I missed my guess (totally possible lol), I think we are good as they are "namespaced" to awesome-space.

Add new kbn archive with an index pattern
taken from the es archive.

Change the test to use both es and kbn archives.
Since all these objects are loaded into a space,
just delete the space afterwards instead of
unloading with es archiver.

Helps with: elastic#102552
@wayneseymour wayneseymour force-pushed the migrations/security_solution-timelines branch from 09f96dc to d7c854d Compare October 14, 2022 13:30
@wayneseymour
Copy link
Member Author

@elasticmachine merge upstream

Copy link
Contributor

@YulNaumenko YulNaumenko left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@michaelolo24 michaelolo24 left a comment

Choose a reason for hiding this comment

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

Apologies for the delay here, it definitely got lost in the shuffle for me. Looks good!

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

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 58 64 +6
osquery 106 111 +5
securitySolution 440 446 +6
total +19

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
fleet 66 72 +6
osquery 107 113 +6
securitySolution 517 523 +6
total +20

History

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

cc @wayneseymour

@wayneseymour wayneseymour merged commit d4064c8 into elastic:main Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes test_xpack_functional v8.6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants