You are viewing the docs for v1.3, which is not the latest release.
View latest

Migrate from scheduleConditions to conditions for Schedule Triggers

For the complete documentation index, see llms.txt. For a full content snapshot, see llms-full.txt. Append .md to any kestra.io/docs/* URL for plain Markdown.

Schedule Conditions: scheduleConditions deprecated for conditions

The scheduleConditions property of Schedule trigger is deprecated. Instead, use conditions to define custom scheduling conditions.

This change is non-breaking, so existing flows do not need to be changed immediately to migrate to 0.15.0. Use the conditions property for new flows. The scheduleConditions property will be removed in the future.

To make the change clear, here is how scheduling conditions were defined before Kestra 0.15.0:

yamlid: beverage_order
namespace: company.team

inputs:
  - id: beverage
    type: STRING
    defaults: coffee

tasks:
  - id: order_beverage
    type: io.kestra.plugin.core.http.Request
    uri: https://kestra.io/api/mock
    method: POST
    contentType: application/json
    formData:
      beverage: "{{inputs.beverage}}"

  - id: set_labels
    type: io.kestra.plugin.core.execution.Labels
    labels:
      date: "{{trigger.date ?? execution.startDate | date('yyyy-MM-dd')}}"
      beverage: "{{inputs.beverage}}"

triggers:
  - id: workday
    type: io.kestra.plugin.core.trigger.Schedule
    cron: "0 9 * * *"
    conditions:
      - type: io.kestra.plugin.core.condition.Not
        conditions:
          - type: io.kestra.plugin.core.condition.Weekend
  - id: weekend
    type: io.kestra.plugin.core.trigger.Schedule
    cron: "0 20 * * *"
    conditions:
      - type: io.kestra.plugin.core.condition.Weekend
    inputs:
      beverage: beer

The above flow has two triggers, workday and weekend.

  1. The workday trigger is scheduled to run on workdays to order a coffee at 9 am.
  2. The weekend trigger is scheduled to run on weekends to order a beer at 8 pm.

Behavior after Kestra 0.15.0

Here is the same flow with the scheduleConditions property replaced by conditions:

yamlid: beverage_order
namespace: company.team

inputs:
  - id: beverage
    type: STRING
    defaults: coffee

tasks:
  - id: order_beverage
    type: io.kestra.plugin.core.http.Request
    uri: https://kestra.io/api/mock
    method: POST
    contentType: application/json
    formData:
      beverage: "{{inputs.beverage}}"

  - id: set_labels
    type: io.kestra.plugin.core.execution.Labels
    labels:
      date: "{{trigger.date ?? execution.startDate | date('yyyy-MM-dd')}}"
      beverage: "{{inputs.beverage}}"

triggers:
  - id: workday
    type: io.kestra.plugin.core.trigger.Schedule
    cron: "0 9 * * *"
    conditions:
      - type: io.kestra.plugin.core.condition.Not
        conditions:
          - type: io.kestra.plugin.core.condition.Weekend

  - id: weekend
    type: io.kestra.plugin.core.trigger.Schedule
    cron: "0 20 * * *"
    conditions:
      - type: io.kestra.plugin.core.condition.Weekend
    inputs:
      beverage: beer