-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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][ServiceNow] Allow to close serviceNow incident when alert resolves #171760
[Actions][ServiceNow] Allow to close serviceNow incident when alert resolves #171760
Conversation
@@ -8,7 +8,7 @@ | |||
import { RecoveredActionGroup } from './builtin_action_groups'; | |||
|
|||
const DisabledActionGroupsByActionType: Record<string, string[]> = { | |||
[RecoveredActionGroup.id]: ['.jira', '.servicenow', '.resilient'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To allow Recovered
option in Run when
dropdown
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@elastic/response-ops-execution FYI, it seems that some connectors are missing from this list like the .servicenow-secops
connector.
Pinging @elastic/response-ops (Team:ResponseOps) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested and everything is working as expected 🚀. I managed to create an incident and close it when the alert recovers. I left some comments.
@@ -8,7 +8,7 @@ | |||
import { RecoveredActionGroup } from './builtin_action_groups'; | |||
|
|||
const DisabledActionGroupsByActionType: Record<string, string[]> = { | |||
[RecoveredActionGroup.id]: ['.jira', '.servicenow', '.resilient'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@elastic/response-ops-execution FYI, it seems that some connectors are missing from this list like the .servicenow-secops
connector.
x-pack/plugins/stack_connectors/public/connector_types/servicenow_itsm/servicenow_itsm.tsx
Outdated
Show resolved
Hide resolved
@@ -39,6 +39,18 @@ describe('servicenow action params validation', () => { | |||
}); | |||
}); | |||
|
|||
test(`${SERVICENOW_ITSM_CONNECTOR_TYPE_ID}: action params validation succeeds when no short_description provided and subAction is closeIncident`, async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about testing that there are no errors at all? This will make the test fail if someone adds a new required field and forgets the recovered
feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added test in d627b86, is this what you meant?
...gins/stack_connectors/public/connector_types/servicenow_itsm/servicenow_itsm_params.test.tsx
Show resolved
Hide resolved
...k/plugins/stack_connectors/public/connector_types/servicenow_itsm/servicenow_itsm_params.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/stack_connectors/server/connector_types/lib/servicenow/service.test.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/stack_connectors/server/connector_types/lib/servicenow/service.test.ts
Show resolved
Hide resolved
x-pack/plugins/stack_connectors/server/connector_types/servicenow_itsm/service.test.ts
Outdated
Show resolved
Hide resolved
..._api_integration/security_and_spaces/group2/tests/actions/connector_types/servicenow_itsm.ts
Outdated
Show resolved
Hide resolved
..._api_integration/security_and_spaces/group2/tests/actions/connector_types/servicenow_itsm.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing my feedback! Some comments 🙂.
...gins/stack_connectors/public/connector_types/servicenow_itsm/servicenow_itsm_params.test.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/stack_connectors/server/connector_types/lib/servicenow/service.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/stack_connectors/server/connector_types/lib/servicenow/service.ts
Show resolved
Hide resolved
x-pack/plugins/stack_connectors/server/connector_types/lib/servicenow/service.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/stack_connectors/server/connector_types/lib/servicenow/service.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/stack_connectors/server/connector_types/lib/servicenow/types.ts
Outdated
Show resolved
Hide resolved
..._api_integration/security_and_spaces/group2/tests/actions/connector_types/servicenow_itsm.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/stack_connectors/server/connector_types/lib/servicenow/service.test.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/stack_connectors/server/connector_types/lib/servicenow/service.test.ts
Outdated
Show resolved
Hide resolved
…kisalvi/kibana into servicenow-recover-action
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGMT! I tested by creating a rule with a SN action that creates and incident and a SN action that close the incident when the alert recovers. Everything is working as expected :rocket. I found two small bugs:
- if you try to close the incident through the actions API by using the
externalId
you get an error. It seems that we need to also provide theclose_notes: 'Closed by Caller'
. In the ServiceNow UI it is a required field when you try to close an incident. - If the incident is already closed the warning message is not logged.
x-pack/plugins/stack_connectors/server/connector_types/lib/servicenow/utils.ts
Show resolved
Hide resolved
x-pack/plugins/stack_connectors/server/connector_types/lib/servicenow/service.test.ts
Show resolved
Hide resolved
Ok, I found out about the second bug, we are doing |
Fixed both bugs and added tests in e3b43c7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your patience with the review 🚀 . I tested and everything is working as expected.
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Public APIs missing comments
Async chunks
Page load bundle
Unknown metric groupsAPI count
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
Summary
Fixes: #170522
This PR allows to
close service now incident
when alert isrecovered
SN connector form shows only
correlation_id
field as it is mandatory field to close an incident.How to test:
Checklist
Delete any items that are not applicable to this PR.
For maintainers
Release notes
Auto close ServiceNow incidents when alerts are resolved