Ryan Petrello
ab6322a8f7
fix a bug that breaks webhook launches when a survey is in use
...
see: https://github.com/ansible/awx/issues/5062
2019-10-29 11:24:12 -04:00
Jeff Bradberry
d549877ebd
Check for the existance of a UnifiedJobTemplate with the same webhook GUID
...
instead of trying (incorrectly) to be specific about the JT/WFJT type.
2019-09-30 15:26:49 -04:00
Jeff Bradberry
062c4908c9
Modify the webhook debounce logic
...
to check if we've already previously run a job with the same webhook
GUID plus template id. This will allow organizations to write
multiple JT/WFJTs to handle the same set of webhook events.
2019-09-30 13:32:23 -04:00
Jeff Bradberry
b6b70e55fb
Address a variety of small review issues
2019-09-30 13:32:23 -04:00
Jeff Bradberry
df24f5d28f
Add a new launch_type of 'webhook'
2019-09-30 13:32:23 -04:00
Jeff Bradberry
b415c31b4f
Fix problems with posting to Gitlab's API
2019-09-30 13:32:22 -04:00
Jeff Bradberry
885841caea
Drop Bitbucket support
...
since only the Bitbucket Server product supports signed payloads,
bitbucket.org does not. And we are requiring signed payloads.
2019-09-30 13:32:22 -04:00
Jeff Bradberry
4ad5054222
Add logic to post the job status for webhooks back to the service
...
under some circumstances.
2019-09-30 13:32:21 -04:00
Jeff Bradberry
aa34984d7c
Fix the git ref extractor for Gitlab pull requests
2019-09-30 13:32:21 -04:00
Jeff Bradberry
d73abda5d1
Update the webhook receiver git ref extractor logic
...
to deal with the null-ref case, and to deal correctly with Github push events.
2019-09-30 13:32:21 -04:00
Jeff Bradberry
e8e3a601b2
Pull out a git ref for each event type where we might care
2019-09-30 13:32:21 -04:00
Jeff Bradberry
178a2c7c49
Disable the authentication classes for the webhook receivers
...
One of them was consuming the body of the posts. We do still need to
have an extraneous `request.body` expression, though now in
WebhookReceiverBase.post, since the `request.data` expression in the
logging also consumes the request body.
2019-09-30 13:32:20 -04:00
Jeff Bradberry
dd6c97ed87
Include a message in the webhook response
2019-09-30 13:32:20 -04:00
Jeff Bradberry
7aa424b210
Make sure that the new webhook fields are populated when firing off a job
...
Also, added a temporary hacky workaround for the fact that something
in our request/response stack for APIView is consuming the request
contents in an unfriendly way, preventing the `.body` @property from
working.
2019-09-30 13:32:20 -04:00
Jeff Bradberry
245931f603
Debounce when multiple copies of the same webhook event come in
2019-09-30 13:26:04 -04:00
Jeff Bradberry
8836ed44ce
Construct an ID for Gitlab webhooks
...
by taking the SHA1 of the body of the webhook request.
2019-09-30 13:26:03 -04:00
Jeff Bradberry
992c414737
Launch a Job or WorkflowJob based on the incoming webhook
2019-09-30 13:26:03 -04:00
Jeff Bradberry
66a8186995
Get the webhook receiver views to work at least minimally
2019-09-30 13:26:03 -04:00
Jeff Bradberry
fa15696ffe
Remove some dead comments
2019-09-30 13:26:03 -04:00
Jeff Bradberry
82a0dc0024
Cycle or unset the webhook key if the webhook service changes
...
Also, tests.
2019-09-30 13:26:03 -04:00
Jeff Bradberry
6b86cf6e86
Revert to using the explicit dispatch to the appropriate model
...
since passing the model class at url include time doesn't work.
2019-09-30 13:26:03 -04:00
Jeff Bradberry
2310413dc0
Fix problem with the tests by dynamically setting the view model
...
instead of using a model @property or lookup method.
2019-09-30 13:26:03 -04:00
Jeff Bradberry
7973a18103
Switch to using a permission class for the webhook secret key view
...
This view is now behaving as expected for superuser, org admin, JT
admin, JT exec, and org member roles.
2019-09-30 13:23:27 -04:00
Jeff Bradberry
747a2283d6
Attempt to get the RBAC right on the webhook secret key view
2019-09-30 13:23:27 -04:00
Jeff Bradberry
9d269d59d6
Add an api view for obtaining and rotating the webhook key
2019-09-30 13:23:27 -04:00
Jeff Bradberry
50a54c9214
Forbid access to the webhook receiver views if webhook_key is not set
2019-09-30 13:23:26 -04:00
Jeff Bradberry
8f97dbf781
Hook in the webhook receiver views into the urlconf
2019-09-30 13:23:26 -04:00
Jeff Bradberry
a7a99ed141
Beginnings of the API views for the webhook receivers
2019-09-30 13:23:26 -04:00