Skip to content

Improve 'Cron (timer) triggers' page #1319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 22 additions & 23 deletions _docs/pipelines/triggers/cron-triggers.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ The table below describes the fields you can define in a Cron expression.
{: .table .table-bordered .table-hover}
Field | Mandatory | Allowed values | Allowed special characters
|---------- | ---------- | -------------- | --------------------------|
Seconds | No | 0-59 | * / , -|
Minutes | Yes | 0-59 | * / , -|
Hours | Yes | 0-23 | * / , -|
Day of month | Yes | 1-31 | * / , - ?|
Expand All @@ -178,28 +177,6 @@ The table below describes the purpose of the special characters in a Cron expres
|**Hyphen** (`-`) | Hyphens define ranges. For example, `9-17` would indicate every hour between 9am and 5pm inclusive.|
|**Question mark** (`?`) | Question marks are instead of asterisks (`*`) to leave either day-of-month or day-of-week blank.|

### Predefined scheduling for Cron jobs

You can use one of several predefined schedules instead of a Cron expression.
The table below describes the predefined schedules supported.

{: .table .table-bordered .table-hover}
|Predefined schedule | Description | Equivalent to|
|----- | ----------- | -------------|
|@YEARLY (or @ANNUALLY) | Run once a year, midnight, Jan. 1st | 0 0 0 1 1 *|
|@MONTHLY | Run once a month, midnight, first of month | 0 0 0 1 **|
|@WEEKLY | Run once a week, midnight on Sunday | 0 0 0 ** 0|
|@DAILY (or @MIDNIGHT) | Run once a day, midnight | 0 0 0 ** *|
|@HOURLY | Run once an hour, beginning of hour | 0 0 ** **|

### Fixed interval scheduling for Cron jobs

You can also schedule a job to execute at fixed intervals by adding `@every <interval>`. The <interval> is a string that represents the desired frequency.
For example, `@every 1h30m10s` would indicate a schedule that triggers every 1 hour, 30 minutes, 10 seconds.

>**NOTE**
The interval does not take the runtime of the job into account. For example, if a job takes three minutes to run, and it is scheduled to run every five minutes, it will have only two minutes of idle time between each run.

### Conditional triggers for Cron jobs

Take a look at our Knowledge Base how-to: [Skip pipeline step if triggered by Cron job]({{site.baseurl}}/docs/kb/articles/skip-test-if-pipeline-is-triggered-with-cron/).
Expand Down Expand Up @@ -249,6 +226,28 @@ codefresh create trigger "cron:codefresh:codefresh:0 */20* ** *:hello-once-in-20

From now on, Codefresh will trigger a pipeline execution for two pipelines linked to the previously specified `cron` `trigger-event`, every 20 minutes (`once in 20 minutes`).

### Predefined scheduling for Cron jobs

You can use one of several predefined schedules instead of a Cron expression.
The table below describes the predefined schedules supported.

{: .table .table-bordered .table-hover}
|Predefined schedule | Description | Equivalent to|
|----- | ----------- | -------------|
|@YEARLY (or @ANNUALLY) | Run once a year, midnight, Jan. 1st | 0 0 0 1 1 *|
|@MONTHLY | Run once a month, midnight, first of month | 0 0 0 1 **|
|@WEEKLY | Run once a week, midnight on Sunday | 0 0 0 ** 0|
|@DAILY (or @MIDNIGHT) | Run once a day, midnight | 0 0 0 ** *|
|@HOURLY | Run once an hour, beginning of hour | 0 0 ** **|

### Fixed interval scheduling for Cron jobs

You can also schedule a job to execute at fixed intervals by adding `@every <interval>`. The <interval> is a string that represents the desired frequency.
For example, `@every 1h30m10s` would indicate a schedule that triggers every 1 hour, 30 minutes, 10 seconds.

>**NOTE**
The interval does not take the runtime of the job into account. For example, if a job takes three minutes to run, and it is scheduled to run every five minutes, it will have only two minutes of idle time between each run.

## Cron event payload

The following variables are available to any Codefresh pipeline linked to a Cron trigger event:
Expand Down
Binary file modified images/pipeline/triggers/cron/cron-timer-tab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.