How to trigger webhook on a resource?


#1

I saw in the resource documentation that I can use a webhook_token on a resource. Which I’m doing like this:

---
resources:
- name: devops-repo
  type: git
  source:
    branch: master
    uri: git@github.com:...
    private_key: ((private_key))
  webhook_token: foobarbaz
  check_every: 24h

jobs:
- name: some-job
  plan:
    get: devops-repo
    trigger: true

So how can I actually trigger this resource? If I curl it with a GET request using curl https://CONCOURSE_URL/api/v1/teams/main/pipelines/MY-PIPELINE/resources/devops-repo/check/webhook?webhook_token=foobarbaz, then I get a method not allowed error. If I curl it with a POST using curl -X POST https://CONCOURSE_URL/api/v1/teams/main/pipelines/MY-PIPELINE/resources/devops-repo/check/webhook?webhook_token=foobarbaz, I get a 200 response, but no other feedback to curl, and my pipeline does not fire.

Anyone have an example of how to curl a pipeline using a webhook_token?

Additionally, if I only care about triggering this pipeline with HTTP webhook requests (or manually, in the Concourse UI), and I never want to trigger it based on git commits, do I still need trigger: true?

Thanks in advance.


#2

Hmm… you might need to use something else to manually trigger pipelines (like something that automates fly). Webhooks are just for manually initiating a resource check. You also cannot disable automatic checking when using webhooks.

Setting “trigger” controls whether that job automatically runs when it sees new versions available from the resource, regardless of if the new version that resource saw was from a time-based check or a webhook initiated check.