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

[Actions] [8.0] Prepare for making action saved objects sharecapable. #109756

Conversation

YulNaumenko
Copy link
Contributor

@YulNaumenko YulNaumenko commented Aug 24, 2021

Summary

Resolves #107083

@YulNaumenko YulNaumenko self-assigned this Aug 24, 2021
@YulNaumenko YulNaumenko added Feature:Alerting/RuleActions Issues related to the Actions attached to Rules on the Alerting Framework Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.0.0 release_note:skip Skip the PR/issue when compiling release notes labels Aug 24, 2021
@YulNaumenko YulNaumenko changed the base branch from master to prepare-alerting-so-to-sharecapable August 24, 2021 03:58
@YulNaumenko YulNaumenko changed the base branch from prepare-alerting-so-to-sharecapable to master August 24, 2021 04:00
@YulNaumenko YulNaumenko marked this pull request as ready for review August 24, 2021 04:01
@YulNaumenko YulNaumenko requested a review from a team as a code owner August 24, 2021 04:01
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-alerting-services (Team:Alerting Services)

Copy link
Contributor

@ymao1 ymao1 left a comment

Choose a reason for hiding this comment

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

Some of the work is covered in this PR: #108964 and can be removed.

x-pack/plugins/actions/server/saved_objects/migrations.ts Outdated Show resolved Hide resolved
x-pack/plugins/actions/server/saved_objects/migrations.ts Outdated Show resolved Hide resolved
@YulNaumenko YulNaumenko changed the base branch from master to prepare-alerting-so-to-sharecapable August 25, 2021 23:22
@YulNaumenko YulNaumenko requested review from a team as code owners August 25, 2021 23:22
@YulNaumenko YulNaumenko requested a review from a team August 25, 2021 23:22
@YulNaumenko YulNaumenko requested review from a team as code owners August 25, 2021 23:22
@YulNaumenko YulNaumenko requested a review from a team August 25, 2021 23:22
@YulNaumenko YulNaumenko requested review from ymao1 and removed request for a team, academo and parkiino August 25, 2021 23:22
@YulNaumenko YulNaumenko force-pushed the actions-prepare-to-sharecapable branch from 92f9a77 to afe7ad9 Compare August 26, 2021 03:30
@YulNaumenko YulNaumenko changed the base branch from master to prepare-alerting-so-to-sharecapable August 26, 2021 03:31
@@ -35,7 +35,8 @@ export function setupSavedObjects(
savedObjects.registerType({
name: ACTION_SAVED_OBJECT_TYPE,
hidden: true,
namespaceType: 'single',
namespaceType: 'multiple-isolated',
convertToMultiNamespaceTypeVersion: '8.0.0',
mappings: mappings.action as SavedObjectsTypeMappingDefinition,
migrations: getActionsMigrations(encryptedSavedObjects),
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you need to add a no-op migration for the ACTION_SAVED_OBJECT_TYPE type too, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah.., I forgot about this. Thank you for pointing!

Copy link
Contributor

@jportner jportner left a comment

Choose a reason for hiding this comment

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

I added comments for a couple of nits, overall LGTM!

I checked and it appears there are already end-to-end integration tests for migrating actions and testing to ensure secrets are decrypted properly (x-pack/test/alerting_api_integration/spaces_only/tests/actions/migrations.ts), that's why CI was failing before you added the no-op migration for actions 😄
So, assuming CI passes now, those migration tests are 👍

IMO, you don't need to add a specific 8.0.0 migration integration test, but you could optionally add a comment in that file mentioning that the conversion is getting tested implicitly by virtue of the secret getting decrypted properly.

There are also end-to-end integration test for migrating action_task_params (x-pack/test/alerting_api_integration/spaces_only/tests/action_task_params/migrations.ts), but the data in the fixtures doesn't actually include any encrypted attributes. That's an area for possible improvement in the future, but is outside the scope of this PR, IMO.

Copy link
Contributor

@chrisronline chrisronline 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

@ymao1 ymao1 left a comment

Choose a reason for hiding this comment

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

LGTM when failing unit test is resolved

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

cc @YulNaumenko

@YulNaumenko YulNaumenko merged commit 2e28730 into elastic:prepare-alerting-so-to-sharecapable Aug 27, 2021
YulNaumenko added a commit that referenced this pull request Aug 31, 2021
* [Alerting] [8.0] Prepare for making alerting saved objects sharecapable (#109990)

* [Alerting] [8.0] Prepare for making alerting saved objects sharecapable

* removed v8 check

* removed link

* added no op migration

* fixed name

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

* [Actions] [8.0] Prepare for making action saved objects sharecapable. (#109756)

* [Actions] [8.0] Prepare for making action saved objects sharecapable.

* added more tests

* made it compatible to merge to 7.x

* fixed due to comments

* fixed tests

* added tests

* fixed tests

* fixed due to comments

* added no-opactions migration

* fixed test

* [Task Manager][8.0] Added migrations to savedObject Ids for "actions:* and "alerting:*" task types (#109180)

* [Task Manager][8.0] Added migrations to savedObject Ids for "actions:* and "alerting:*" task types

* fixed due to comments

* fixed typo

* added more tests

* added unit test

* added func test

* added func tests

* fixed test

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

* fixed merge

* fixed legacy tests

* fixed tests

* fixed eslint

* Update migrations.ts

fixed action task

* fixed due to comments

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
Feature:Alerting/RuleActions Issues related to the Actions attached to Rules on the Alerting Framework release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Actions] [8.0] Prepare for making action saved objects sharecapable
7 participants