Distribute daily cron schedules out over the hour

Problem to solve

When creating a pipeline schedule, currently there are some quick options. All of these kick-off at exactly 4 am which creates a relatively large load on our system at that time.

For example, if you choose daily at 4 am, then each job gets the cron value of 0 4 * * *.

Cron example
cron

This is actually our biggest reliable source of queue congestion on .com and so I'm going to flag this as a ~S2 based upon https://gitlab.com/gitlab-org/gitlab-foss/blob/master/doc/development/contributing/issue_workflow.md#severity-labels

Intended users

Managing persona User persona
Our own systems administrators (Sidney (Systems Administrator)) have to better manage our load balancing. Devon (DevOps Engineer) to setup scheduled automated pipelines

Further details

Proposal

Spread the load out over the hour by randomizing the minute field and hide the filled-in cron text when using the daily/weekly/monthly options. So for example when a user selects "Daily at 4 am" the cron value set behind the scenes is a value ranging from 0 4 * * * to 59 4 * * * where the minute digit is chosen at random.

  1. Making the preset outcomes editable after being chosen
    • The cron field stays editable
  2. Allowing for timezones to be randomized by the presets
    • The timezone dropdown's information architecture is changed in the UI making it dependent on the presets
  3. The presets will randomize upon page load
    • Every day: changes times
    • Every week: changes day and times
    • Every month: changes day and times
  4. Allowing for ranges to be defined in the cron syntax for hours only (borrowing from Jenkins)
    • Hours: H (0-23)
    • Potential to add others for bigger and smaller ranges (days of week and month, minutes)
  5. Upon loading the page, we generate one time for all options:
    • Page load
    • Generate Random Week day -> Wednesdays
    • Generate Random Date -> 4th
    • Generate Random Time -> 19h
    • User then has the choice between Custom, Every day at 19h, Every Wednesday at 19h , Every month, 4th at 19h
Mockup (Figma document)
Frame_2

Things to consider

Currently, the behavior is that picking "daily at 4 am" fills out the cron value for you, but leaves it visible and editable. This gives the user the easy opportunity to change it to 0 9 * * * if what they really want is to have the job run at 9 am every morning. By hiding it we lose that ability.

Permissions and Security

Documentation

Availability & Testing

What does success look like, and how can we measure that?

What is the type of buyer?

Is this a cross-stage feature?

Links / references

Edited by Dimitrie Hoekstra