Add cron job specification to a serverless function
Description
One common use-cases for a function is when someone needs to run some code periodically. Typically we accomplish that by specifying a cron job that triggers code. In GitLab you can configure a scheduled pipeline, and define a cron job specification in the UI.
Being able to define a serverless function being automatically invoked periodically might help too. See one of the use-cases https://gitlab.slack.com/archives/C0SFP840G/p1556582874239800 (GitLab internal).
Proposal
Use CronJobSource
in Knative, deploy it using
functions:
echo:
handler: MyEcho.my_function
source: echo-rb/
runtime: https://gitlab.com/gitlab-org/serverless/runtimes/ruby
description: "echo function using Ruby runtime"
trigger:
- every_10_minutes
events:
every_10_minutes:
cron: */10 * * * *