Identify what resource triggered the job?


#1

Hi! I have a job that starts either on a schedule or on a git commit (check triggered by webhook), definition is like this:

resources:
- name: the-repo
  type: git
  source:
    uri: https://github.com/...
- name: every-15m
  type: time
  source:
    interval: 15m
jobs:
  - name: the-job
    plan:
      - aggregate:
        - get: every-15m
          trigger: true
        - get: the-repo
          trigger: true
        - get: docker-image
      - task: the-task
        image: docker-image
        config:
          platform: linux
          inputs:
            - name: the-repo
          run:
            path: /bin/sh ... etc

any hint on how I could figure out from within the Bash script which of the two events started me?


#2

I don’t think you can. And I think this is on purpose.
This also brings the question: are you sure you need to differentiate ? If yes, then maybe you should split the pipeline upfront: one job triggered by the schedule, one job triggered by the repo change.