Adding ability to handle webhooks from Github #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
We would like to use forklift for automating deployments of things that are not running in containers. Since a webhook would never be called from DockerHub in those cases, we could call from Github webhooks instead.
This adds an additional endpoint that can parse the format of a GH event payload. It currently only handles the push event, but the event type is being detected so it could be expanded on to handle the many various events GH can send.
Any repo that wants to send an event payload back to forklift from GH would have to use the new endpoint like:
https://location_of_forklift.domain.com/gh_webhook?apikey=xxxxxxxxxxxxx
Configuration
The configuration of the
valid_containers
section requires knowing how to map the data in the GH event payload to the name and tag values. For the following payload:The values in the forklift configuration would be: