Skip to content

Shared webhook endpoint for multiple resources #2230

Closed as not planned
Closed as not planned

Description

@wendorf

Feature Request

What challenge are you facing?

We have one single GitHub repository that includes many different conceptual resources. For example, n directories, one for each application we release. We use source.paths to generate versions for the resources only when the folder representing the contents of the resource has changed. This results in n checks every check_interval, which puts a lot of strain on our workers.

We want to use webhook_tokens to reduce strain (and setting check_interval to a very high number), but each resource has its own webhook URL, which means we must create a GitHub webhook for each resource. Not only is this an operational burden, but GitHub has a limit of 20 webhooks for a single repository (see docs), preventing us from using this solution as our number of resources grows.

A Modest Proposal

I would like to be able to define a single webhook URL that can trigger all n resources. This would still result in n checks on every push, but would greatly reduce the total number of checks that are run. Some YAML like this would be good:

resources:
- name: app-one
  type: git
  source:
    uri: [email protected]:org/repo.git
    branch: master
    paths: [app_one]
  webhook:
    name: MY_WEBHOOK
    token: WEBHOOK_TOKEN

- name: app-two
  type: git
  source:
    uri: [email protected]:org/repo.git
    branch: master
    paths: [app_two]
  webhook:
    name: MY_WEBHOOK
    token: WEBHOOK_TOKEN

Which would allow me to configure GitHub with a webhook path of https://my-concourse.example.com/api/v1/teams/TEAM_NAME/pipelines/PIPELINE_NAME/webhooks/MY_WEBHOOK?webhook_token=WEBHOOK_TOKEN.

An alternate structure:

webhooks:
- name: MY_WEBHOOK
  token: WEBHOOK_TOKEN

resources:
- name: app-one
  type: git
  source:
    uri: [email protected]:org/repo.git
    branch: master
    paths: [app_one]
  webhooks: [MY_WEBHOOK]

- name: app-two
  type: git
  source:
    uri: [email protected]:org/repo.git
    branch: master
    paths: [app_two]
  webhooks: [MY_WEBHOOK]

Activity

  1. billimek commented on May 21, 2018

    @billimek

    👍 for this as well. We end up creating a ton of webhooks on the github side and would love to have just one trigger a check for everything.

  2. a459259 commented on May 22, 2018

    @a459259

    +1 - We have a similar use-case, would make a lot of sense to have this in place...

  3. haganbmj commented on Jun 11, 2018

    @haganbmj

    Echoing these sentiments. Currently putting off transitioning a couple dozen projects because it would mean manually creating 4+ webhooks per each one while still not having support for building feature branches.

  4. databus23 commented on Aug 15, 2018

    @databus23
    Contributor

    FYI: I created a small service to solve this issue for our concourse deployment: https://github.com/sapcc/webhook-broadcaster

  5. vito commented on Aug 15, 2018

    @vito
    Contributor

    @wendorf Neat! I like the second form. Is there a use case for listing multiple webhook names? (It makes sense to me, just curious.)

    @databus23 That's awesome, thanks for open-sourcing it!

  6. wendorf commented on Aug 15, 2018

    @wendorf
    Author

    @vito I prefer the second form as well. I don't think I had any use-case for multiple webhooks—probably just overeager.

    Took a look at @databus23 's webhook-broadcaster, which looks super useful in the interim. That use case has even tougher requirements, though, with 70 pipelines, and would still not be satisfied by this proposal. It'd be worth thinking if there's an elegant solution to share webhooks across pipelines (scoped to teams, likely), but that's above my pay grade.

  7. timrchavez commented on Aug 24, 2018

    @timrchavez
    Contributor

    We have not discovered a need for a single resource to have multiple webhook tokens. Also, now that we've made webhook tokens Vault-able, reusing tokens has become very simple with Concourse cred interpolation. Presumably you could have a pipeline-level webhook trigger where any resource configured with the same webhook_token would trigger. However, I think @databus23 actually solves that problem much better by eliminating the need for a user to add a webhook at all. They just configure their repo to use a webhook and presto their pipeline triggers on repo events. Developers love when they get something for free and with the Drones and Travis's, they've come to expect it, really.

  8. schmurfy commented on Oct 26, 2020

    @schmurfy
    Contributor

    I just found this, is there anything happening for that issue ?
    Sure the broadcaster may solve the issue but this should be done by concourse itself and not need an external application.

  9. taylorsilva commented on Oct 26, 2020

    @taylorsilva
    Member

    @schmurfy This issue is not part of the team's backlog. Someone in the community could pick this one up, as indicated by the help wanted label

  10. vito commented on Nov 5, 2020

    @vito
    Contributor

    @schmurfy I've been working on an RFC proposing a new design for this, but I'm currently too busy with other things to finish it up. A very very messy WIP is here if you care to poke around. Note that some ideas the document are scrapped but still left around, so take it with a grain of salt.

  11. schmurfy commented on Nov 10, 2020

    @schmurfy
    Contributor

    @vito after looking at this I think one such system should be even simpler, I was thinking you could just define webhooks on one side with no intelligence and link them to resources of other entities by using their name/id/whatever:

    webhooks:
    - name: hook1
      token: hook1-token
    
    
    resources:
    - name: mygit
      webhook: hook1
    

    The webhook would have no intelligence by itself (other than maybe allowing to respond to challenge but I am pretty sure a first version could even ignore this) aside from keeping a list of "things" to trigger.

  12. vito commented on Nov 10, 2020

    @vito
    Contributor

    @schmurfy Yeah, that'd work too, the rfc I'm working on is just aiming to eliminate the need for configuring it at all, since it's a lot of boilerplate. If someone wants to contribute a simpler solution first, by all means - I think there's a path to victory in sight with the rfc, it'll just take a while longer to finalize the proposal and implement.

  13. aoldershaw commented on Jul 27, 2021

    @aoldershaw
    Contributor

    I put together a proposal roughly based on @vito's WIP RFC if anyone's interested in taking a look: concourse/rfcs#110

    It takes a similar "no (pipeline) config" approach, where users/operators can define webhooks via fly, and prototypes can define how resources should "subscribe" to particular webhook payloads based on the source configuration.

    Would love any feedback!

  14. VRanga000 commented on Mar 1, 2023

    @VRanga000

    I put together a proposal roughly based on @vito's WIP RFC if anyone's interested in taking a look: concourse/rfcs#110

    It takes a similar "no (pipeline) config" approach, where users/operators can define webhooks via fly, and prototypes can define how resources should "subscribe" to particular webhook payloads based on the source configuration.

    Would love any feedback!

    This is great. It seems like this has been open for quite some time, but would still be a useful feature for many (altho it seems like there is a nice solution - but it requires the deployment of additional components, and a concourse-native solution would still be valuable).

    I am interested in proposing this feature and your RFC as an entry for an open source hackathon that is being organized at my company. Would you be open to contributions on this from developers at the hackathon? And would you also be open to providing mentorship / guidance if needed? @wendorf @aoldershaw Thank you.

  15. taylorsilva commented on Jan 6, 2025

    @taylorsilva
    Member

    Closing and suggesting that all future discussion move to the referenced RFC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions