Scheduling Workflows
Testkube supports a cron-based scheduling mechanism that allows you to run your Test Workflows at desired intervals/times.
Scheduling a Workflow by updating the Workflow Definition
Schedules are defined in the Workflow YAML under a spec.events.cronjob
property - Read More.
The easiest way to schedule your Workflow is to modify the Workflow definition and add the corresponding
spec.events.cronjob
property, for example the below workflow will be scheduled to run on a daily basis at 3 am:
kind: TestWorkflow
apiVersion: testworkflows.testkube.io/v1
metadata:
name: distributed-k6-demo
namespace: testkube
spec:
events:
- cronjob:
cron: 0 3 * * *
...
Testkube's schedule data format is the same that is used to define Kubernetes Cron jobs, visit Wikipedia Cron format for details.
Schedule a Workflow from the Testkube Dashboard
You can also schedule a Test Workflow from the Testkube Dashboard under the Workflow Settings/Scheduling Panel:
This will add the corresponding YAML to the Workflow definition:
The Dashboard will only allow you to manage one schedule, if you want to define multiple schedules, you will have to do this directly in the Workflow Definition.
Scheduling Architecture
Testkube uses the scheduling engine from Kubernetes Cron jobs for scheduling your Workflow Executions. For each schedule, a special cron job is created from this template.
Technically, it is a callback to the Testkube API server method, launching the corresponding Workflow execution.
The call is executed using curl command from the image curlimages/curl
, please make sure it's available in your Kubernetes cluster.