- Notifications
You must be signed in to change notification settings - Fork165
Q3 s3 cron triggers#790
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
c4a8935f35a838fc0b83f298f06468c165b89031cedead947caec0b611454164e02435a9249b93301dec7a4107dFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -430,7 +430,7 @@ externalResources: | ||
| ### Git triggers | ||
| The `triggers` field is an array of objects that hold [Git trigger information]({{site.baseurl}}/docs/pipelines/triggers/git-triggers/). | ||
| {: .table .table-bordered .table-hover} | ||
| | Field name | Parent field | Type | Value | | ||
| @@ -517,6 +517,49 @@ triggers: | ||
| {% endraw %} | ||
| {% endhighlight %} | ||
| ### Cron triggers | ||
| The `cronTriggers` field is an array of objects that hold [Cron trigger information]({{site.baseurl}}/docs/pipelines/triggers/cron-triggers/). | ||
| {: .table .table-bordered .table-hover} | ||
| | Field name | Parent field | Type | Value | | ||
| | -------------- | ---------------------------- |-------------------------| -------------------------| | ||
| | `event` | `cronTriggers` | string | Leave empty. Automatically generated by Codefresh for internal use. | | ||
| | `name` | `cronTriggers` | string | The user-defined name for the Cron trigger. | | ||
| | `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` | | ||
| | `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)_. | | ||
| | `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`. | | ||
| | `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. | | ||
| | `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`. | | ||
| | `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/). | | ||
| | `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>{:/}| | ||
| `Pipeline Spec example for Cron triggers` | ||
| {% highlight yaml %} | ||
| {% raw %} | ||
| ... | ||
| cronTriggers: | ||
| - name: SSO sync | ||
| type: cron, | ||
| message: "Sync successfull" | ||
| expression: "0 0/1 * 1/1 * *" | ||
| gitTriggerId: 64905de8589da959de81d31d | ||
| branch: main | ||
| variables: [] | ||
| options: | ||
| noCfCache: false | ||
| noCache: false | ||
| resetVolume: false | ||
| enableNotifications: true | ||
| disabled: true | ||
| event: cron:codefresh:0 0/1 * 1/1 * *:tests:ecef63b9ed20 | ||
| verified: true | ||
| status: verified | ||
NimRegev marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| id: 64ddd8b04fdbcc74cc74fe80 | ||
| ... | ||
| {% endraw %} | ||
| {% endhighlight %} | ||
| ## Using Codefresh from within Codefresh | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| --- | ||
| title: "Cron (timer) triggers" | ||
| description: "Run pipelineson a time schedule" | ||
| group: pipelines | ||
| sub_group: triggers | ||
| redirect_from: | ||
| @@ -10,96 +10,195 @@ redirect_from: | ||
| toc: true | ||
| --- | ||
| Cron triggers offer a way to runCodefreshpipelines based on a specific time schedule. Cron triggers are particularly useful for tasks like regular maintenance, periodic checks, or any repetitive workflows. | ||
| Integrate additional settings in the Cron trigger such as simulating a Git eventtoenrich pipelines with repository details, adding/customizing environment variables,andcaching, volume reuse, and notification configurations for the build. | ||
| By integrating these additional options,Crontriggers 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. | ||
| Create and manage Cron triggers for pipelines through [Codefresh UI](#cron-triggers-in-codefresh-ui), as described in this article. | ||
| For the specifications, see [Cron trigger specifications in pipelines]({{site.baseurl}}/docs/integrations/codefresh-api/#cron-triggers). | ||
| >**NOTE**: | ||
| Cron triggers are created in the UTC timezone. | ||
| ## Legacy Cron triggers in Codefresh | ||
| 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. | ||
| {% include image.html | ||
| lightbox="true" | ||
| file="/images/pipeline/triggers/cron/legacy-cron-trigger-tag.png" | ||
| url="/images/pipeline/triggers/cron/legacy-cron-trigger-tag.png" | ||
| caption="Legacy Cron trigger in Codefresh UI" | ||
| alt="Legacy Cron trigger in Codefresh UI" | ||
| max-width="60%" | ||
| %} | ||
| **Migrate legacy trigger** | ||
| * Click the **Edit** icon to view the trigger. | ||
| * To migrate, click **Convert**. | ||
| {% include image.html | ||
| lightbox="true" | ||
| file="/images/pipeline/triggers/cron/legacy-cron-convert.png" | ||
| url="/images/pipeline/triggers/cron/legacy-cron-convert.png" | ||
| caption="Migrate legacy Cron trigger in Codefresh UI" | ||
| alt="Migrate legacy Cron trigger in Codefresh UI" | ||
| max-width="60%" | ||
| %} | ||
| Codefresh migrates the legacy Cron trigger and displays a Trigger updated successfully message. | ||
| * Open the trigger displays the Settings tab with additional options. | ||
| {% include image.html | ||
| lightbox="true" | ||
| file="/images/pipeline/triggers/cron/legacy-cron-after-convert.png" | ||
| url="/images/pipeline/triggers/cron/legacy-cron-after-convert.png" | ||
| caption="Cron trigger after migration with Settings tab" | ||
| alt="Cron trigger after migration with Settings tab" | ||
| max-width="60%" | ||
| %} | ||
| ## Cron triggers in Codefresh UI | ||
| Create and manage Cron triggers for pipelines in the Codefresh UI. | ||
| There are two parts to creating a Cron trigger in the UI: | ||
| 1. Defining the schedule for the trigger | ||
| 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"}. | ||
| 1. (Optional) Selecting additional options: | ||
| * 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. | ||
| * Variables to populate for the build | ||
| * Caching, volume resuse and notification behavior to override for the build | ||
| >**NOTE**: Settings for Cron triggers is currently in Beta. | ||
| ## How to: Create a Cron trigger in UI | ||
| **Before you begin** | ||
| Review: | ||
| * [Git trigger settings]({{site.baseurl}}/docs/pipelines/triggers/git-triggers/#git-trigger-settings) | ||
| * [Working with Git triggers]({{site.baseurl}}/docs/pipelines/triggers/git-triggers/#working-with-git-triggers) | ||
| **How to** | ||
| 1. In the Codefresh UI, from the sidebar, select **Pipelines**. | ||
| 1. Select the pipeline to which to add the trigger, and then click the **Workflow** tab. | ||
| 1. On the right, click **Triggers**, and then click **Add Trigger**. | ||
| 1. Click **Cron**, click **Next**. | ||
| {% include image.html | ||
| lightbox="true" | ||
| file="/images/pipeline/triggers/add-trigger-dialog.png" | ||
| url="/images/pipeline/triggers/add-trigger-dialog.png" | ||
| caption="Select trigger type to add" | ||
| alt="Select trigger type to add" | ||
| max-width="60%" | ||
| %} | ||
| {:start="5"} | ||
| 1. In the **Cron Interval** tab, configure the schedule for the Cron trigger: | ||
| 1. Select the time interval and the frequency at which to run the pipeline. | ||
| 1. Use the info in the Expression Breakdown table to create a valid Cron **Expression**, or write a custom expression. | ||
| 1. Add a free-text message to be sent as an additional event payload every time the Cron is executed. | ||
| {% include image.html | ||
| lightbox="true" | ||
| file="/images/pipeline/triggers/cron/cron-timer-tab.png" | ||
| url="/images/pipeline/triggers/cron/cron-timer-tab.png" | ||
| caption="Cron trigger: Cron Interval settings" | ||
| alt="Cron trigger: Cron Interval settings" | ||
| max-width="60%" | ||
| %} | ||
| {:start="6"} | ||
| 1. Click **Settings**. | ||
| 1. Define the Git trigger simulation options: | ||
| 1. From the **Simulate Trigger From** drop-down list, select the type of Git trigger to simulate. | ||
| The list displays all the Git triggers defined for the pipeline. | ||
| 1. From the **Select Branch** drop-down list, select the branch of the repository for this build. | ||
| 1. Expand **Variables**, and add or modify [environment variables]({{site.baseurl}}/docs/pipelines/variables/) for this build. | ||
| 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). | ||
| {% include image.html | ||
| lightbox="true" | ||
| file="/images/pipeline/triggers/cron/cron-settings-tab.png" | ||
| url="/images/pipeline/triggers/cron/cron-settings-tab.png" | ||
| caption="Cron trigger: Additional settings for Git event, variables, and build behavior" | ||
| alt="Cron trigger: Cron trigger: Additional settings for Git event, variables, and build behavior" | ||
| max-width="60%" | ||
| %} | ||
| {:start="7"} | ||
| 1. To confirm click **Done**. | ||
| * If you defined only the Timer settings, the build is triggered according to the Cron expression. | ||
| * 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. | ||
| >**TIP**: | ||
| To edit a Cron trigger after creating it, click the Edit icon. | ||
| ## Cron triggers withCodefresh CLI | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. this should be also under | ||
| >**NOTE**: | ||
| This section is relevant only for legacy Cron triggers and will be deprecated. | ||
| You can also create and manage Cron triggers for pipelines via the [Codefresh CLI](https://cli.codefresh.io/){:target="\_blank"}. | ||
| ### Create Crontriggerevent via CLI | ||
NimRegev marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| Create a new `cron` trigger by defining a Cron expression and message. | ||
| 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"}. | ||
| The text message is passed to linked pipelines, whenever the specified `cron` timer is triggered. | ||
| {% highlight yaml %} | ||
| {% raw %} | ||
| # create recurring event 'once in 20 minutes' | ||
| codefresh create trigger-event --type cron --kind codefresh --value expression="0 */20 * * * *" --value message="hello-once-in-20-min" | ||
| # on success trigger-event UID will be printed out | ||
| Trigger event: "cron:codefresh:codefresh:0 */20 * * * *:hello-once-in-20-min:107e9db97062" was successfully created. | ||
| {% endraw %} | ||
| {% endhighlight %} | ||
| ### Set up pipeline trigger | ||
Member
| ||
| Now, lets create a new pipeline trigger, linking previously defined `cron` `trigger-event` to one or more Codefresh pipelines. | ||
| {% highlight yaml %} | ||
| {% raw %} | ||
| # create trigger, linking trigger-event UID to the pipeline UID | ||
| codefresh create trigger "cron:codefresh:codefresh:0 */20 * * * *:hello-once-in-20-min:107e9db97062" 7a5622e4b1ad5ba0018a3c9c | ||
| # create another trigger, linking the same trigger-event to another pipeline | ||
| codefresh create trigger "cron:codefresh:codefresh:0 */20 * * * *:hello-once-in-20-min:107e9db97062" 4a5634e4b2cd6baf021a3c0a | ||
| {% endraw %} | ||
| {% endhighlight %} | ||
| From now on, Codefresh will trigger a pipeline execution fortwo pipelines linked to the previously specified `cron` `trigger-event`, every 20 minutes (`once in 20 minutes`). | ||
| ## Cronevent payload | ||
| The following variablesareavailableto any Codefresh pipeline linked to aCrontriggerevent: | ||
| - `EVENT_MESSAGE`: Free-text message (specified during creation) | ||
| - `EVENT_TIMESTAMP`: Event timestamp in RFC 3339 format | ||
| ## Related articles | ||
| [Triggers in pipelines]({{site.baseurl}}/docs/pipelines/triggers) | ||
| [Cron trigger specifications]({{site.baseurl}}/docs/integrations/codefresh-api/#cron-triggers) | ||
| [Variables in pipelines]({{site.baseurl}}/docs/pipelines/variables) | ||
| [Creating pipelines]({{site.baseurl}}/docs/pipelines/pipelines/) | ||