DEV Community

Deepika Banoth
Deepika Banoth

Posted on

Scheduled triggers using JFrog Pipelines

Jfrog Pipelines support automatic triggers through webhooks, REST API based triggers, as well as manual triggers through the UI.
Jfrog Pipelines also provides you the ability to schedule a Pipeline to be triggered at specific date/times, or at a recurring interval.

You can use the cronTrigger resource of JFrog Pipelines to achieve the functionality scheduled triggers in your workflow.

Before starting I would like to quickly tell you about JFrog Pipelines key concepts which would help you understand this better.

Concept Description
Pipeline It is a collection of interconnected serial or parallel steps required to achieve an outcome
Steps Steps are the executable units of your pipelines that can execute any DevOps activity
Integrations Integrations contain credentials to third-part tools/services such as AWS, slack, Github, etc.,
Resources Resources contain information required to execute steps
Run Run is an instance of pipeline execution

CronTrigger Resource

cronTrigger resource provides cron-like functionality. It is used to trigger a build in a cron-like manner.
You can define the resource in your yaml config file as:

- name: cron                 #friendly name to remember
  type: CronTrigger
  configuration: 
    interval: "*/2 * * * *"  #follows the standard Cron format

This resource can be used as an inputResource to a step in pipeline as follows:

steps:          
      - name: bash_1
        type: Bash
        configuration:
          inputResources:
            - name: github
            - name: cron        #created CronTrigger resource name
        execution:
          onExecute:
            - echo "executing bash step."

If the CronTrigger typed resource is given as Input to a step then it gets triggered at the recurring interval or at a specific date as depends on what you configure in interval.
A new run will be created every time the step is triggered.
In my example, this bash_1 step will be triggered by cron resource in every 2 minutes as shown in the below screenshot:
Alt Text

You can also schedule to trigger this on a particular day by just updating the interval in the resource definition as per cron syntax.

Hope this helps. :)

Top comments (0)