Modifying schedules API to allow for rrulesets #5733 (#12043)

* Added schedule_rruleset lookup plugin for awx.awx
* Added DB migration for rrule size
* Updated schedule docs
* The schedule API endpoint will now return an array of errors on rule validation to try and inform the user of all errors instead of just the first
This commit is contained in:
John Westcott IV
2022-04-28 15:38:20 -04:00
committed by GitHub
parent 2bef5ce09b
commit c67f50831b
10 changed files with 1207 additions and 118 deletions

View File

@@ -18,10 +18,11 @@ an `HTTP POST` to a variety of API endpoints:
}
...where `rrule` is a valid
[RFC5545](https://www.rfc-editor.org/rfc/rfc5545.txt) RRULE string. The
specific example above would run a job every day - for seven consecutive days - starting
[RFC5545](https://www.rfc-editor.org/rfc/rfc5545.txt) RRULE string and within AWX [RRULE Limitations](#rrule-limitations).
The specific example above would run a job every day - for seven consecutive days - starting
on January 15th, 2030 at noon (UTC).
For more examples see [RRULE Examples](#rrule-examples).
## Specifying Timezones
@@ -109,18 +110,18 @@ local and UTC time:
## RRULE Limitations
The following aspects of `RFC5545` are _not_ supported by AWX schedules:
* Strings with more than a single `DTSTART:` component
* Strings with more than a single `RRULE` component
* The use of `FREQ=SECONDLY` in an `RRULE`
* The use of more than a single `FREQ=BYMONTHDAY` component in an `RRULE`
* The use of more than a single `FREQ=BYMONTHS` component in an `RRULE`
* The use of `FREQ=BYYEARDAY` in an `RRULE`
* The use of `FREQ=BYWEEKNO` in an `RRULE`
* The use of `FREQ=BYWEEKNO` in an `RRULE`
* The use of `COUNT=` in an `RRULE` with a value over 999
AWX implements the following constraints on top of the `RFC5545` specification:
* The RRULE must start with the `DTSTART` attribute
* At least one `RRULE` entry must be in the rrule
* Strings with more than a single `DTSTART:` component are prohibited
* The use of `RDATE` or `EXDATE`is prohibited
* For any of the rules in the rrule:
* `Interval` must be included
* The use of `FREQ=SECONDLY` is prohibited
* The usage of a `BYDAY` with a prefixed number is prohibited
* The usage of both `COUNT` and `UNTIL` in the same rule is prohibited
* The use of `COUNT=` with a value over 999 is prohibited
## Implementation Details
@@ -141,3 +142,24 @@ database for Schedules where `Schedule.next_run` is between
`scheduler_last_runtime()` and `utcnow()`. For each of these, a new job is
launched, and `Schedule.next_run` is changed to the next chronological datetime
in the list of all occurences.
## Complex RRULE Examples
Every day except for April 30th:
DTSTART;TZID=US/Eastern:20230428T170000 RRULE:INTERVAL=1;FREQ=DAILY EXRULE:INTERVAL=1;FREQ=DAILY;BYMONTH=4;BYMONTHDAY=30
Every 5 minutes but not on Mondays from 5-7pm:
DTSTART;TZID=America/New_York:20220418T164500 RRULE:INTERVAL=5;FREQ=MINUTELY EXRULE:FREQ=MINUTELY;INTERVAL=5;BYDAY=MO;BYHOUR=17,18
Every 15 minutes Monday to Friday from 10:01am to 6:02pm (inclusive):
DTSTART;TZID=America/New_York:20220417T100100 RRULE:INTERVAL=15;FREQ=MINUTELY;BYDAY=MO,TU,WE,TH,FR;BYHOUR=10,11,12,13,14,15,16,17,18 EXRULE:INTERVAL=15;FREQ=MINUTELY;BYDAY=MO,TU,WE,TH,FR;BYHOUR=18;BYMINUTE=3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,34,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59
Any Saturday whose month day is between 12 and 18:
DTSTART:20191219T130551Z RRULE:FREQ=MONTHLY;INTERVAL=1;BYDAY=SA;BYMONTHDAY=12,13,14,15,16,17,18