Commit Graph

22961 Commits

Author SHA1 Message Date
Jake McDermott 08594682a4 stub options request in workflow add unit test 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
Jake McDermott 3bc91f123e add trailing '/' to webhook urls 2019-09-30 13:32:21 -04:00
Jake McDermott 41ba5c0968 add webhook fields to workflow unit test mock 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
Jake McDermott b96c03e456 represent webhooks on job lists 2019-09-30 13:32:21 -04:00
Jake McDermott 5e9448a854 always show launched by webhook details if there's a webhook guid 2019-09-30 13:32:21 -04:00
Jake McDermott 6b17e86f30 add launched-by-webhook details to job runs 2019-09-30 13:32:21 -04:00
Jake McDermott 00337990db add webhook fields to workflows 2019-09-30 13:32:21 -04:00
Jake McDermott 1a33ae61a7 use key icon for webhook cred 2019-09-30 13:32:21 -04:00
Jake McDermott 5f7bfaa20a support server-side webhook key generation 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 58e5f02129 Expose the new webhook fields in the job and workflow serializers 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
Jake McDermott e0a363beb8 issue network calls for setting and getting webhook key 2019-09-30 13:32:20 -04:00
Jake McDermott 48eb502161 wip 2019-09-30 13:32:20 -04:00
Jake McDermott 151de89c26 add webhook credential field 2019-09-30 13:32:20 -04:00
Jake McDermott f5c151d5c4 add webhook url field 2019-09-30 13:32:20 -04:00
Jake McDermott 17b34b1e36 add webhook service field 2019-09-30 13:32:20 -04:00
Jeff Bradberry ee1d118752 Add the webhook receiver url to the related urls in the serializers 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 095aa77857 Create a new model mixin for Job and WorkflowJob webhook fields 2019-09-30 13:26:04 -04:00
Jeff Bradberry bb1397a3d4 Validate the webhook credential
- we should allow a null credential, so that the admin can choose to configure not posting back status changes of the triggered job
- the credential must be of the new 'token' kind
- if we do configure a credential, its type must match the selected SCM service
2019-09-30 13:26:04 -04:00
Jeff Bradberry 5848f0360a Update test_default_cred_types to include the new personal access token types 2019-09-30 13:26:04 -04:00
Jeff Bradberry 83fc2187cc Fix the summary fields for webhook_credential 2019-09-30 13:26:04 -04:00
Jeff Bradberry 4dba9916dc Add a new set of personal access token credential types 2019-09-30 13:26:03 -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 d4b20b7340 Update tests to use the expect keyword argument for get() and post() 2019-09-30 13:26:03 -04:00
Jeff Bradberry c0ad5a7768 Expose the webhook_service and webhook_credential fields in the serializer
webhook_credential specifically as a summary field.
2019-09-30 13:26:03 -04:00
Jeff Bradberry d9ac291115 Add some RBAC oriented tests for the webhook secret key view 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 771ef275d4 Include a check for the webhook_key related resource url
in the tests for JTs and WFJTs.
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 edb9d6b16c Add the related link to the webhook secrets view to the serializers 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 b0c530402f Move the webhook url include from the top level urlconf to the JT/WFJT urlconfs 2019-09-30 13:23:26 -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
Jeff Bradberry d6116490c6 Add the webhook-specific fields to JobTemplate and WorkflowJobTemplate 2019-09-30 13:23:26 -04:00
softwarefactory-project-zuul[bot] ff8e896b0f Merge pull request #4850 from wenottingham/to-the-cloud!
Adjust help message; we're no longer using the insights client

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
2019-09-30 16:46:22 +00:00
Bill Nottingham fc70d8b321 Adjust help message; we're no longer using the insights client 2019-09-30 12:17:46 -04:00
mabashian a61306580a Show error body when license application fails 2019-09-30 12:09:24 -04:00