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

Allow detectors to be stopped if underlying workflow is deleted. Don't allow them to then be started/editted #810

Conversation

engechas
Copy link
Collaborator

Description

Related to #790. Adds logic to allow a user to stop a detector when the underlying workflow is deleted. Also adds an actionable exception when trying to edit or start a detector after the underlying workflow has been deleted.

image

Issues Resolved

#618

Check List

  • New functionality includes testing.
    • All tests pass
  • [N/A] New functionality has been documented.
    • [N/A] New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Copy link

codecov bot commented Jan 17, 2024

Codecov Report

Attention: Patch coverage is 41.46341% with 24 lines in your changes are missing coverage. Please review.

Project coverage is 24.76%. Comparing base (42849c7) to head (ae296f6).

Files Patch % Lines
...lytics/transport/TransportIndexDetectorAction.java 0.00% 14 Missing ⚠️
...ytics/transport/TransportDeleteDetectorAction.java 0.00% 8 Missing ⚠️
...g/opensearch/securityanalytics/model/Detector.java 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #810      +/-   ##
============================================
+ Coverage     24.68%   24.76%   +0.08%     
- Complexity     1043     1054      +11     
============================================
  Files           277      279       +2     
  Lines         12859    12886      +27     
  Branches       1405     1403       -2     
============================================
+ Hits           3174     3191      +17     
- Misses         9412     9422      +10     
  Partials        273      273              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

