Follow-up from "Enable force cancellation of stuck build jobs"

The following discussions from !179137 (merged) should be addressed:

Documentation follow-up:

Code clean-up:

Permissions clean-up:

  • @jessieay started a discussion: (+2 comments)

    Suggestion: I would consolidate all of these permission checks behind a new check called (:force_cancellation, build) (defined in the policy class) so that if we want to change the authorization logic that can be done in one place

  • @drew started a discussion: (+2 comments)

    I don't love this being a parallel definition of the permission; the serializer isn't one of the more obvious places I would look.

    Something like making BuildCancelService#allowed_to_force? a public helper method might help us keep this reliable and less brittle for whoever looks at this in a couple years.

State machine follow-up:

  • @drew started a discussion: (+1 comment)

    We have drop defined above that specifies this exact transition

Runner-Application communication follow-up:

  • (high priority, investigation required before enabling for customers) @allison.browne started a discussion: (+8 comments)

    Ah, right so BuildFinishedWorker will revoke the token immediately and then it's up the the runner to stop execution if it can no longer communicate with gitlab on the next update.

    A team member should pull down this code to make sure that's how it's behaving on gdk with a registered current runner before it gets merged.

    This is a critical area to get right because if the runner doesn't shut down the after_script work this easily becomes an abuse vector for .com instance runner billing.

    @daniel-prause, would you feel comfortable simulating this in your development environment, for us, and posting some screenshots?

Edited by Lysanne Pinto