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

[ResponseOps][MW] Fix bug when creating repeating Maintenance Window #207084

Merged
merged 7 commits into from
Jan 24, 2025

Conversation

adcoelho
Copy link
Contributor

@adcoelho adcoelho commented Jan 17, 2025

Closes #198774

Summary

  • There was a bug when submitting rrule with a byweekday I fixed that validation to use a more inclusive regex. byweekday can be the expected MO, TU, etc but also -1FR or +3SA where the number corresponds to the week in a month.
  • The model version for the maintenance window was incorrect so when saving the SO the validation was failing. I fixed that and now we are allowed to save number[] as expected.
  • I removed some duplicated code and we now use the rrule schema from the common folder

The maintenance window client now uses the schema from common. No more duplication.
Tests.
@adcoelho adcoelho added Feature:Alerting release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v9.0.0 backport:prev-minor Backport to (9.0) the previous minor version (i.e. one version back from main) labels Jan 17, 2025
@adcoelho adcoelho self-assigned this Jan 17, 2025
@adcoelho adcoelho requested a review from a team as a code owner January 17, 2025 14:31
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@adcoelho adcoelho requested a review from Zacqary January 17, 2025 14:33
* 2.0.
*/

export const validateRecurrenceByWeekday = (array: string[]) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It might make sense to move this to the rule package

Copy link
Contributor

Choose a reason for hiding this comment

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

agree

Copy link
Contributor

@js-jankisalvi js-jankisalvi left a comment

Choose a reason for hiding this comment

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

Don't see the error anymore 👍 Have a query about regex.

* 2.0.
*/

export const validateRecurrenceByWeekday = (array: string[]) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

agree

return 'rRule byweekday cannot be empty';
}

const byWeekDayRegex = new RegExp('^(((\\+|-)[1-4])?(MO|TU|WE|TH|FR|SA|SU))$');
Copy link
Contributor

@js-jankisalvi js-jankisalvi Jan 20, 2025

Choose a reason for hiding this comment

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

wow 😅 why only 1-4, what if there are 5 Mondays in a month?

Copy link
Contributor

Choose a reason for hiding this comment

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

Looking into the iCalendar RRULE spec the ByWeekday syntax is actually completely non-standard, it's a holdover from the original RRule library's basis on python-dateutil

Spec-compliant syntax definitely does support "5th Monday of the month" but it supports it in the form of BYDAY=MO,BYSETPOS=5, which python-dateutil parses as BYWEEKDAY=+5MO

Given that we're already wildly off-spec I think right now we should just be concerned with what kind of expressions our UIs are capable of generating. Is it possible to get the recurrence scheduler for snoozes or maintenance windows to output "5th Monday of the month"? If not I'd say let's keep it invalid for now. I'm working to open source the RRule library as its own NPM package independent of Kibana, and we can make spec compliance and a clean break from python-dateutil a part of that effort. For now let's just make sure it's capable of supporting what we expect a Kibana user to create from the UI.

@adcoelho adcoelho added backport:all-open Backport to all branches that could still receive a release and removed backport:prev-minor Backport to (9.0) the previous minor version (i.e. one version back from main) labels Jan 23, 2025
@adcoelho adcoelho added backport:prev-major Backport to (8.x, 8.18, 8.17, 8.16) the previous major branch and other branches in development and removed backport:all-open Backport to all branches that could still receive a release labels Jan 24, 2025
@adcoelho adcoelho enabled auto-merge (squash) January 24, 2025 09:55
@adcoelho adcoelho merged commit 0df78e6 into elastic:main Jan 24, 2025
11 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.16, 8.17, 8.x

https://github.com/elastic/kibana/actions/runs/12948923464

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

cc @adcoelho

@kibanamachine
Copy link
Contributor

adcoelho added a commit to adcoelho/kibana that referenced this pull request Jan 24, 2025
…lastic#207084)

Closes elastic#198774

## Summary

- There was a bug when submitting `rrule` with a `byweekday` I fixed
that validation to use a more inclusive regex. `byweekday` can be the
expected `MO`, `TU`, etc but also `-1FR` or `+3SA` where the number
corresponds to the week in a month.
- The model version for the maintenance window was incorrect so when
saving the SO the validation was failing. I fixed that and now we are
allowed to save `number[]` as expected.
- I removed some duplicated code and we now use the `rrule` schema from
the `common` folder

(cherry picked from commit 0df78e6)

# Conflicts:
#	x-pack/platform/plugins/shared/alerting/common/routes/r_rule/validation/validate_recurrence_by_weekday/latest.ts
#	x-pack/platform/plugins/shared/alerting/server/application/r_rule/validation/validate_start_date.ts
#	x-pack/plugins/alerting/server/application/r_rule/schemas/r_rule_request_schema.ts
#	x-pack/plugins/alerting/server/application/r_rule/types/r_rule_request.ts
#	x-pack/plugins/alerting/server/application/r_rule/validation/index.ts
#	x-pack/plugins/alerting/server/application/r_rule/validation/validate_end_date.ts
#	x-pack/plugins/alerting/server/application/r_rule/validation/validate_recurrence_by.ts
#	x-pack/plugins/alerting/server/application/r_rule/validation/validate_start_date.ts
@adcoelho
Copy link
Contributor Author

💔 Some backports could not be created

Status Branch Result
8.x
8.17
8.16 Conflict resolution was aborted by the user

Note: Successful backport PRs will be merged automatically after passing CI.

Manual backport

To create the backport manually run:

node scripts/backport --pr 207084

Questions ?

Please refer to the Backport tool documentation