praveensameneni
praveensameneni previously approved these changes Feb 3, 2024
riysaxen-amzn pushed a commit to riysaxen-amzn/security-analytics that referenced this pull request Feb 20, 2024
…5 min (opensearch-project#810)

Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com>
riysaxen-amzn pushed a commit to riysaxen-amzn/security-analytics that referenced this pull request Mar 25, 2024
…#810)

Signed-off-by: Ashish Agrawal <ashisagr@amazon.com>
(cherry picked from commit db83a812606655cab076c6c9001adab30d380327)

Co-authored-by: Ashish Agrawal <ashisagr@amazon.com>
…t allow them to then be started

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>
Signed-off-by: Chase Engelbrecht <engechas@amazon.com>
Copy link
Collaborator

@jowg-amazon jowg-amazon left a comment

Choose a reason for hiding this comment

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

Code lgtm

@engechas engechas merged commit 901eb26 into opensearch-project:main Apr 3, 2024
13 of 18 checks passed
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.10 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.10 2.10
# Navigate to the new working tree
cd .worktrees/backport-2.10
# Create a new branch
git switch --create backport/backport-810-to-2.10
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 901eb266ef8585344e4a04e48856f85942c1a084
# Push it to GitHub
git push --set-upstream origin backport/backport-810-to-2.10
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.10

Then, create a pull request where the base branch is 2.10 and the compare/head branch is backport/backport-810-to-2.10.

@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.11 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.11 2.11
# Navigate to the new working tree
cd .worktrees/backport-2.11
# Create a new branch
git switch --create backport/backport-810-to-2.11
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 901eb266ef8585344e4a04e48856f85942c1a084
# Push it to GitHub
git push --set-upstream origin backport/backport-810-to-2.11
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.11

Then, create a pull request where the base branch is 2.11 and the compare/head branch is backport/backport-810-to-2.11.

@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-810-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 901eb266ef8585344e4a04e48856f85942c1a084
# Push it to GitHub
git push --set-upstream origin backport/backport-810-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-810-to-2.x.

@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.11-with-features 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.11-with-features 2.11-with-features
# Navigate to the new working tree
cd .worktrees/backport-2.11-with-features
# Create a new branch
git switch --create backport/backport-810-to-2.11-with-features
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 901eb266ef8585344e4a04e48856f85942c1a084
# Push it to GitHub
git push --set-upstream origin backport/backport-810-to-2.11-with-features
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.11-with-features

Then, create a pull request where the base branch is 2.11-with-features and the compare/head branch is backport/backport-810-to-2.11-with-features.

@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.12 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.12 2.12
# Navigate to the new working tree
cd .worktrees/backport-2.12
# Create a new branch
git switch --create backport/backport-810-to-2.12
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 901eb266ef8585344e4a04e48856f85942c1a084
# Push it to GitHub
git push --set-upstream origin backport/backport-810-to-2.12
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.12

Then, create a pull request where the base branch is 2.12 and the compare/head branch is backport/backport-810-to-2.12.

@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.13 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.13 2.13
# Navigate to the new working tree
cd .worktrees/backport-2.13
# Create a new branch
git switch --create backport/backport-810-to-2.13
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 901eb266ef8585344e4a04e48856f85942c1a084
# Push it to GitHub
git push --set-upstream origin backport/backport-810-to-2.13
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.13

Then, create a pull request where the base branch is 2.13 and the compare/head branch is backport/backport-810-to-2.13.

engechas added a commit to engechas/security-analytics that referenced this pull request Apr 3, 2024
…t allow them to then be started/editted (opensearch-project#810)

* Allow detectors to be stopped if underlying workflow is deleted. Don't allow them to then be started

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

* Add copyright headers

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

---------

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>
engechas added a commit to engechas/security-analytics that referenced this pull request Apr 3, 2024
…t allow them to then be started/editted (opensearch-project#810)

* Allow detectors to be stopped if underlying workflow is deleted. Don't allow them to then be started

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

* Add copyright headers

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

---------

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>
engechas added a commit to engechas/security-analytics that referenced this pull request Apr 3, 2024
…t allow them to then be started/editted (opensearch-project#810)

* Allow detectors to be stopped if underlying workflow is deleted. Don't allow them to then be started

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

* Add copyright headers

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

---------

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>
engechas added a commit to engechas/security-analytics that referenced this pull request Apr 3, 2024
…t allow them to then be started/editted (opensearch-project#810)

* Allow detectors to be stopped if underlying workflow is deleted. Don't allow them to then be started

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

* Add copyright headers

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

---------

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>
engechas added a commit to engechas/security-analytics that referenced this pull request Apr 3, 2024
…t allow them to then be started/editted (opensearch-project#810)

* Allow detectors to be stopped if underlying workflow is deleted. Don't allow them to then be started

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

* Add copyright headers

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

---------

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>
engechas added a commit to engechas/security-analytics that referenced this pull request Apr 3, 2024
…t allow them to then be started/editted (opensearch-project#810)

* Allow detectors to be stopped if underlying workflow is deleted. Don't allow them to then be started

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

* Add copyright headers

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>

---------

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>
engechas added a commit that referenced this pull request Apr 4, 2024
…t allow them to then be started/editted (#810) (#958)

* Allow detectors to be stopped if underlying workflow is deleted. Don't allow them to then be started



* Add copyright headers



---------

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>
engechas added a commit that referenced this pull request Apr 4, 2024
…t allow them to then be started/editted (#810) (#959)

* Allow detectors to be stopped if underlying workflow is deleted. Don't allow them to then be started



* Add copyright headers



---------

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>
engechas added a commit that referenced this pull request Apr 4, 2024
…t allow them to then be started/editted (#810) (#961)

* Allow detectors to be stopped if underlying workflow is deleted. Don't allow them to then be started



* Add copyright headers



---------

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>
engechas added a commit that referenced this pull request Apr 4, 2024
…t allow them to then be started/editted (#810) (#962)

* Allow detectors to be stopped if underlying workflow is deleted. Don't allow them to then be started



* Add copyright headers



---------

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>
engechas added a commit that referenced this pull request Apr 4, 2024
…t allow them to then be started/editted (#810) (#963)

* Allow detectors to be stopped if underlying workflow is deleted. Don't allow them to then be started



* Add copyright headers



---------

Signed-off-by: Chase Engelbrecht <engechas@amazon.com>
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.

None yet

4 participants