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

Adds transport layer actions for CRUD workflows #934

Merged
merged 11 commits into from
May 25, 2023

Conversation

eirsep
Copy link
Member

@eirsep eirsep commented May 24, 2023

PRs reviewed in feature branch:
Added layer for creating and updating the workflow (#831)
Fixed xContent dependencies due to OSCore changes (#839)
Dependency fix (#846)
Added transport layer classes for getting and deleting the workflow (#835)
Refactored workflowIndexing validation - removed coroutine and context ( #857)
Added workflow execution logic (#850)
Added fix when executing the workflow and when chained findings index is not initialized( #890)
Fixed deleting monitor workflow metadata (#882)

stevanbz and others added 10 commits May 25, 2023 13:46
…t#831)

* Renamed chainedFindings to chainedMonitorFindings

* Removed unecessary mappings from workflow definition

* Improved logging when saving the workflows

* Added a workflow id in response

* Added role check and index access once the workflow is being created

* Updated mappings for the workflow

---------

Signed-off-by: Stevan Buzejic <[email protected]>
opensearch-project#857)

* Refactored workflowIndexing validation - removed coroutine and context client context lost

Signed-off-by: Stevan Buzejic <[email protected]>

* refactored getting the workflows

Signed-off-by: Stevan Buzejic <[email protected]>

* Changed the logic according to secure test findings

Signed-off-by: Stevan Buzejic <[email protected]>

* [Backport 2.x] Notification security fix (opensearch-project#861) (opensearch-project#863)

* Notification security fix (opensearch-project#852)

* added injecting whole user object in threadContext before calling notification APIs so that backend roles are available to notification plugin

* compile fix

* refactored user_info injection to use InjectSecurity

* ktlint fix

---------

(cherry picked from commit e0b7a5a)

* remove unneeded import

---------

Signed-off-by: Ashish Agrawal <[email protected]>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: Petar Dzepina <[email protected]>
Co-authored-by: Ashish Agrawal <[email protected]>

* Stashed user together with it's roles

Signed-off-by: Stevan Buzejic <[email protected]>

---------

Signed-off-by: Stevan Buzejic <[email protected]>
Signed-off-by: Ashish Agrawal <[email protected]>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: Petar Dzepina <[email protected]>
Co-authored-by: Ashish Agrawal <[email protected]>
* Added workflow execution logic

Signed-off-by: Stevan Buzejic <[email protected]>

* Adjusted code according to comments

Signed-off-by: Stevan Buzejic <[email protected]>

* Updated version of the findings json

Signed-off-by: Stevan Buzejic <[email protected]>

* Updating the workflow metadata in the case of updating flag set to false while the metadata alerady exist

Signed-off-by: Stevan Buzejic <[email protected]>

* Added logging for workflow metadata update

Signed-off-by: Stevan Buzejic <[email protected]>

* Added Rest Execute Workflow action

Signed-off-by: Stevan Buzejic <[email protected]>

* Extended workflow context with workflowMetadataId. Adjusted the doc level monitor findings

Signed-off-by: Stevan Buzejic <[email protected]>

* Updated conditions for unstashing the context when indexing and deleting the workflow

Signed-off-by: Stevan Buzejic <[email protected]>

---------

Signed-off-by: Stevan Buzejic <[email protected]>
* Fixed deleting monitor metadata and workflow metadata.

Signed-off-by: Stevan Buzejic <[email protected]>
Signed-off-by: Surya Sashank Nistala <[email protected]>
Signed-off-by: Surya Sashank Nistala <[email protected]>
Signed-off-by: Surya Sashank Nistala <[email protected]>
@@ -60,6 +60,9 @@
"type" : "keyword"
}
}
},
Copy link
Member

Choose a reason for hiding this comment

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

The schema version for the findings mapping needs to be updated to 3 now.

Copy link
Member Author

Choose a reason for hiding this comment

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

updated

@eirsep eirsep merged commit 85c013d into opensearch-project:main May 25, 2023
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.x 2.x
# Navigate to the new working tree
cd .worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-934-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 85c013d982b9ac0e6c2ca890d0188bdb18eade23
# Push it to GitHub
git push --set-upstream origin backport/backport-934-to-2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-934-to-2.x.

eirsep added a commit to eirsep/alerting that referenced this pull request May 25, 2023
(cherry picked from commit e0b7a5a)

* remove unneeded import

---------

Signed-off-by: Ashish Agrawal <[email protected]>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: Petar Dzepina <[email protected]>
Co-authored-by: Ashish Agrawal <[email protected]>

* Stashed user together with it's roles

Signed-off-by: Stevan Buzejic <[email protected]>

---------

Signed-off-by: Stevan Buzejic <[email protected]>
Signed-off-by: Ashish Agrawal <[email protected]>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: Petar Dzepina <[email protected]>
Co-authored-by: Ashish Agrawal <[email protected]>

* Added workflow execution logic (opensearch-project#850)

* Added workflow execution logic

Signed-off-by: Stevan Buzejic <[email protected]>

* Adjusted code according to comments

Signed-off-by: Stevan Buzejic <[email protected]>

* Updated version of the findings json

Signed-off-by: Stevan Buzejic <[email protected]>

* Updating the workflow metadata in the case of updating flag set to false while the metadata alerady exist

Signed-off-by: Stevan Buzejic <[email protected]>

* Added logging for workflow metadata update

Signed-off-by: Stevan Buzejic <[email protected]>

* Added Rest Execute Workflow action

Signed-off-by: Stevan Buzejic <[email protected]>

* Extended workflow context with workflowMetadataId. Adjusted the doc level monitor findings

Signed-off-by: Stevan Buzejic <[email protected]>

* Updated conditions for unstashing the context when indexing and deleting the workflow

Signed-off-by: Stevan Buzejic <[email protected]>

---------

Signed-off-by: Stevan Buzejic <[email protected]>

* Added fix when executing the workflow and when chained findings index… (opensearch-project#890)

Signed-off-by: Stevan Buzejic <[email protected]>

* Fixed deleting monitor workflow metadata (opensearch-project#882)

* Fixed deleting monitor metadata and workflow metadata.

Signed-off-by: Stevan Buzejic <[email protected]>
Signed-off-by: Surya Sashank Nistala <[email protected]>

* fix monitor metadata error from conflict resolution

Signed-off-by: Surya Sashank Nistala <[email protected]>

* remove unused import

Signed-off-by: Surya Sashank Nistala <[email protected]>

* remove rest execute workflow action

Signed-off-by: Surya Sashank Nistala <[email protected]>

* increment schema version for findings mapping json

Signed-off-by: Surya Sashank Nistala <[email protected]>

---------

Signed-off-by: Stevan Buzejic <[email protected]>
Signed-off-by: Angie Zhang <[email protected]>
Signed-off-by: Ashish Agrawal <[email protected]>
Signed-off-by: Surya Sashank Nistala <[email protected]>
Co-authored-by: Stevan Buzejic <[email protected]>
Co-authored-by: Angie Zhang <[email protected]>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: Petar Dzepina <[email protected]>
Co-authored-by: Ashish Agrawal <[email protected]>
eirsep added a commit to eirsep/alerting that referenced this pull request May 25, 2023
(cherry picked from commit e0b7a5a)

* remove unneeded import

---------

Signed-off-by: Ashish Agrawal <[email protected]>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: Petar Dzepina <[email protected]>
Co-authored-by: Ashish Agrawal <[email protected]>

* Stashed user together with it's roles

Signed-off-by: Stevan Buzejic <[email protected]>

---------

Signed-off-by: Stevan Buzejic <[email protected]>
Signed-off-by: Ashish Agrawal <[email protected]>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: Petar Dzepina <[email protected]>
Co-authored-by: Ashish Agrawal <[email protected]>

* Added workflow execution logic (opensearch-project#850)

* Added workflow execution logic

Signed-off-by: Stevan Buzejic <[email protected]>

* Adjusted code according to comments

Signed-off-by: Stevan Buzejic <[email protected]>

* Updated version of the findings json

Signed-off-by: Stevan Buzejic <[email protected]>

* Updating the workflow metadata in the case of updating flag set to false while the metadata alerady exist

Signed-off-by: Stevan Buzejic <[email protected]>

* Added logging for workflow metadata update

Signed-off-by: Stevan Buzejic <[email protected]>

* Added Rest Execute Workflow action

Signed-off-by: Stevan Buzejic <[email protected]>

* Extended workflow context with workflowMetadataId. Adjusted the doc level monitor findings

Signed-off-by: Stevan Buzejic <[email protected]>

* Updated conditions for unstashing the context when indexing and deleting the workflow

Signed-off-by: Stevan Buzejic <[email protected]>

---------

Signed-off-by: Stevan Buzejic <[email protected]>

* Added fix when executing the workflow and when chained findings index… (opensearch-project#890)

Signed-off-by: Stevan Buzejic <[email protected]>

* Fixed deleting monitor workflow metadata (opensearch-project#882)

* Fixed deleting monitor metadata and workflow metadata.

Signed-off-by: Stevan Buzejic <[email protected]>
Signed-off-by: Surya Sashank Nistala <[email protected]>

* fix monitor metadata error from conflict resolution

Signed-off-by: Surya Sashank Nistala <[email protected]>

* remove unused import

Signed-off-by: Surya Sashank Nistala <[email protected]>

* remove rest execute workflow action

Signed-off-by: Surya Sashank Nistala <[email protected]>

* increment schema version for findings mapping json

Signed-off-by: Surya Sashank Nistala <[email protected]>

---------

Signed-off-by: Stevan Buzejic <[email protected]>
Signed-off-by: Angie Zhang <[email protected]>
Signed-off-by: Ashish Agrawal <[email protected]>
Signed-off-by: Surya Sashank Nistala <[email protected]>
Co-authored-by: Stevan Buzejic <[email protected]>
Co-authored-by: Angie Zhang <[email protected]>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: Petar Dzepina <[email protected]>
Co-authored-by: Ashish Agrawal <[email protected]>
eirsep added a commit that referenced this pull request May 26, 2023
(cherry picked from commit e0b7a5a)

* remove unneeded import

---------






* Stashed user together with it's roles



---------







* Added workflow execution logic (#850)

* Added workflow execution logic



* Adjusted code according to comments



* Updated version of the findings json



* Updating the workflow metadata in the case of updating flag set to false while the metadata alerady exist



* Added logging for workflow metadata update



* Added Rest Execute Workflow action



* Extended workflow context with workflowMetadataId. Adjusted the doc level monitor findings



* Updated conditions for unstashing the context when indexing and deleting the workflow



---------



* Added fix when executing the workflow and when chained findings index… (#890)



* Fixed deleting monitor workflow metadata (#882)

* Fixed deleting monitor metadata and workflow metadata.




* fix monitor metadata error from conflict resolution



* remove unused import



* remove rest execute workflow action



* increment schema version for findings mapping json



---------

Signed-off-by: Stevan Buzejic <[email protected]>
Signed-off-by: Angie Zhang <[email protected]>
Signed-off-by: Ashish Agrawal <[email protected]>
Signed-off-by: Surya Sashank Nistala <[email protected]>
Co-authored-by: Stevan Buzejic <[email protected]>
Co-authored-by: Angie Zhang <[email protected]>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: Petar Dzepina <[email protected]>
Co-authored-by: Ashish Agrawal <[email protected]>
opensearch-trigger-bot bot pushed a commit that referenced this pull request May 27, 2023
(cherry picked from commit e0b7a5a)

* remove unneeded import

---------

* Stashed user together with it's roles

---------

* Added workflow execution logic (#850)

* Added workflow execution logic

* Adjusted code according to comments

* Updated version of the findings json

* Updating the workflow metadata in the case of updating flag set to false while the metadata alerady exist

* Added logging for workflow metadata update

* Added Rest Execute Workflow action

* Extended workflow context with workflowMetadataId. Adjusted the doc level monitor findings

* Updated conditions for unstashing the context when indexing and deleting the workflow

---------

* Added fix when executing the workflow and when chained findings index… (#890)

* Fixed deleting monitor workflow metadata (#882)

* Fixed deleting monitor metadata and workflow metadata.

* fix monitor metadata error from conflict resolution

* remove unused import

* remove rest execute workflow action

* increment schema version for findings mapping json

---------

Signed-off-by: Stevan Buzejic <[email protected]>
Signed-off-by: Angie Zhang <[email protected]>
Signed-off-by: Ashish Agrawal <[email protected]>
Signed-off-by: Surya Sashank Nistala <[email protected]>
Co-authored-by: Stevan Buzejic <[email protected]>
Co-authored-by: Angie Zhang <[email protected]>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: Petar Dzepina <[email protected]>
Co-authored-by: Ashish Agrawal <[email protected]>
(cherry picked from commit 171cd2e)
getsaurabh02 pushed a commit that referenced this pull request May 31, 2023
(cherry picked from commit e0b7a5a)

* remove unneeded import

---------

* Stashed user together with it's roles

---------

* Added workflow execution logic (#850)

* Added workflow execution logic

* Adjusted code according to comments

* Updated version of the findings json

* Updating the workflow metadata in the case of updating flag set to false while the metadata alerady exist

* Added logging for workflow metadata update

* Added Rest Execute Workflow action

* Extended workflow context with workflowMetadataId. Adjusted the doc level monitor findings

* Updated conditions for unstashing the context when indexing and deleting the workflow

---------

* Added fix when executing the workflow and when chained findings index… (#890)

* Fixed deleting monitor workflow metadata (#882)

* Fixed deleting monitor metadata and workflow metadata.

* fix monitor metadata error from conflict resolution

* remove unused import

* remove rest execute workflow action

* increment schema version for findings mapping json

---------

Signed-off-by: Stevan Buzejic <[email protected]>
Signed-off-by: Angie Zhang <[email protected]>
Signed-off-by: Ashish Agrawal <[email protected]>
Signed-off-by: Surya Sashank Nistala <[email protected]>
Co-authored-by: Stevan Buzejic <[email protected]>
Co-authored-by: Angie Zhang <[email protected]>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: Petar Dzepina <[email protected]>
Co-authored-by: Ashish Agrawal <[email protected]>
(cherry picked from commit 171cd2e)

Co-authored-by: Surya Sashank Nistala <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants