Skip to content

[8.19] [ResponseOps][Alerting] Create a task to regenerate maintenance window events (#219261)#224773

Merged
cnasikas merged 1 commit intoelastic:8.19from
cnasikas:backport/8.19/pr-219261
Jun 23, 2025
Merged

[8.19] [ResponseOps][Alerting] Create a task to regenerate maintenance window events (#219261)#224773
cnasikas merged 1 commit intoelastic:8.19from
cnasikas:backport/8.19/pr-219261

Conversation

@cnasikas
Copy link
Member

Backport

This will backport the following commits from main to 8.19:

Questions ?

Please refer to the Backport tool documentation

…w events (elastic#219261)

## Summary

Resolves elastic#211534

This PR adds a recurring task which will
- run once every day
- collect maintenance windows which have expiration date within 1 week
- updates expiration date to +1 year if it is recurring
- generate events for the next 1 year
- adds new events to maintenance window

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

### How to test
- Set expiration date to less than 1 week before creating maintenance
windows: update line 70 `expirationDate = moment().utc().add(1,
'year').toISOString();` to `expirationDate = moment().utc().add(5,
'days').toISOString();` in the file
`x-pack/platform/plugins/shared/alerting/server/application/maintenance_window/methods/create/create_maintenance_window.ts`
- Create maintenance windows with different scenarios (recurring, non
recurring, etc.)
- Update task schedule to run every five minutes to test: set `{
interval: '1d' }` to `{ interval: '5m' }` in file
`x-pack/platform/plugins/shared/alerting/server/maintenance_window_events/task.ts`
- Verify the task ran successfully
- Verify maintenance windows are updated properly with new expiration
date and new events

### Flaky test runner:
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/8358

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit eaa9c1c)

# Conflicts:
#	x-pack/test/alerting_api_integration/security_and_spaces/group3/tests/maintenance_window/events_generation.ts
@cnasikas cnasikas added the backport This PR is a backport of another PR label Jun 21, 2025
@cnasikas cnasikas requested a review from kibanamachine as a code owner June 21, 2025 17:18
@cnasikas cnasikas enabled auto-merge (squash) June 21, 2025 17:18
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Unknown metric groups

ESLint disabled line counts

id before after diff
@kbn/test-suites-xpack 699 700 +1

Total ESLint disabled count

id before after diff
@kbn/test-suites-xpack 720 721 +1

@cnasikas cnasikas merged commit dc37b56 into elastic:8.19 Jun 23, 2025
11 checks passed
@cnasikas cnasikas deleted the backport/8.19/pr-219261 branch June 23, 2025 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants