You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _docs/pipelines/triggers/cron-triggers.md
+47-39Lines changed: 47 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,16 +16,16 @@ Cron triggers offer a way to run Codefresh pipelines based on a specific time sc
16
16
17
17
Integrate additional settings in the Cron trigger such as simulating a Git event to enrich pipelines with repository details, adding/customizing environment variables, and caching, volume reuse, and notification configurations for the build.
18
18
19
-
By integrating these additional options, Cron triggers can initiate pipeline executions at the predefined time intervals and at the same time populate the pipeline with repo and branch information from the Git trigger, required environment variables, and specialized behavior, for the build.
19
+
By integrating these additional options, Cron triggers can initiate pipeline executions at the predefined time intervals and at the same time populate the pipeline with repo and branch information from the Git trigger, required environment variables, and specialized behavior, for the build.
20
20
21
21
Create and manage Cron triggers for pipelines through[Codefresh UI](#cron-triggers-in-codefresh-ui), as described in this article.
22
22
For the specifications, see[Cron trigger specifications in pipelines]({{site.baseurl}}/docs/integrations/codefresh-api/#cron-triggers).
23
23
24
24
>**NOTE**
25
25
Cron triggers are created in the UTC timezone.
26
26
27
+
##Legacy Cron triggers in Codefresh
27
28
28
-
##Legacy Cron triggers in Codefresh
29
29
If you see Cron triggers for your pipeline tagged with {::nomarkdown}<img src="../../../../images/icons/icon-warning.png" display=inline-block">{:/} tag, it indicates that you are using the legacy version.
Codefresh migrates the legacy Cron trigger and displays a Trigger updated successfully message.
54
+
53
55
* Open the trigger displays the Settings tab with additional options.
54
56
55
57
{% include image.html
@@ -61,26 +63,27 @@ alt="Cron trigger after migration with Settings tab"
61
63
max-width="60%"
62
64
%}
63
65
64
-
65
66
##Cron triggers in Codefresh UI
66
67
67
68
Create and manage Cron triggers for pipelines in the Codefresh UI.
68
69
69
70
There are two parts to creating a Cron trigger in the UI:
71
+
70
72
1. Defining the schedule for the trigger
71
73
To learn about supported`cron` expression formats and aliases, see[Cron expression formats](#cron-expression-formats) in this article.
72
74
1. (Optional) Selecting additional options:
73
-
* Git trigger event to simulate when the Cron trigger timer is activated. The pipeline is populated with the information from the Git repo such as the repo URL, branch name, latest commit information, including the date and author of the commit.
74
-
* Variables to populate for the build
75
-
* Caching, volume reuse and notification behavior to override for the build
76
-
77
75
76
+
* Git trigger event to simulate when the Cron trigger timer is activated. The pipeline is populated with the information from the Git repo such as the repo URL, branch name, latest commit information, including the date and author of the commit.
77
+
* Variables to populate for the build
78
+
* Caching, volume reuse and notification behavior to override for the build
1. In the**Cron Interval** tab, configure the schedule for the Cron trigger:
105
109
1. Select the time interval and the frequency at which to run the pipeline.
106
110
1. Use the info in the Expression Breakdown table to create a valid Cron**Expression**, or write a custom expression.
@@ -116,10 +120,11 @@ max-width="60%"
116
120
%}
117
121
118
122
{:start="6"}
123
+
119
124
1. Click**Settings**.
120
125
1. Define the Git trigger simulation options:
121
126
1. From the**Simulate Trigger From** drop-down list, select the type of Git trigger to simulate.
122
-
The list displays all the Git triggers defined for the pipeline.
127
+
The list displays all the Git triggers defined for the pipeline.
123
128
1. From the**Select Branch** drop-down list, select the branch of the repository for this build.
124
129
1. Expand**Variables**, and add or modify[environment variables]({{site.baseurl}}/docs/pipelines/variables/) for this build.
125
130
1. Expand**Advanced Options** and select the overrides for this build. See[Advanced options]({{site.baseurl}}/docs/pipelines/triggers/git-triggers/#advanced-settings-for-git-triggers).
@@ -134,13 +139,14 @@ max-width="60%"
134
139
%}
135
140
136
141
{:start="7"}
137
-
1. To confirm click**Done**.
138
-
* If you defined only the Timer settings, the build is triggered according to the Cron expression.
139
-
* If you defined both the Timer and additional Settings, the build is triggered according to the Cron expression, and depending on the settings, the pipeline is populated with the information from the Git repo, additional variables, and notifications when configured.
140
142
143
+
1. To confirm click**Done**.
144
+
145
+
* If you defined only the Timer settings, the build is triggered according to the Cron expression.
146
+
* If you defined both the Timer and additional Settings, the build is triggered according to the Cron expression, and depending on the settings, the pipeline is populated with the information from the Git repo, additional variables, and notifications when configured.
141
147
142
148
{{site.data.callout.callout_tip}}
143
-
**TIP**
149
+
**TIP**
144
150
To edit a Cron trigger after creating it, click the Edit icon.
145
151
{{site.data.callout.end}}
146
152
@@ -149,9 +155,11 @@ To edit a Cron trigger after creating it, click the Edit icon.
149
155
A Cron expression represents a set of time fields through five space-separated fields. You can also use predefined schedules or fixed interval scheduling in place of Cron expressions.
150
156
151
157
###Cron expression fields
158
+
152
159
The table below describes the fields you can define in a Cron expression.
153
160
154
161
{: .table .table-bordered .table-hover}
162
+
155
163
Field | Mandatory | Allowed values | Allowed special characters
@@ -161,34 +169,34 @@ Day of month | Yes | 1-31 | * / , - ?|
161
169
Month | Yes | 1-12 or JAN-DEC | * / , -|
162
170
Day of week | Yes | 0-6 or SUN-SAT | * / , - ?|
163
171
164
-
165
172
###Special characters in Cron expressions
173
+
166
174
The table below describes the purpose of the special characters in a Cron expression.
167
175
168
176
{: .table .table-bordered .table-hover}
169
-
|Special Character| Description|
170
-
|----------| ----------|
177
+
178
+
|Special Character| Description|
179
+
|----------| ----------|
171
180
|**Asterisk** (`*`)| Indicates that the Cron expression will match for all values of the field.<br>Using an asterisk in the 5th field (month), would indicate every month.|
172
181
|**Slash** (`/`)| Slashes are used to describe increments of ranges. <br>For example`3-59/15` in the 1st field (minutes) would indicate the 3rd minute of the hour and every 15 minutes thereafter. <br>The form`*\/...` is equivalent to the form`first-last/...`, that is, an increment over the largest possible range of the field. <br>The form`N/...` is accepted as meaning`N-MAX/...`, that is, starting at`N`, use the increment until the end of that specific range. It does not wrap around.|
173
182
|**Comma** (`,`)| Commas are used to separate items of a list. For example, using`MON,WED,FRI` in the 5th field (day of week) would mean Mondays, Wednesdays and Fridays.|
174
183
|**Hyphen** (`-`)| Hyphens are used to define ranges. For example,`9-17` would indicate every hour between 9am and 5pm inclusive.|
175
184
|**Question mark** (`?`)| Question marks can be used instead of asterisks (`*`) for leaving either day-of-month or day-of-week blank.|
176
185
177
-
178
186
###Predefined scheduling for Cron jobs
179
187
180
188
You can use one of several predefined schedules instead of a Cron expression.
181
189
The table below describes the predefined schedules supported.
182
190
183
191
{: .table .table-bordered .table-hover}
192
+
184
193
|Predefined schedule| Description| Equivalent to|
185
194
|-----| -----------| -------------|
186
-
|@yearly (or@annually)| Run once a year, midnight, Jan. 1st| 0 0 0 1 1 *|
187
-
|@monthly| Run once a month, midnight, first of month| 0 0 0 1 * *|
188
-
|@weekly| Run once a week, midnight on Sunday| 0 0 0 * * 0|
189
-
|@daily (or@midnight)| Run once a day, midnight| 0 0 0 * * *|
190
-
|@hourly| Run once an hour, beginning of hour| 0 0 * * * *|
191
-
195
+
|@YEARLY (or@ANNUALLY)| Run once a year, midnight, Jan. 1st| 0 0 0 1 1 *|
196
+
|@MONTHLY| Run once a month, midnight, first of month| 0 0 0 1**|
197
+
|@WEEKLY| Run once a week, midnight on Sunday| 0 0 0** 0|
198
+
|@DAILY (or@MIDNIGHT)| Run once a day, midnight| 0 0 0** *|
199
+
|@HOURLY| Run once an hour, beginning of hour| 0 0****|
192
200
193
201
###Fixed interval scheduling for Cron jobs
194
202
@@ -200,49 +208,49 @@ For example, `@every 1h30m10s` would indicate a schedule that triggers every 1 h
200
208
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.
201
209
202
210
###Conditional triggers for Cron jobs
211
+
203
212
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/).
204
213
205
214
##Cron triggers with Codefresh CLI
206
215
207
216
>**NOTE**
208
-
This section is relevant only for legacy Cron triggers and will be deprecated.
217
+
This section is relevant only for legacy Cron triggers and will be deprecated.
209
218
210
219
You can also create and manage Cron triggers for pipelines via the[Codefresh CLI](https://cli.codefresh.io/){:target="\_blank"}.
211
220
212
-
213
-
214
221
###Create Cron trigger event via CLI
215
222
216
223
Create a new`cron` trigger by defining a Cron expression and message.
217
224
To learn about supported`cron` expression formats and aliases, see[Cron expression formats](#cron-expression-formats) in this article.
218
225
The text message is passed to linked pipelines, whenever the specified`cron` timer is triggered.