Trigger jobs with resource

The primary way that Concourse jobs will be triggered to run will be by resources changing. Agitrepo has a new commit? Run a job to test it. A GitHub project cuts a new release? Run a job to pull down its attached files and do something with them.

Triggering resources are defined the same as non-triggering resources, such as theresource-tutorialdefined earlier.

The difference is in the job build plan where triggering is desired.

By default, includingget: my-resourcein a build plan does not trigger its job.

To mark a fetched resource as a trigger addtrigger: truejobs-

jobs:
- name: job-demo
  plan:
  - get: resource-tutorial
    trigger: true

In the above example thejob-demojob would trigger anytime the remoteresource-tutorialhad a new version. For agitresource this would be new git commits.

Thetimeresource has express purpose of triggering jobs.

If you want a job to trigger every few minutes then there is thetimeresource.

resources:
- name: my-timer
  type: time
  source:
    interval: 2m

Now upgrade thehelloworldpipeline with thetimetrigger.

cd ../08_triggers
fly set-pipeline --target tutorial --config pipeline.yml --pipeline helloworld

This adds a new resource namedmy-timerwhich triggersjob-hello-worldapproximately every 2 minutes.

results matching ""

    No results matching ""