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
* Update cron trigger with new git simulation feature
Updated help article with first draft of new content and screenshots
* Update pipeline specs with cron triggers
Added cron triggers args table to pipeline specifications
* Update cron triggers in pipeline specs
Added descriptions for all cron trigger params in pipeline specs
* Update codefresh-api.md
* Edit content for cron triggers
Content edits and updated nav entry to align with article title
* Replace cron settings screenshot
Added cron settings screenshot
* Update cron-triggers.md
* Update with feedback
* Add migrate desc for legacy triggers
* Update cron-triggers.md
* Update cron-triggers.md
Added note indicating beta version and xref to cron specs in Related Articles
* Update cron-triggers.md
Fixed xrefs to git triggers
* Update cron-triggers.md
Copy file name to clipboardExpand all lines: _docs/integrations/codefresh-api.md
+44-1Lines changed: 44 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -430,7 +430,7 @@ externalResources:
430
430
431
431
### Git triggers
432
432
433
-
The `triggers` field is an array of objects that hold [Git trigger information]({{site.baseurl}}/docs/pipelines/triggers/git-triggers/) with the following fields.
433
+
The `triggers` field is an array of objects that hold [Git trigger information]({{site.baseurl}}/docs/pipelines/triggers/git-triggers/).
434
434
435
435
{: .table .table-bordered .table-hover}
436
436
| Field name | Parent field | Type | Value |
@@ -517,6 +517,49 @@ triggers:
517
517
{% endraw %}
518
518
{% endhighlight %}
519
519
520
+
### Cron triggers
521
+
522
+
The `cronTriggers` field is an array of objects that hold [Cron trigger information]({{site.baseurl}}/docs/pipelines/triggers/cron-triggers/).
|`event`|`cronTriggers`| string | Leave empty. Automatically generated by Codefresh for internal use. |
528
+
|`name`|`cronTriggers`| string | The user-defined name for the Cron trigger. |
529
+
|`message`|`cronTriggers`| string |The free-text message to be sent as an additional event payload every time the Cron trigger is activated. For example, `Successful ingress tests`|
530
+
|`expression`|`cronTriggers`| string |The Cron expression that defines the time and frequency of the Cron trigger.<br>For example, `0 3 * * 1-5` triggers the pipeline at _3:00 AM every weekday (Monday to Friday)_. |
531
+
|`disabled `|`cronTriggers`| boolean | Determines if the Cron trigger is enabled for activation. <br>By default, set to `false` meaning that it is always enabled. <br>To disable the trigger, set to `true`. |
532
+
|`gitTriggerId`|`cronTriggers`| string | The ID of the Git trigger to simulate for the pipeline, retrieved from the pipeline for which it is defined.<br>To simulate a Git trigger, the pipeline must have at least one Git trigger defined for it.<br>See [Git triggers](#git-triggers) in this article. |
533
+
|`branch`|`cronTriggers`| string | Valid only when a Git trigger is simulated.<br> The branch of the repo retrieved from the Git trigger defined in `gitTriggerId`. |
534
+
|`variables`|`cronTriggers`| array | The environment variables to populate for the pipeline when the Cron trigger is activated. See [Variables in pipelines]({{site.baseurl}}/docs/pipelines/variables/). |
535
+
| `options` | `cronTriggers` | array | The behavior override options to implement for the current build. By default all overrides are set to `false`, meaning that the build inherits the default behavior set for the pipeline at the account level. <br>Can be any of the following:<br>{::nomarkdown}<ul><li><code class="highlighter-rouge">noCfCache</code>: When set to <code class="highlighter-rouge">true</code>, ignores Docker engine cache for build. See <a href="https://codefresh.io/docs/docs/kb/articles/disabling-codefresh-caching-mechanisms">Docker engine cache</a></li><li><code class="highlighter-rouge">noCache</code>: When set to <code class="highlighter-rouge">true</code>, ignores the last build's cache. Selecting this option may slow down your build.<br>See <a href="https://codefresh.io/docs/docs/kb/articles/disabling-codefresh-caching-mechanisms">Last build cache</a>.</li><li><code class="highlighter-rouge">resetVolume</code>: When set to <code class="highlighter-rouge">true</code>, resets the pipeline volume, useful for troubleshooting a build that hangs on the first step.<br> See <a href="https://codefresh.io/docs/docs/kb/articles/restoring-data-from-pre-existing-image-hangs-on/" target="_blank">Hangs on restoring data from pre-existing image</a>.</li><li><code class="highlighter-rouge">enableNotifications</code>: When set to <code class="highlighter-rouge">true</code>, sends email and Slack notifications, in addition to status updates to your Git provider.<br>See <a href="https://codefresh.io/docs/docs/integrations/notifications/slack-integration/" target="_blank">Slack notifications</a>.</li></ul>{:/}|
Cron triggers allow you to create pipelines that start on a specific time schedule. This is very useful for cleanup jobs or periodic checks or any other workflow that needs to run after a time interval.
14
13
15
-
>All times mentioned in Cron triggers use the UTC time zone.
16
14
17
-
## Manage Cron Triggers with Codefresh UI
15
+
Cron triggers offer a way to run Codefresh pipelines based on a specific time schedule. Cron triggers are particularly useful for tasks like regular maintenance, periodic checks, or any repetitive workflows.
18
16
19
-
It is possible to define and manage Cron-based pipeline triggers with Codefresh UI.
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.
20
18
21
-
### Create a new Cron Trigger
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.
22
20
23
-
To add a new Cron trigger, navigate to Codefresh Pipeline *Configuration* view and expand *Triggers* section. Press the `Add Trigger` button and select a `Cron` trigger type to add.
21
+
Create and manage Cron triggers for pipelines through [Codefresh UI](#cron-triggers-in-codefresh-ui), as described in this article.
22
+
For the specifications, see [Cron trigger specifications in pipelines]({{site.baseurl}}/docs/integrations/codefresh-api/#cron-triggers).
23
+
24
+
>**NOTE**:
25
+
Cron triggers are created in the UTC timezone.
26
+
27
+
28
+
## Legacy Cron triggers in Codefresh
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.
caption="Cron trigger after migration with Settings tab"
60
+
alt="Cron trigger after migration with Settings tab"
30
61
max-width="60%"
31
62
%}
32
63
33
64
34
-
Visit [this page](https://github.com/codefresh-io/cronus/blob/master/docs/expression.md){:target="\_blank"} to learn about supported `cron` expression format and aliases.
65
+
## Cron triggers in Codefresh UI
66
+
67
+
Create and manage Cron triggers for pipelines in the Codefresh UI.
68
+
69
+
There are two parts to creating a Cron trigger in the UI:
70
+
1. Defining the schedule for the trigger
71
+
To learn about supported `cron` expression formats and aliases, visit [this page](https://github.com/codefresh-io/cronus/blob/master/docs/expression.md){:target="\_blank"}.
72
+
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 resuse and notification behavior to override for the build
76
+
77
+
>**NOTE**: Settings for Cron triggers is currently in Beta.
Now, `cron` will trigger a recurrent pipeline execution based on the defined `cron expression`.
118
+
{:start="6"}
119
+
1. Click **Settings**.
120
+
1. Define the Git trigger simulation options:
121
+
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.
123
+
1. From the **Select Branch** drop-down list, select the branch of the repository for this build.
124
+
1. Expand **Variables**, and add or modify [environment variables]({{site.baseurl}}/docs/pipelines/variables/) for this build.
125
+
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).
caption="Cron trigger: Additional settings for Git event, variables, and build behavior"
132
+
alt="Cron trigger: Cron trigger: Additional settings for Git event, variables, and build behavior"
133
+
max-width="60%"
134
+
%}
135
+
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
+
141
+
142
+
>**TIP**:
143
+
To edit a Cron trigger after creating it, click the Edit icon.
54
144
55
-
## Manage Cron Triggers with Codefresh CLI
56
145
57
-
It is also possible to use the Codefresh Command Line client (`CLI`) to manage Cron based pipeline triggers.
146
+
## Cron triggers with Codefresh CLI
58
147
59
-
### Cron trigger
148
+
>**NOTE**:
149
+
This section is relevant only for legacy Cron triggers and will be deprecated.
60
150
61
-
It is possible to trigger a Codefresh CD pipeline(s) periodically, using `cron` expression.
151
+
You can also create and manage Cron triggers for pipelines via the [Codefresh CLI](https://cli.codefresh.io/){:target="\_blank"}.
62
152
63
-
You can use [Codefresh CLI](https://cli.codefresh.io/){:target="\_blank"} to set up a Codefresh `cron` trigger.
64
153
65
-
#### Create Cron trigger-event
66
154
67
-
First, you need to create a new `cron``trigger-event` to define a recurrent event.
155
+
### Create Cron triggerevent via CLI
68
156
69
-
```sh
70
-
# create DockerHub recurrent event 'once in 20 minutes'
157
+
Create a new `cron` trigger by defining a Cron expression and message.
158
+
To learn about supported `cron` expression formats and aliases, visit [this page](https://github.com/codefresh-io/cronus/blob/master/docs/expression.md){:target="\_blank"}.
159
+
The text message is passed to linked pipelines, whenever the specified `cron` timer is triggered.
When creating a `cron trigger-event`, it is possible to specify a short text message, that will be passed to linked pipelines, every time the specified `cron` timer is triggered.
78
173
79
-
Visit [this page](https://github.com/codefresh-io/cronus/blob/master/docs/expression.md){:target="\_blank"} to learn about the supported `cron` expression format and aliases.
80
174
81
-
####Set up pipeline trigger
175
+
### Set up pipeline trigger
82
176
83
177
Now, lets create a new pipeline trigger, linking previously defined `cron``trigger-event` to one or more Codefresh pipelines.
84
178
85
-
```
179
+
180
+
{% highlight yaml %}
181
+
{% raw %}
86
182
# create trigger, linking trigger-event UID to the pipeline UID
From now on, every 20 minutes Codefresh will trigger a pipeline execution for 2 pipelines linked to the previously specified `cron``trigger-event` (once in 20 minutes)
190
+
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`).
94
191
95
-
####Cron Event payload
192
+
## Cron event payload
96
193
97
-
The following variables will be available for any Codefresh pipeline linked to a `cron``trigger-event`:
194
+
The following variables are available to any Codefresh pipeline linked to a Cron triggerevent:
98
195
99
-
-`EVENT_MESSAGE` - free text message (specified during creation)
100
-
-`EVENT_TIMESTAMP` - event timestamp in RFC 3339 format
196
+
-`EVENT_MESSAGE`: Free-text message (specified during creation)
197
+
-`EVENT_TIMESTAMP`: Event timestamp in RFC 3339 format
101
198
102
199
## Related articles
103
200
[Triggers in pipelines]({{site.baseurl}}/docs/pipelines/triggers)
0 commit comments