Skip to content

Latest commit

 

History

History

07-trigger-jobs-by-resources

trigger job with resources

prepare

we wanna build every 15 seconds if git repo was updated without any web hooks…​

trigger-by-resources-pipeline.yml using check_every: 5s
resources:
- name: pipeline-resources
  check_every: 15s
  # ...
jobs:
- name: pipeline
  plan:
  - get: pipeline-resources
    trigger: true
  # ...
spinup concourse, login and setup pipeline
docker-compose up
fly -t lite login -c http://0.0.0.0:8080 # concourse / changeme
fly -t lite set-pipeline -c trigger-by-resources-pipeline.yml -p 07
fly -t lite unpause-pipeline -p 07
fly -t lite trigger-job -j 07/pipeline

playground

now lets update resource args to [bye-bye web hooks…​] and watch how build will be trigger
fly -t lite watch -j 07/pipeline
Cloning into '/tmp/build/get'...
Fetching HEAD
503ddcb one more update for trigger build
initializing
running echo bye-bye web hooks...
bye-bye web hooks...
succeeded

other playground

trigger-by-resources-interval-pipeline.yml using interval: 5s
resources:
- name: pipeline-resources
  type: git
  source:
    interval: 5s
fly -t lite set-pipeline -c trigger-by-resources-interval-pipeline.yml -p 07
resources:
  resource pipeline-resources has changed:
    name: pipeline-resources
    type: git
    source:
      interval: 5s
      uri: https://github.com/daggerok/concourse-examples.git
    check_every: 15s

apply configuration? [yN]: y
configuration updated
  1. update args to [bye-bye web hooks…​ finally]

  2. commit to repo

and check again
fly -t lite watch -j 07/pipeline
Cloning into '/tmp/build/get'...
Fetching HEAD
503ddcb one more update for trigger build
initializing
running echo bye-bye web hooks...
bye-bye web hooks...
succeeded