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

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

Merged
NimRegev merged 13 commits intomasterfromq3-s3-cron-triggers
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
13 commits
Select commitHold shift + click to select a range
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
2 changes: 1 addition & 1 deletion_data/nav.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -423,7 +423,7 @@
url: "/helm-triggers"
- title: Artifactory triggers
url: "/jfrog-triggers"
- title:Timer (Cron) triggers
- title:Cron (timer) triggers
url: "/cron-triggers"
- title: Variables in pipelines
url: "/variables"
Expand Down
45 changes: 44 additions & 1 deletion_docs/integrations/codefresh-api.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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/) with the following fields.
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 |
Expand DownExpand Up@@ -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
id: 64ddd8b04fdbcc74cc74fe80
...
{% endraw %}
{% endhighlight %}

## Using Codefresh from within Codefresh

Expand Down
183 changes: 141 additions & 42 deletions_docs/pipelines/triggers/cron-triggers.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
---
title: "Cron (Timer) triggers"
description: "Run pipelineswith a time schedule"
title: "Cron (timer) triggers"
description: "Run pipelineson a time schedule"
group: pipelines
sub_group: triggers
redirect_from:
Expand All@@ -10,96 +10,195 @@ redirect_from:
toc: true
---

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.

>All times mentioned in Cron triggers use the UTC time zone.

## Manage Cron Triggers withCodefreshUI
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.

It is possibletodefineandmanage Cron-based pipeline triggers with Codefresh UI.
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.

### Create a newCronTrigger
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.

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.
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/add-trigger-dialog.png"
url="/images/pipeline/triggers/add-trigger-dialog.png"
alt="Adding new Trigger dialog"
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%"
%}


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.
## 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)

Fill the following information:
**How to**

* Use Cron helper wizard to build a valid `cron` expression or write custom `cron` expression on the last tab.
* Add a free text message, that will be sent as an additional event payload every time `cron` is executed.
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/cron_trigger.png"
url="/images/pipeline/triggers/cron_trigger.png"
alt="Add Cron Trigger"
max-width="70%"
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.

### Trigger Codefresh pipeline with cron timer
{% 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%"
%}

Now, `cron` will trigger a recurrent pipeline execution based on the defined `cron expression`.
{: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.

## Manage Cron Triggers with Codefresh CLI

It is also possible to use theCodefreshCommand Line client (`CLI`) to manage Cron based pipeline triggers.
## Cron triggers withCodefresh CLI

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

this should be also underlegacy section


### Cron trigger
>**NOTE**:
This section is relevant only for legacy Cron triggers and will be deprecated.

It is possible to trigger a Codefresh CD pipeline(s) periodically, using `cron` expression.
You can also create and manage Cron triggers for pipelines via the [Codefresh CLI](https://cli.codefresh.io/){:target="\_blank"}.

You can use [Codefresh CLI](https://cli.codefresh.io/){:target="\_blank"} to set up a Codefresh `cron` trigger.

#### Create Cron trigger-event

First, you need to create a new `cron` `trigger-event` to define a recurrent event.
### Create Crontriggerevent via CLI

```sh
# create DockerHub recurrent event 'once in 20 minutes'
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 %}

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.

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.

#### Set up pipeline trigger
### Set up pipeline trigger
Copy link
Member

@yaroslav-codefreshyaroslav-codefreshAug 21, 2023
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

this should be also underlegacy section


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
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,every 20 minutesCodefresh will trigger a pipeline execution for2 pipelines linked to the previously specified `cron` `trigger-event` (once in 20 minutes)
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
## Cronevent payload

The following variableswill beavailablefor any Codefresh pipeline linked to a`cron` `trigger-event`:
The following variablesareavailableto any Codefresh pipeline linked to aCrontriggerevent:

- `EVENT_MESSAGE` - freetext message (specified during creation)
- `EVENT_TIMESTAMP` - event timestamp in RFC 3339 format
- `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/)

Binary file addedimages/icons/icon-warning.png
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

[8]ページ先頭

©2009-2025 Movatter.jp