cnasikas pushed a commit that referenced this pull request Jan 24, 2025
…indow (#207084) (#208181)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[ResponseOps][MW] Fix bug when creating repeating Maintenance Window
(#207084)](#207084)

<!--- Backport version: 9.6.4 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT
[{"author":{"name":"Antonio","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-01-24T11:40:25Z","message":"[ResponseOps][MW]
Fix bug when creating repeating Maintenance Window (#207084)\n\nCloses
#198774\r\n\r\n## Summary\r\n\r\n- There was a bug when submitting
`rrule` with a `byweekday` I fixed\r\nthat validation to use a more
inclusive regex. `byweekday` can be the\r\nexpected `MO`, `TU`, etc but
also `-1FR` or `+3SA` where the number\r\ncorresponds to the week in a
month.\r\n- The model version for the maintenance window was incorrect
so when\r\nsaving the SO the validation was failing. I fixed that and
now we are\r\nallowed to save `number[]` as expected.\r\n- I removed
some duplicated code and we now use the `rrule` schema from\r\nthe
`common`
folder","sha":"0df78e629b429f6007f559aca339b4323b71e4c0","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Alerting","release_note:skip","Team:ResponseOps","v9.0.0","backport:prev-major"],"title":"[ResponseOps][MW]
Fix bug when creating repeating Maintenance
Window","number":207084,"url":"https://github.com/elastic/kibana/pull/207084","mergeCommit":{"message":"[ResponseOps][MW]
Fix bug when creating repeating Maintenance Window (#207084)\n\nCloses
#198774\r\n\r\n## Summary\r\n\r\n- There was a bug when submitting
`rrule` with a `byweekday` I fixed\r\nthat validation to use a more
inclusive regex. `byweekday` can be the\r\nexpected `MO`, `TU`, etc but
also `-1FR` or `+3SA` where the number\r\ncorresponds to the week in a
month.\r\n- The model version for the maintenance window was incorrect
so when\r\nsaving the SO the validation was failing. I fixed that and
now we are\r\nallowed to save `number[]` as expected.\r\n- I removed
some duplicated code and we now use the `rrule` schema from\r\nthe
`common`
folder","sha":"0df78e629b429f6007f559aca339b4323b71e4c0"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/207084","number":207084,"mergeCommit":{"message":"[ResponseOps][MW]
Fix bug when creating repeating Maintenance Window (#207084)\n\nCloses
#198774\r\n\r\n## Summary\r\n\r\n- There was a bug when submitting
`rrule` with a `byweekday` I fixed\r\nthat validation to use a more
inclusive regex. `byweekday` can be the\r\nexpected `MO`, `TU`, etc but
also `-1FR` or `+3SA` where the number\r\ncorresponds to the week in a
month.\r\n- The model version for the maintenance window was incorrect
so when\r\nsaving the SO the validation was failing. I fixed that and
now we are\r\nallowed to save `number[]` as expected.\r\n- I removed
some duplicated code and we now use the `rrule` schema from\r\nthe
`common` folder","sha":"0df78e629b429f6007f559aca339b4323b71e4c0"}}]}]
BACKPORT-->
adcoelho added a commit to adcoelho/kibana that referenced this pull request Jan 26, 2025
…lastic#207084)

Closes elastic#198774

- There was a bug when submitting `rrule` with a `byweekday` I fixed
that validation to use a more inclusive regex. `byweekday` can be the
expected `MO`, `TU`, etc but also `-1FR` or `+3SA` where the number
corresponds to the week in a month.
- The model version for the maintenance window was incorrect so when
saving the SO the validation was failing. I fixed that and now we are
allowed to save `number[]` as expected.
- I removed some duplicated code and we now use the `rrule` schema from
the `common` folder

(cherry picked from commit 0df78e6)
@adcoelho
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
8.17

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

adcoelho added a commit to adcoelho/kibana that referenced this pull request Jan 26, 2025
…lastic#207084)

Closes elastic#198774

- There was a bug when submitting `rrule` with a `byweekday` I fixed
that validation to use a more inclusive regex. `byweekday` can be the
expected `MO`, `TU`, etc but also `-1FR` or `+3SA` where the number
corresponds to the week in a month.
- The model version for the maintenance window was incorrect so when
saving the SO the validation was failing. I fixed that and now we are
allowed to save `number[]` as expected.
- I removed some duplicated code and we now use the `rrule` schema from
the `common` folder

(cherry picked from commit 0df78e6)
@adcoelho
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
8.17

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

adcoelho added a commit to adcoelho/kibana that referenced this pull request Jan 26, 2025
…lastic#207084)

Closes elastic#198774

- There was a bug when submitting `rrule` with a `byweekday` I fixed
that validation to use a more inclusive regex. `byweekday` can be the
expected `MO`, `TU`, etc but also `-1FR` or `+3SA` where the number
corresponds to the week in a month.
- The model version for the maintenance window was incorrect so when
saving the SO the validation was failing. I fixed that and now we are
allowed to save `number[]` as expected.
- I removed some duplicated code and we now use the `rrule` schema from
the `common` folder

(cherry picked from commit 0df78e6)
@adcoelho
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
8.16

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

adcoelho added a commit that referenced this pull request Jan 27, 2025
…Window (#207084) (#208313)

# Backport

This will backport the following commits from `main` to `8.16`:
- [[ResponseOps][MW] Fix bug when creating repeating Maintenance Window
(#207084)](#207084)

<!--- Backport version: 9.6.4 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT
[{"author":{"name":"Antonio","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-01-24T11:40:25Z","message":"[ResponseOps][MW]
Fix bug when creating repeating Maintenance Window (#207084)\n\nCloses
#198774\r\n\r\n## Summary\r\n\r\n- There was a bug when submitting
`rrule` with a `byweekday` I fixed\r\nthat validation to use a more
inclusive regex. `byweekday` can be the\r\nexpected `MO`, `TU`, etc but
also `-1FR` or `+3SA` where the number\r\ncorresponds to the week in a
month.\r\n- The model version for the maintenance window was incorrect
so when\r\nsaving the SO the validation was failing. I fixed that and
now we are\r\nallowed to save `number[]` as expected.\r\n- I removed
some duplicated code and we now use the `rrule` schema from\r\nthe
`common`
folder","sha":"0df78e629b429f6007f559aca339b4323b71e4c0","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Alerting","release_note:skip","Team:ResponseOps","v9.0.0","backport:prev-major","v8.18.0"],"title":"[ResponseOps][MW]
Fix bug when creating repeating Maintenance
Window","number":207084,"url":"https://github.com/elastic/kibana/pull/207084","mergeCommit":{"message":"[ResponseOps][MW]
Fix bug when creating repeating Maintenance Window (#207084)\n\nCloses
#198774\r\n\r\n## Summary\r\n\r\n- There was a bug when submitting
`rrule` with a `byweekday` I fixed\r\nthat validation to use a more
inclusive regex. `byweekday` can be the\r\nexpected `MO`, `TU`, etc but
also `-1FR` or `+3SA` where the number\r\ncorresponds to the week in a
month.\r\n- The model version for the maintenance window was incorrect
so when\r\nsaving the SO the validation was failing. I fixed that and
now we are\r\nallowed to save `number[]` as expected.\r\n- I removed
some duplicated code and we now use the `rrule` schema from\r\nthe
`common`
folder","sha":"0df78e629b429f6007f559aca339b4323b71e4c0"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/207084","number":207084,"mergeCommit":{"message":"[ResponseOps][MW]
Fix bug when creating repeating Maintenance Window (#207084)\n\nCloses
#198774\r\n\r\n## Summary\r\n\r\n- There was a bug when submitting
`rrule` with a `byweekday` I fixed\r\nthat validation to use a more
inclusive regex. `byweekday` can be the\r\nexpected `MO`, `TU`, etc but
also `-1FR` or `+3SA` where the number\r\ncorresponds to the week in a
month.\r\n- The model version for the maintenance window was incorrect
so when\r\nsaving the SO the validation was failing. I fixed that and
now we are\r\nallowed to save `number[]` as expected.\r\n- I removed
some duplicated code and we now use the `rrule` schema from\r\nthe
`common`
folder","sha":"0df78e629b429f6007f559aca339b4323b71e4c0"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/208181","number":208181,"state":"MERGED","mergeCommit":{"sha":"8759f0286675744937e4ed8f5ad4880e35f6547e","message":"[8.x]
[ResponseOps][MW] Fix bug when creating repeating Maintenance Window
(#207084) (#208181)\n\n# Backport\r\n\r\nThis will backport the
following commits from `main` to `8.x`:\r\n- [[ResponseOps][MW] Fix bug
when creating repeating Maintenance
Window\r\n(#207084)](https://github.com/elastic/kibana/pull/207084)\r\n\r\n<!---
Backport version: 9.6.4 -->\r\n\r\n### Questions ?\r\nPlease refer to
the [Backport
tool\r\ndocumentation](https://github.com/sorenlouv/backport)\r\n\r\n<!--BACKPORT\r\n[{\"author\":{\"name\":\"Antonio\",\"email\":\"[email protected]\"},\"sourceCommit\":{\"committedDate\":\"2025-01-24T11:40:25Z\",\"message\":\"[ResponseOps][MW]\r\nFix
bug when creating repeating Maintenance Window
(#207084)\\n\\nCloses\r\n#198774\\r\\n\\r\\n## Summary\\r\\n\\r\\n-
There was a bug when submitting\r\n`rrule` with a `byweekday` I
fixed\\r\\nthat validation to use a more\r\ninclusive regex. `byweekday`
can be the\\r\\nexpected `MO`, `TU`, etc but\r\nalso `-1FR` or `+3SA`
where the number\\r\\ncorresponds to the week in a\r\nmonth.\\r\\n- The
model version for the maintenance window was incorrect\r\nso
when\\r\\nsaving the SO the validation was failing. I fixed that
and\r\nnow we are\\r\\nallowed to save `number[]` as expected.\\r\\n- I
removed\r\nsome duplicated code and we now use the `rrule` schema
from\\r\\nthe\r\n`common`\r\nfolder\",\"sha\":\"0df78e629b429f6007f559aca339b4323b71e4c0\",\"branchLabelMapping\":{\"^v9.0.0$\":\"main\",\"^v8.18.0$\":\"8.x\",\"^v(\\\\d+).(\\\\d+).\\\\d+$\":\"$1.$2\"}},\"sourcePullRequest\":{\"labels\":[\"Feature:Alerting\",\"release_note:skip\",\"Team:ResponseOps\",\"v9.0.0\",\"backport:prev-major\"],\"title\":\"[ResponseOps][MW]\r\nFix
bug when creating repeating
Maintenance\r\nWindow\",\"number\":207084,\"url\":\"https://github.com/elastic/kibana/pull/207084\",\"mergeCommit\":{\"message\":\"[ResponseOps][MW]\r\nFix
bug when creating repeating Maintenance Window
(#207084)\\n\\nCloses\r\n#198774\\r\\n\\r\\n## Summary\\r\\n\\r\\n-
There was a bug when submitting\r\n`rrule` with a `byweekday` I
fixed\\r\\nthat validation to use a more\r\ninclusive regex. `byweekday`
can be the\\r\\nexpected `MO`, `TU`, etc but\r\nalso `-1FR` or `+3SA`
where the number\\r\\ncorresponds to the week in a\r\nmonth.\\r\\n- The
model version for the maintenance window was incorrect\r\nso
when\\r\\nsaving the SO the validation was failing. I fixed that
and\r\nnow we are\\r\\nallowed to save `number[]` as expected.\\r\\n- I
removed\r\nsome duplicated code and we now use the `rrule` schema
from\\r\\nthe\r\n`common`\r\nfolder\",\"sha\":\"0df78e629b429f6007f559aca339b4323b71e4c0\"}},\"sourceBranch\":\"main\",\"suggestedTargetBranches\":[],\"targetPullRequestStates\":[{\"branch\":\"main\",\"label\":\"v9.0.0\",\"branchLabelMappingKey\":\"^v9.0.0$\",\"isSourceBranch\":true,\"state\":\"MERGED\",\"url\":\"https://github.com/elastic/kibana/pull/207084\",\"number\":207084,\"mergeCommit\":{\"message\":\"[ResponseOps][MW]\r\nFix
bug when creating repeating Maintenance Window
(#207084)\\n\\nCloses\r\n#198774\\r\\n\\r\\n## Summary\\r\\n\\r\\n-
There was a bug when submitting\r\n`rrule` with a `byweekday` I
fixed\\r\\nthat validation to use a more\r\ninclusive regex. `byweekday`
can be the\\r\\nexpected `MO`, `TU`, etc but\r\nalso `-1FR` or `+3SA`
where the number\\r\\ncorresponds to the week in a\r\nmonth.\\r\\n- The
model version for the maintenance window was incorrect\r\nso
when\\r\\nsaving the SO the validation was failing. I fixed that
and\r\nnow we are\\r\\nallowed to save `number[]` as expected.\\r\\n- I
removed\r\nsome duplicated code and we now use the `rrule` schema
from\\r\\nthe\r\n`common`
folder\",\"sha\":\"0df78e629b429f6007f559aca339b4323b71e4c0\"}}]}]\r\nBACKPORT-->"}},{"url":"https://github.com/elastic/kibana/pull/208312","number":208312,"branch":"8.17","state":"OPEN"}]}]
BACKPORT-->
adcoelho added a commit that referenced this pull request Jan 27, 2025
…Window (#207084) (#208312)

# Backport

This will backport the following commits from `main` to `8.17`:
- [[ResponseOps][MW] Fix bug when creating repeating Maintenance Window
(#207084)](#207084)

<!--- Backport version: 9.6.4 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT
[{"author":{"name":"Antonio","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-01-24T11:40:25Z","message":"[ResponseOps][MW]
Fix bug when creating repeating Maintenance Window (#207084)\n\nCloses
#198774\r\n\r\n## Summary\r\n\r\n- There was a bug when submitting
`rrule` with a `byweekday` I fixed\r\nthat validation to use a more
inclusive regex. `byweekday` can be the\r\nexpected `MO`, `TU`, etc but
also `-1FR` or `+3SA` where the number\r\ncorresponds to the week in a
month.\r\n- The model version for the maintenance window was incorrect
so when\r\nsaving the SO the validation was failing. I fixed that and
now we are\r\nallowed to save `number[]` as expected.\r\n- I removed
some duplicated code and we now use the `rrule` schema from\r\nthe
`common`
folder","sha":"0df78e629b429f6007f559aca339b4323b71e4c0","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Alerting","release_note:skip","Team:ResponseOps","v9.0.0","backport:prev-major","v8.18.0"],"title":"[ResponseOps][MW]
Fix bug when creating repeating Maintenance
Window","number":207084,"url":"https://github.com/elastic/kibana/pull/207084","mergeCommit":{"message":"[ResponseOps][MW]
Fix bug when creating repeating Maintenance Window (#207084)\n\nCloses
#198774\r\n\r\n## Summary\r\n\r\n- There was a bug when submitting
`rrule` with a `byweekday` I fixed\r\nthat validation to use a more
inclusive regex. `byweekday` can be the\r\nexpected `MO`, `TU`, etc but
also `-1FR` or `+3SA` where the number\r\ncorresponds to the week in a
month.\r\n- The model version for the maintenance window was incorrect
so when\r\nsaving the SO the validation was failing. I fixed that and
now we are\r\nallowed to save `number[]` as expected.\r\n- I removed
some duplicated code and we now use the `rrule` schema from\r\nthe
`common`
folder","sha":"0df78e629b429f6007f559aca339b4323b71e4c0"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/207084","number":207084,"mergeCommit":{"message":"[ResponseOps][MW]
Fix bug when creating repeating Maintenance Window (#207084)\n\nCloses
#198774\r\n\r\n## Summary\r\n\r\n- There was a bug when submitting
`rrule` with a `byweekday` I fixed\r\nthat validation to use a more
inclusive regex. `byweekday` can be the\r\nexpected `MO`, `TU`, etc but
also `-1FR` or `+3SA` where the number\r\ncorresponds to the week in a
month.\r\n- The model version for the maintenance window was incorrect
so when\r\nsaving the SO the validation was failing. I fixed that and
now we are\r\nallowed to save `number[]` as expected.\r\n- I removed
some duplicated code and we now use the `rrule` schema from\r\nthe
`common`
folder","sha":"0df78e629b429f6007f559aca339b4323b71e4c0"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/208181","number":208181,"state":"MERGED","mergeCommit":{"sha":"8759f0286675744937e4ed8f5ad4880e35f6547e","message":"[8.x]
[ResponseOps][MW] Fix bug when creating repeating Maintenance Window
(#207084) (#208181)\n\n# Backport\r\n\r\nThis will backport the
following commits from `main` to `8.x`:\r\n- [[ResponseOps][MW] Fix bug
when creating repeating Maintenance
Window\r\n(#207084)](https://github.com/elastic/kibana/pull/207084)\r\n\r\n<!---
Backport version: 9.6.4 -->\r\n\r\n### Questions ?\r\nPlease refer to
the [Backport
tool\r\ndocumentation](https://github.com/sorenlouv/backport)\r\n\r\n<!--BACKPORT\r\n[{\"author\":{\"name\":\"Antonio\",\"email\":\"[email protected]\"},\"sourceCommit\":{\"committedDate\":\"2025-01-24T11:40:25Z\",\"message\":\"[ResponseOps][MW]\r\nFix
bug when creating repeating Maintenance Window
(#207084)\\n\\nCloses\r\n#198774\\r\\n\\r\\n## Summary\\r\\n\\r\\n-
There was a bug when submitting\r\n`rrule` with a `byweekday` I
fixed\\r\\nthat validation to use a more\r\ninclusive regex. `byweekday`
can be the\\r\\nexpected `MO`, `TU`, etc but\r\nalso `-1FR` or `+3SA`
where the number\\r\\ncorresponds to the week in a\r\nmonth.\\r\\n- The
model version for the maintenance window was incorrect\r\nso
when\\r\\nsaving the SO the validation was failing. I fixed that
and\r\nnow we are\\r\\nallowed to save `number[]` as expected.\\r\\n- I
removed\r\nsome duplicated code and we now use the `rrule` schema
from\\r\\nthe\r\n`common`\r\nfolder\",\"sha\":\"0df78e629b429f6007f559aca339b4323b71e4c0\",\"branchLabelMapping\":{\"^v9.0.0$\":\"main\",\"^v8.18.0$\":\"8.x\",\"^v(\\\\d+).(\\\\d+).\\\\d+$\":\"$1.$2\"}},\"sourcePullRequest\":{\"labels\":[\"Feature:Alerting\",\"release_note:skip\",\"Team:ResponseOps\",\"v9.0.0\",\"backport:prev-major\"],\"title\":\"[ResponseOps][MW]\r\nFix
bug when creating repeating
Maintenance\r\nWindow\",\"number\":207084,\"url\":\"https://github.com/elastic/kibana/pull/207084\",\"mergeCommit\":{\"message\":\"[ResponseOps][MW]\r\nFix
bug when creating repeating Maintenance Window
(#207084)\\n\\nCloses\r\n#198774\\r\\n\\r\\n## Summary\\r\\n\\r\\n-
There was a bug when submitting\r\n`rrule` with a `byweekday` I
fixed\\r\\nthat validation to use a more\r\ninclusive regex. `byweekday`
can be the\\r\\nexpected `MO`, `TU`, etc but\r\nalso `-1FR` or `+3SA`
where the number\\r\\ncorresponds to the week in a\r\nmonth.\\r\\n- The
model version for the maintenance window was incorrect\r\nso
when\\r\\nsaving the SO the validation was failing. I fixed that
and\r\nnow we are\\r\\nallowed to save `number[]` as expected.\\r\\n- I
removed\r\nsome duplicated code and we now use the `rrule` schema
from\\r\\nthe\r\n`common`\r\nfolder\",\"sha\":\"0df78e629b429f6007f559aca339b4323b71e4c0\"}},\"sourceBranch\":\"main\",\"suggestedTargetBranches\":[],\"targetPullRequestStates\":[{\"branch\":\"main\",\"label\":\"v9.0.0\",\"branchLabelMappingKey\":\"^v9.0.0$\",\"isSourceBranch\":true,\"state\":\"MERGED\",\"url\":\"https://github.com/elastic/kibana/pull/207084\",\"number\":207084,\"mergeCommit\":{\"message\":\"[ResponseOps][MW]\r\nFix
bug when creating repeating Maintenance Window
(#207084)\\n\\nCloses\r\n#198774\\r\\n\\r\\n## Summary\\r\\n\\r\\n-
There was a bug when submitting\r\n`rrule` with a `byweekday` I
fixed\\r\\nthat validation to use a more\r\ninclusive regex. `byweekday`
can be the\\r\\nexpected `MO`, `TU`, etc but\r\nalso `-1FR` or `+3SA`
where the number\\r\\ncorresponds to the week in a\r\nmonth.\\r\\n- The
model version for the maintenance window was incorrect\r\nso
when\\r\\nsaving the SO the validation was failing. I fixed that
and\r\nnow we are\\r\\nallowed to save `number[]` as expected.\\r\\n- I
removed\r\nsome duplicated code and we now use the `rrule` schema
from\\r\\nthe\r\n`common`
folder\",\"sha\":\"0df78e629b429f6007f559aca339b4323b71e4c0\"}}]}]\r\nBACKPORT-->"}}]}]
BACKPORT-->
JoseLuisGJ pushed a commit to JoseLuisGJ/kibana that referenced this pull request Jan 27, 2025
…lastic#207084)

Closes elastic#198774

## Summary

- There was a bug when submitting `rrule` with a `byweekday` I fixed
that validation to use a more inclusive regex. `byweekday` can be the
expected `MO`, `TU`, etc but also `-1FR` or `+3SA` where the number
corresponds to the week in a month.
- The model version for the maintenance window was incorrect so when
saving the SO the validation was failing. I fixed that and now we are
allowed to save `number[]` as expected.
- I removed some duplicated code and we now use the `rrule` schema from
the `common` folder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-major Backport to (8.x, 8.18, 8.17, 8.16) the previous major branch and other branches in development Feature:Alerting release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.16.4 v8.17.2 v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ResponseOps][MW] Cannot create MW when setting a custom schedule for every month or year
5 participants