Skip to content

[Actions] Use references in action_task_params saved object#108964

Merged
ymao1 merged 23 commits into
elastic:masterfrom
ymao1:alerting/action-task-params-references
Aug 25, 2021
Merged

[Actions] Use references in action_task_params saved object#108964
ymao1 merged 23 commits into
elastic:masterfrom
ymao1:alerting/action-task-params-references

Conversation

@ymao1
Copy link
Copy Markdown
Contributor

@ymao1 ymao1 commented Aug 17, 2021

Resolves #108082

Summary

  • Updates reading and writing of action_task_params saved object to store the associated actionId and any relatedSavedObjects IDs in the references array. actionId is only extracted if the action is not preconfigured.
  • Adds migration to update existing action_task_params to follow the same format.

To Verify

Actions (not preconfigured)

  • Run this branch and create a rule with actions (not preconfigured)
  • Use Dev Tools to inspect an action_task_params saved object. You should see that there is an entry in the references array that points to the action saved object ID, with name actionRef and type action. You should see that the relatedSavedObjects stores refs instead of ids and the SO IDs are in the references array
  • Verify that this rule and its actions run successfully and that the event log documents for action execution have the corrected saved object information in them.

Preconfigured Actions

  • Create a rule with a preconfigured action
  • Use Dev Tools to inspect an action_task_params saved object. You should not see an entry in the references array with name actionRef and type action. You should still see that the relatedSavedObjects stores refs instead of ids and the SO IDs are in the references array
  • Verify that this rule and its actions run successfully and that the event log documents for action execution have the corrected saved object information in them.

Checklist

Delete any items that are not applicable to this PR.

@ymao1 ymao1 self-assigned this Aug 19, 2021
@ymao1 ymao1 added Feature:Actions/Framework Issues related to the Actions Framework release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// v7.16.0 v8.0.0 labels Aug 19, 2021
@ymao1 ymao1 marked this pull request as ready for review August 19, 2021 14:26
@ymao1 ymao1 requested a review from a team as a code owner August 19, 2021 14:26
@elasticmachine
Copy link
Copy Markdown
Contributor

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

@ymao1
Copy link
Copy Markdown
Contributor Author

ymao1 commented Aug 23, 2021

@elasticmachine merge upstream

@chrisronline chrisronline self-requested a review August 23, 2021 14:46
Copy link
Copy Markdown
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.

This looks great! I added a couple questions/nitpicks that I wanted to get your thoughts on before I officially approve it

Comment thread x-pack/plugins/actions/server/create_execute_function.ts Outdated
Comment thread x-pack/plugins/actions/server/lib/action_task_params_utils.ts
Comment thread x-pack/plugins/actions/server/lib/action_task_params_utils.ts Outdated
Comment thread x-pack/plugins/actions/server/lib/action_task_params_utils.ts Outdated
@ymao1 ymao1 requested a review from chrisronline August 23, 2021 20:36
Copy link
Copy Markdown
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
Copy Markdown
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!

@ymao1 ymao1 added the auto-backport Deprecated - use backport:version if exact versions are needed label Aug 25, 2021
@ymao1
Copy link
Copy Markdown
Contributor Author

ymao1 commented Aug 25, 2021

@elasticmachine merge upstream

@kibanamachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

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

cc @ymao1

@ymao1 ymao1 merged commit c037e25 into elastic:master Aug 25, 2021
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Aug 25, 2021
…c#108964)

* Extracting saved object references before saving action_task_params saved object

* Injecting saved object ids from references when reading action_task_param

* Adding migration

* Adding unit test for migrations

* Not differentiating between preconfigured or not

* Adding functional test for migration

* Skip extracting action id if action is preconfigured

* Only migrating action task params for non preconfigured connectors

* Simplifying related saved objects

* Fixing functional test

* Fixing migration

* Javascript is sometimes magical

* Updating functional test

* PR feedback

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

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

kibanamachine added a commit that referenced this pull request Aug 25, 2021
… (#110056)

* Extracting saved object references before saving action_task_params saved object

* Injecting saved object ids from references when reading action_task_param

* Adding migration

* Adding unit test for migrations

* Not differentiating between preconfigured or not

* Adding functional test for migration

* Skip extracting action id if action is preconfigured

* Only migrating action task params for non preconfigured connectors

* Simplifying related saved objects

* Fixing functional test

* Fixing migration

* Javascript is sometimes magical

* Updating functional test

* PR feedback

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

Co-authored-by: ymao1 <ying.mao@elastic.co>
@ymao1 ymao1 deleted the alerting/action-task-params-references branch August 30, 2021 11:03
patrykkopycinski pushed a commit to patrykkopycinski/kibana that referenced this pull request May 6, 2026
…c#108964)

* Extracting saved object references before saving action_task_params saved object

* Injecting saved object ids from references when reading action_task_param

* Adding migration

* Adding unit test for migrations

* Not differentiating between preconfigured or not

* Adding functional test for migration

* Skip extracting action id if action is preconfigured

* Only migrating action task params for non preconfigured connectors

* Simplifying related saved objects

* Fixing functional test

* Fixing migration

* Javascript is sometimes magical

* Updating functional test

* PR feedback

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

auto-backport Deprecated - use backport:version if exact versions are needed Feature:Actions/Framework Issues related to the Actions Framework release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// v7.16.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Actions][7.x] Move saved object fields to references for action_task_params

5 participants