Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita752b4f

Browse files
Update Cron Trigger for Predefined Schedules (#1065)
* upper case predefined schedule* Update cron-triggers.mdFormatting edits* Update cron-triggers.md---------Co-authored-by: NimRegev <nima.regev@codefresh.io>
1 parent83bc2b2 commita752b4f

File tree

1 file changed

+58
-57
lines changed

1 file changed

+58
-57
lines changed

‎_docs/pipelines/triggers/cron-triggers.md‎

Lines changed: 58 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ Cron triggers offer a way to run Codefresh pipelines based on a specific time sc
1616

1717
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.
1818

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.
2020

2121
Create and manage Cron triggers for pipelines through[Codefresh UI](#cron-triggers-in-codefresh-ui), as described in this article.
2222
For the specifications, see[Cron trigger specifications in pipelines]({{site.baseurl}}/docs/integrations/codefresh-api/#cron-triggers).
2323

2424
>**NOTE**
2525
Cron triggers are created in the UTC timezone.
2626

27+
##Legacy Cron triggers in Codefresh
2728

28-
##Legacy Cron triggers in Codefresh
2929
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.
3030

3131
{% include image.html
@@ -37,9 +37,11 @@ alt="Legacy Cron trigger in Codefresh UI"
3737
max-width="60%"
3838
%}
3939

40-
**Migrate legacy trigger**
41-
* Click the**Edit** icon to view the trigger.
42-
* To migrate, click**Convert**.
40+
#####Migrate legacy Cron triggers
41+
42+
1. Click the**Edit** icon to view the trigger.
43+
1. To migrate, click**Convert**.
44+
Codefresh migrates the legacy Cron trigger and displays a`Trigger updated successfully` message.
4345

4446
{% include image.html
4547
lightbox="true"
@@ -49,8 +51,9 @@ caption="Migrate legacy Cron trigger in Codefresh UI"
4951
alt="Migrate legacy Cron trigger in Codefresh UI"
5052
max-width="60%"
5153
%}
52-
Codefresh migrates the legacy Cron trigger and displays a Trigger updated successfully message.
53-
* Open the trigger displays the Settings tab with additional options.
54+
55+
{:start="3"}
56+
1. Open the trigger displays the Settings tab with additional options.
5457

5558
{% include image.html
5659
lightbox="true"
@@ -61,30 +64,30 @@ alt="Cron trigger after migration with Settings tab"
6164
max-width="60%"
6265
%}
6366

64-
6567
##Cron triggers in Codefresh UI
6668

6769
Create and manage Cron triggers for pipelines in the Codefresh UI.
6870

6971
There are two parts to creating a Cron trigger in the UI:
72+
7073
1. Defining the schedule for the trigger
7174
To learn about supported`cron` expression formats and aliases, see[Cron expression formats](#cron-expression-formats) in this article.
7275
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
7676

77+
* 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.
78+
* Variables to populate for the build.
79+
* Caching, volume reuse and notification behavior to override for the build.
7780

81+
##Create a Cron trigger in UI
7882

79-
##How to: Create a Cron trigger in UI
80-
**Before you begin**
83+
#####Before you begin
8184

8285
Review:
83-
*[Git trigger settings]({{site.baseurl}}/docs/pipelines/triggers/git-triggers/#git-trigger-settings)
86+
*[Git trigger settings]({{site.baseurl}}/docs/pipelines/triggers/git-triggers/#git-trigger-settings)
8487
*[Working with Git triggers]({{site.baseurl}}/docs/pipelines/triggers/git-triggers/#working-with-git-triggers)
8588
*[Cron expression formats](#cron-expression-formats)
8689

87-
**How to**
90+
#####How to
8891

8992
1. In the Codefresh UI, from the sidebar, select**Pipelines**.
9093
1. Select the pipeline to which to add the trigger, and then click the**Workflow** tab.
@@ -97,7 +100,7 @@ file="/images/pipeline/triggers/add-trigger-dialog.png"
97100
url="/images/pipeline/triggers/add-trigger-dialog.png"
98101
caption="Select trigger type to add"
99102
alt="Select trigger type to add"
100-
max-width="60%"
103+
max-width="50%"
101104
%}
102105

103106
{:start="5"}
@@ -112,14 +115,14 @@ file="/images/pipeline/triggers/cron/cron-timer-tab.png"
112115
url="/images/pipeline/triggers/cron/cron-timer-tab.png"
113116
caption="Cron trigger: Cron Interval settings"
114117
alt="Cron trigger: Cron Interval settings"
115-
max-width="60%"
118+
max-width="50%"
116119
%}
117120

118121
{:start="6"}
119122
1. Click**Settings**.
120123
1. Define the Git trigger simulation options:
121124
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.
125+
The list displays all the Git triggers defined for the pipeline.
123126
1. From the**Select Branch** drop-down list, select the branch of the repository for this build.
124127
1. Expand**Variables**, and add or modify[environment variables]({{site.baseurl}}/docs/pipelines/variables/) for this build.
125128
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).
@@ -133,14 +136,13 @@ alt="Cron trigger: Cron trigger: Additional settings for Git event, variables, a
133136
max-width="60%"
134137
%}
135138

136-
{: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-
139+
{:start="10"}
140+
1. To confirm click**Done**.
141+
* If you defined only the Timer settings, the build is triggered according to the Cron expression.
142+
* 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.
141143

142144
{{site.data.callout.callout_tip}}
143-
**TIP**
145+
**TIP**
144146
To edit a Cron trigger after creating it, click the Edit icon.
145147
{{site.data.callout.end}}
146148

@@ -149,6 +151,7 @@ To edit a Cron trigger after creating it, click the Edit icon.
149151
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.
150152

151153
###Cron expression fields
154+
152155
The table below describes the fields you can define in a Cron expression.
153156

154157
{: .table .table-bordered .table-hover}
@@ -161,88 +164,86 @@ Day of month | Yes | 1-31 | * / , - ?|
161164
Month | Yes | 1-12 or JAN-DEC | * / , -|
162165
Day of week | Yes | 0-6 or SUN-SAT | * / , - ?|
163166

164-
165167
###Special characters in Cron expressions
168+
166169
The table below describes the purpose of the special characters in a Cron expression.
167170

168171
{: .table .table-bordered .table-hover}
169-
|Special Character| Description|
170-
|----------| ----------|
171-
|**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-
|**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-
|**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-
|**Hyphen** (`-`)| Hyphens are used to define ranges. For example,`9-17` would indicate every hour between 9am and 5pm inclusive.|
175-
|**Question mark** (`?`)| Question marks can be used instead of asterisks (`*`) for leaving either day-of-month or day-of-week blank.|
176172

173+
|Special Character| Description|
174+
|----------| ----------|
175+
|**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.|
176+
|**Slash** (`/`)| Slashes 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.|
177+
|**Comma** (`,`)| Commas separate items in a list. For example, using`MON,WED,FRI` in the 5th field (day of week) would mean Mondays, Wednesdays, and Fridays.|
178+
|**Hyphen** (`-`)| Hyphens define ranges. For example,`9-17` would indicate every hour between 9am and 5pm inclusive.|
179+
|**Question mark** (`?`)| Question marks are instead of asterisks (`*`) to leave either day-of-month or day-of-week blank.|
177180

178181
###Predefined scheduling for Cron jobs
179182

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

183186
{: .table .table-bordered .table-hover}
184-
|Predefined schedule| Description| Equivalent to|
187+
|Predefined schedule| Description| Equivalent to|
185188
|-----| -----------| -------------|
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-
189+
|@YEARLY (or@ANNUALLY)| Run once a year, midnight, Jan. 1st| 0 0 0 1 1 *|
190+
|@MONTHLY| Run once a month, midnight, first of month| 0 0 0 1**|
191+
|@WEEKLY| Run once a week, midnight on Sunday| 0 0 0** 0|
192+
|@DAILY (or@MIDNIGHT)| Run once a day, midnight| 0 0 0** *|
193+
|@HOURLY| Run once an hour, beginning of hour| 0 0****|
192194

193195
###Fixed interval scheduling for Cron jobs
194196

195-
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.
196-
197+
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.
197198
For example,`@every 1h30m10s` would indicate a schedule that triggers every 1 hour, 30 minutes, 10 seconds.
198199

199200
>**NOTE**
200201
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.
201202

202203
###Conditional triggers for Cron jobs
204+
203205
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/).
204206

205207
##Cron triggers with Codefresh CLI
206208

207209
>**NOTE**
208-
This section is relevant only for legacy Cron triggers and will be deprecated.
210+
This section is relevant only for legacy Cron triggers and will be deprecated.
209211

210212
You can also create and manage Cron triggers for pipelines via the[Codefresh CLI](https://cli.codefresh.io/){:target="\_blank"}.
211213

212-
213-
214214
###Create Cron trigger event via CLI
215215

216216
Create a new`cron` trigger by defining a Cron expression and message.
217217
To learn about supported`cron` expression formats and aliases, see[Cron expression formats](#cron-expression-formats) in this article.
218218
The text message is passed to linked pipelines, whenever the specified`cron` timer is triggered.
219219

220-
221-
222220
{% highlight yaml %}
223221
{% raw %}
222+
224223
#create recurring event 'once in 20 minutes'
225-
codefresh create trigger-event --type cron --kind codefresh --value expression="0*/20 * * **" --value message="hello-once-in-20-min"
224+
225+
codefresh create trigger-event --type cron --kind codefresh --value expression="0*/20****" --value message="hello-once-in-20-min"
226226

227227
#on success trigger-event UID will be printed out
228-
Trigger event: "cron:codefresh:codefresh:0*/20 * * **:hello-once-in-20-min:107e9db97062" was successfully created.
228+
229+
Trigger event: "cron:codefresh:codefresh:0*/20****:hello-once-in-20-min:107e9db97062" was successfully created.
229230
{% endraw %}
230231
{% endhighlight %}
231232

232-
233-
234233
###Set up pipeline trigger
235234

236-
Now, lets create a new pipeline trigger, linking previously defined`cron``trigger-event` to one or more Codefresh pipelines.
237-
235+
Now, let's create a new pipeline trigger, linking previously defined`cron``trigger-event` to one or more Codefresh pipelines.
238236

239237
{% highlight yaml %}
240238
{% raw %}
239+
241240
#create trigger, linking trigger-event UID to the pipeline UID
242-
codefresh create trigger "cron:codefresh:codefresh:0*/20 * * **:hello-once-in-20-min:107e9db97062" 7a5622e4b1ad5ba0018a3c9c
241+
242+
codefresh create trigger "cron:codefresh:codefresh:0*/20****:hello-once-in-20-min:107e9db97062" 7a5622e4b1ad5ba0018a3c9c
243243

244244
#create another trigger, linking the same trigger-event to another pipeline
245-
codefresh create trigger "cron:codefresh:codefresh:0*/20 * * **:hello-once-in-20-min:107e9db97062" 4a5634e4b2cd6baf021a3c0a
245+
246+
codefresh create trigger "cron:codefresh:codefresh:0*/20****:hello-once-in-20-min:107e9db97062" 4a5634e4b2cd6baf021a3c0a
246247
{% endraw %}
247248
{% endhighlight %}
248249

@@ -252,12 +253,12 @@ From now on, Codefresh will trigger a pipeline execution for two pipelines linke
252253

253254
The following variables are available to any Codefresh pipeline linked to a Cron trigger event:
254255

255-
-`EVENT_MESSAGE`: Free-text message (specified during creation)
256-
-`EVENT_TIMESTAMP`: Event timestamp in RFC 3339 format
256+
*`EVENT_MESSAGE`: Free-text message (specified during creation)
257+
*`EVENT_TIMESTAMP`: Event timestamp in RFC 3339 format
257258

258259
##Related articles
260+
259261
[Triggers in pipelines]({{site.baseurl}}/docs/pipelines/triggers/)
260262
[Cron trigger specifications]({{site.baseurl}}/docs/integrations/codefresh-api/#cron-triggers/)
261263
[Variables in pipelines]({{site.baseurl}}/docs/pipelines/variables/)
262264
[Creating pipelines]({{site.baseurl}}/docs/pipelines/pipelines/)
263-

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp