You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow Concourse to receive git post-commit hooks #331
We have GHE admins who are having their deployment of GHE face-melted by some over eager polling and a somewhat large dev organization.
Would it be possible to have concourse accept github post-commit hooks to trigger git-resources? Maybe for other repo resources as well.
Reacted by Thomas Cashman, Bas Zalmstra, Arnold Bechtoldt, xlr-8, Florian Parga, Mark Kropf, Ciro S. Costa, J. Felix Etcetera, Denis Izmaylov, Chad Woolley and 40 more
The request payload will be entirely ignored, and we'll immediately check for new versions. (This is what you want; it leaves it up to the resource to determine everything rather than some things coming in via hooks and some things being discovered via /check).
Note that these routes are subject to change (and will change soon as we introduce teams).
Reacted by Denis Izmaylov, Mark Kropf, valerio, Mike Sarahan, Elliot Wright and Mathias Bogaert
I'm creating a PR/MR that triggers a run of the CI pipeline
The CI system adds information (comment) to the PR/MR ticket with the report (ran successful or with failures)
As a reviewer I can see that status of the code in the PR/MR ticket, without manually opening the concourse CI and search for the job that tested the new code
@vito I'm going to disagree here, I don't see it as the webhook triggering a job, I see it more as a reverse check, the resource change still triggers the job, only the direction of communication has changed from resource -> github to github -> resource, this still keeps the abstraction in place.
Reacted by J. Felix Etcetera, c10l, Mike Sarahan, Werner Buck, Gabriele Petronella, Ringo De Smet, Damouse, Pete Kazmier and Hrishi
@superbeeny I think we're actually agreeing there - that's what I was saying. 👍
For the auth issue, I think we can get away with just configuring a resource with an arbitrary token that gets included in the callback URL. All the endpoint does is trigger a check, so we just need to add a basic form of auth in front of it.
Reacted by Johan Bloemberg, Denis Izmaylov and Mike Sarahan
Great point. We already have a configured Concourse CI with enabled Basic HTTP auth. How we can implement git-commit hooks for GitHub repos? Or worker do it automatically by periodic executing a check script?
Add a /api/v1/teams/foo/pipelines/bar/resources/baz/check-hook endpoint which simply authorizes (via access token or anything else really), ignores the entire request payload, and runs a check on the resource. This is very similar to the existing endpoint, but it has to ignore the payload.
Then just configure GitHub (or whatever service) with the following endpoint:
Reacted by Denis Izmaylov, Ciro S. Costa, Glenn Oppegard, Gabriele Petronella, Ievgen Pyrogov, Mike Sarahan, Ganiev Shamil, Jeff Billimek, Kunal, Lukas Rieder and 1 more
By moving away from a single webhook_token: top-level attribute to a more generic webhook: top-value element with multiple parameters, I'm trying to image what other attributes that webhook: would need other than a token?
Agreed; I think a single webhook_token parameter alongside source (not inside of it) makes sense. I don't expect there to be any e.g. GitHub-specific parameters as part of the point of this approach is to implement it generically and not require any knowledge of GitHub's hooks API and such.
If the time comes that we want more flexibility, we can always change that (backwards-compatibly).
________________________________
The information in this Internet Email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this Email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. When addressed to our clients any opinions or advice contained in this Email are subject to the terms and conditions expressed in any applicable governing The Home Depot terms of business or client engagement letter. The Home Depot disclaims all responsibility and liability for the accuracy and content of this attachment and for any damages or losses arising from any inaccuracies, errors, viruses, e.g., worms, trojan horses, etc., or other items of a destructive nature, which may be contained in this attachment and shall not be liable for direct, indirect, consequential or special damages in connection with this e-mail message or its attachment.
@vito How come the implementation only allows for triggering the check and not also allow for passing the POST request payload? Could the payload be passed arbitrarily? Like pass a yaml object containing the mothod, url, version, headers, and body of the request to the check?!
@trivigy By passing the payload along we would then require every resource author to have more intimate knowledge of each and every API (GitHub, BitBucket, GitLab). By ignoring it and just running check there's a single eventually-consistent "source of truth" for where the versions are coming from, requiring no change on the part of resource implementors.
@vito makes total sense from design perspective but should it not be up to the develop to decide the level of involvement? "To use or not to use" - cyber-shakespear ;)
I am running into a weird problem because of this "double checking" with the https://github.com/jtarchie/github-pullrequest-resource. When I have two commits to the same pull request made very close in time to each other then the actual build, although runs two workers, run the steps on the same commit. The last one. Not running two builds on the two distinct commits. This is because of how the check is being done looking only for the last change.
@trivigy By enabling resource authors to implement multiple ways of detecting versions, it would make it very easy to have inconsistent behavior. By having only one interface, it will always be consistent.
The GitHub PR resource is fundamentally unsound in its use of the resource interface (which is not the author's fault - it'll take #1707 to implement it properly), and the behavior you've mentioned is only the tip of the iceberg when it comes to funky behavior. With "spaces" done (#1707) it'll be much easier to do what you're attempting.
@vito is there any other way to pass through meta information from an external source? I am trying to build a github integration (using webhooks) but there is no way for me to "poll" certain pieces of information from github. The only solution is the events api but that one is limited to a single user's vantage point of an organization.
I feel like one major component that is absolutely missing is meta flow control. The plan in the pipeline dictates how things should happen and when assuming they need to happen. But, the decision of whether they need to happen seems to be placed inside of a check which has no connection to the outside with the exception of polling. Just makes it impossible to create complex integrations without realtime responsiveness to things that happen externally.
Activity
concourse-bot commentedon Mar 27, 2016
Hi there!
We use Pivotal Tracker to provide visibility into what our team is working on. A story for this issue has been automatically created.
The current status is as follows:
This comment, as well as the labels on the issue, will be automatically updated as the status in Tracker changes.
arnisoph commentedon May 18, 2016
Something generic or easy enhanceable would be great, since I need Gitlab Webhook support, too. :)
arnisoph commentedon May 18, 2016
Also see
vito commentedon May 18, 2016
I think this might already work, if you point your webhooks at this endpoint:
https://github.com/concourse/atc/blob/d54a0cc5ce9a9b9aefb7db4aaca077cb3caf2dd5/routes.go#L110
The request payload will be entirely ignored, and we'll immediately check for new versions. (This is what you want; it leaves it up to the resource to determine everything rather than some things coming in via hooks and some things being discovered via
/check).Note that these routes are subject to change (and will change soon as we introduce teams).
superbeeny commentedon May 18, 2016
@vito does
triggerstill need to be set to true? and would we just setcheck_everyto something really long like 60mvito commentedon May 18, 2016
@superbeeny Yep and yep.
I definitely don't like the idea of web hooks triggering jobs directly since it totally disregards the resource <-> job abstraction.
vito commentedon May 18, 2016
Also that won't quite work since there's no way for us to authorize the request (e.g. GitHub passes a X-Hub-Secret header). Hmm.
arnisoph commentedon May 18, 2016
How about an use case?
This is basically what you can see at saltstack/salt#33328 .
superbeeny commentedon May 19, 2016
@vito I'm going to disagree here, I don't see it as the webhook triggering a job, I see it more as a reverse check, the resource change still triggers the job, only the direction of communication has changed from resource -> github to github -> resource, this still keeps the abstraction in place.
vito commentedon Jun 29, 2016
@superbeeny I think we're actually agreeing there - that's what I was saying. 👍
For the auth issue, I think we can get away with just configuring a resource with an arbitrary token that gets included in the callback URL. All the endpoint does is trigger a check, so we just need to add a basic form of auth in front of it.
DenisIzmaylov commentedon Jul 31, 2016
Great point. We already have a configured Concourse CI with enabled Basic HTTP auth. How we can implement git-commit hooks for GitHub repos? Or worker do it automatically by periodic executing a
checkscript?vito commentedon Jul 31, 2016
@DenisIzmaylov I think we need to do two things:
access_token-based auth. This needs some fleshing out, but I think it'd mean adding API endpoints for generating and revoking these tokens, which would just be stored (encrypted) in the database. That encryption strategy should probably be the same as with Using external credential managers for build credentials #291. The actual issue for this is API authentication without using basic auth vmware-archive/atc#42./api/v1/teams/foo/pipelines/bar/resources/baz/check-hookendpoint which simply authorizes (via access token or anything else really), ignores the entire request payload, and runs acheckon the resource. This is very similar to the existing endpoint, but it has to ignore the payload.Then just configure GitHub (or whatever service) with the following endpoint:
33 remaining items
billimek commentedon Apr 13, 2017
By moving away from a single
webhook_token:top-level attribute to a more genericwebhook:top-value element with multiple parameters, I'm trying to image what other attributes thatwebhook:would need other than a token?vito commentedon Apr 13, 2017
Agreed; I think a single
webhook_tokenparameter alongsidesource(not inside of it) makes sense. I don't expect there to be any e.g. GitHub-specific parameters as part of the point of this approach is to implement it generically and not require any knowledge of GitHub's hooks API and such.If the time comes that we want more flexibility, we can always change that (backwards-compatibly).
Shall we continue this discussion in vmware-archive/atc#163 ?
marcosrmendezthd commentedon Apr 13, 2017
vito commentedon Apr 24, 2017
vmware-archive/atc#163 is merged! Thanks @mainephd and @billimek!
mainephd commentedon Apr 24, 2017
Thank you for pulling this in @vito
trivigy commentedon Apr 17, 2018
@vito How come the implementation only allows for triggering the
checkand not also allow for passing the POST request payload? Could the payload be passed arbitrarily? Like pass a yaml object containing the mothod, url, version, headers, and body of the request to the check?!vito commentedon Apr 18, 2018
@trivigy By passing the payload along we would then require every resource author to have more intimate knowledge of each and every API (GitHub, BitBucket, GitLab). By ignoring it and just running
checkthere's a single eventually-consistent "source of truth" for where the versions are coming from, requiring no change on the part of resource implementors.trivigy commentedon Apr 18, 2018
@vito makes total sense from design perspective but should it not be up to the develop to decide the level of involvement? "To use or not to use" - cyber-shakespear ;)
I am running into a weird problem because of this "double checking" with the https://github.com/jtarchie/github-pullrequest-resource. When I have two commits to the same pull request made very close in time to each other then the actual build, although runs two workers, run the steps on the same commit. The last one. Not running two builds on the two distinct commits. This is because of how the
checkis being done looking only for the last change.vito commentedon Apr 18, 2018
@trivigy By enabling resource authors to implement multiple ways of detecting versions, it would make it very easy to have inconsistent behavior. By having only one interface, it will always be consistent.
The GitHub PR resource is fundamentally unsound in its use of the resource interface (which is not the author's fault - it'll take #1707 to implement it properly), and the behavior you've mentioned is only the tip of the iceberg when it comes to funky behavior. With "spaces" done (#1707) it'll be much easier to do what you're attempting.
trivigy commentedon Apr 20, 2018
@vito is there any other way to pass through meta information from an external source? I am trying to build a github integration (using webhooks) but there is no way for me to "poll" certain pieces of information from github. The only solution is the events api but that one is limited to a single user's vantage point of an organization.
I feel like one major component that is absolutely missing is meta flow control. The
planin the pipeline dictates how things should happen and when assuming they need to happen. But, the decision of whether they need to happen seems to be placed inside of acheckwhich has no connection to the outside with the exception of polling. Just makes it impossible to create complex integrations without realtime responsiveness to things that happen externally.fordagertz commentedon Jun 28, 2018
Does this solution work with GitHub Enterprise?
billimek commentedon Jun 28, 2018
@fordagertz yes!
bump etree tsa handlers mux clockwork goxmldsig genproto grpc
iddm commentedon May 24, 2021
How can I use it in 2021? I see no documentation for this at all. Is there any available on the website in the docs section?