Closed Bug 1198086 Opened 9 years ago Closed 9 years ago

Add InboundAutolandTrigger resource to work with autoland to inbound

Categories

(MozReview Graveyard :: General, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: dminor, Assigned: dminor)

References

Details

Attachments

(1 file)

At the moment we have a TryAutolandTrigger endpoint which is used to trigger autoland to try requests. This needs to be made generic so it can be used to trigger requests to autoland to inbound as well as to try.
Assignee: nobody → dminor
mozreview: Change TryAutolandTrigger endpoint to work with autoland to inbound (bug 1198086) r?mdoglio,smacleod

This changes the TryAutolandTrigger so it can be used to trigger requests to
autoland to inbound as well as to try.
Attachment #8652407 - Flags: review?(smacleod)
Attachment #8652407 - Flags: review?(mdoglio)
Comment on attachment 8652407 [details]
MozReview Request: mozreview: add InboundAutolandTrigger resource (bug 1198086) r?mdoglio,smacleod

mozreview: Change TryAutolandTrigger endpoint to work with autoland to inbound (bug 1198086) r?mdoglio,smacleod

This changes the TryAutolandTrigger so it can be used to trigger requests to
autoland to inbound as well as to try.
Comment on attachment 8652407 [details]
MozReview Request: mozreview: add InboundAutolandTrigger resource (bug 1198086) r?mdoglio,smacleod

https://reviewboard.mozilla.org/r/17157/#review15373

Are we going to change the csm_level check to be based on the  destination repository?
Attachment #8652407 - Flags: review?(mdoglio)
After discussion, we've decided to add a separate endpoint for autoland to inbound as well as a base class to hold code common to both InboundAutolandTrigger and TryAutolandTrigger.
Summary: Change TryAutolandTrigger endpoint to work with autoland to inbound → Add InboundAutolandTrigger resource to work with autoland to inbound
Comment on attachment 8652407 [details]
MozReview Request: mozreview: add InboundAutolandTrigger resource (bug 1198086) r?mdoglio,smacleod

mozreview: add InboundAutolandTrigger resource (bug 1198086) r?mdoglio,smacleod

This adds an InboundAutolandTrigger resource for autolanding to inbound along
with a BaseAutolandTrigger resource to hold common code between
InboundAutolandTrigger and TryAutolandTrigger.
Attachment #8652407 - Attachment description: MozReview Request: mozreview: Change TryAutolandTrigger endpoint to work with autoland to inbound (bug 1198086) r?mdoglio,smacleod → MozReview Request: mozreview: add InboundAutolandTrigger resource (bug 1198086) r?mdoglio,smacleod
Attachment #8652407 - Flags: review?(mdoglio)
Blocks: 1198915
No longer blocks: 1176321
Attachment #8652407 - Flags: review?(mdoglio) → review+
Comment on attachment 8652407 [details]
MozReview Request: mozreview: add InboundAutolandTrigger resource (bug 1198086) r?mdoglio,smacleod

https://reviewboard.mozilla.org/r/17157/#review15461

Ship It!
Attachment #8652407 - Flags: review?(smacleod)
Comment on attachment 8652407 [details]
MozReview Request: mozreview: add InboundAutolandTrigger resource (bug 1198086) r?mdoglio,smacleod

https://reviewboard.mozilla.org/r/17157/#review15471

::: pylib/mozreview/mozreview/autoland/resources.py:38
(Diff revision 3)
> -
> +class BaseAutolandTriggerResource(WebAPIResource):

This should probably have a decent docstring explaining what it implements and how it should be inherited from to add a new endpoint.

::: pylib/mozreview/mozreview/autoland/resources.py:95
(Diff revision 3)
> +        # In order to display the fact that a build was kicked off in the UI,
> +        # we construct a change description that our TryField can render.
> +        changedesc = ChangeDescription(public=True, text='', rich_text=False)
> +        changedesc.record_field_change(fieldname,

This sort of thing won't matter at all once we stop using change descriptions for the display. Maybe we should add a TODO, or call it out in mdoglio's bug where he plans to change how we display things.

::: pylib/mozreview/mozreview/extension.py:97
(Diff revision 3)
>          autoland_request_update_resource,
>          batch_review_resource,
>          ldap_association_resource,
>          review_request_summary_resource,
>          try_autoland_trigger_resource,
>          import_pullrequest_trigger_resource,
>          import_pullrequest_update_resource,
> +        inbound_autoland_trigger_resource,

These should have been in alphabetical order, can you fix that while you're here?

::: pylib/mozreview/mozreview/extension.py:112
(Diff revision 3)
>          register_resource_for_model(AutolandRequest,
> +                                    inbound_autoland_trigger_resource)
> +        register_resource_for_model(AutolandRequest,

This is problematic, you can't register two different resources for the same model.

Looking at how this works, it seems it should only ever matter if someone calls `get_resource_for_object` directly with an instance of our `AutolandRequest` model, *or* if you return an `AutolandRequest` model in a resource response (which it then uses to serialize the model so it can output it).

All that being said this makes me think we should just *not* register either of the resources for the model. That way, if someone tries to serialize using the methods above it will fail fast, rather than serializing with the wrong resource.
Comment on attachment 8652407 [details]
MozReview Request: mozreview: add InboundAutolandTrigger resource (bug 1198086) r?mdoglio,smacleod

mozreview: add InboundAutolandTrigger resource (bug 1198086) r?mdoglio,smacleod

This adds an InboundAutolandTrigger resource for autolanding to inbound along
with a BaseAutolandTrigger resource to hold common code between
InboundAutolandTrigger and TryAutolandTrigger.
Attachment #8652407 - Flags: review?(smacleod)
Comment on attachment 8652407 [details]
MozReview Request: mozreview: add InboundAutolandTrigger resource (bug 1198086) r?mdoglio,smacleod

https://reviewboard.mozilla.org/r/17157/#review15587

::: pylib/mozreview/mozreview/autoland/resources.py:39
(Diff revision 4)
> +    """ This provides a base class for resources that allow Autoland requests
> +        to be triggered.

No space before starting the docstring text.

Also, I think "Base resource for Autoland request triggers" would fit on the single line (which I highly prefer) and captures the same meaning.

::: pylib/mozreview/mozreview/autoland/resources.py:57
(Diff revision 4)
> -                           'land.',
> -        },
> +        #       descriptions to render autoland results. Once Bug 1176330 is
> +        #       this code can be removed.

"Once bug is [fixed?]"?
Attachment #8652407 - Flags: review?(smacleod) → review+
https://reviewboard.mozilla.org/r/17157/#review15605

::: pylib/mozreview/mozreview/extension.py:26
(Diff revision 4)
> +                                          inbound_autoland_trigger_resource,

lets just call all the inbound autoland stuff "autoland" and treat "try_autoland" as the special snowflake.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Product: Developer Services → MozReview
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: