Consolidate base CI support into a new base class.

Review Request #12831 — Created Feb. 13, 2023 and submitted

Information

rbintegrations
release-3.x

Reviewers

This introduces a new rbintegrations.baseci module, containing a
BaseCIIntegration class. This class is responsible for listening to
publish and manual run requests, handling configuration queries, and
providing standard management of status updates.

There are new helpers for updating status updates with arbitrary fields,
or putting them into specific (standardized) modes. These are smart in
that they'll only make changes to status updates for fields that are
given new values.

Subclasses no longer need to implement separate code paths for publish
and manual run. Instead, they just implement an optional
prepare_build() method to filter configurations or supply state for
builds, and start_build() for actually performing the build.

Build state generation and validation is taken care of in the base
class, and errors on status updates are automatically set based on
whether start_build() raises a CIBuildError or a plain exception.

This will soon be followed up by a change to make use of new
StatusUpdate methods for status changes, and to correctly handle
manual run requests for the right configuration. Both of those will
be available in Review Board 5.0.3.

Unit tests pass on all supported versions of Python.

This will be pending a test in production by a customer.

Summary ID
Consolidate base CI support into a new base class.
This introduces a new `rbintegrations.baseci` module, containing a `BaseCIIntegration` class. This class is responsible for listening to publish and manual run requests, handling configuration queries, and providing standard management of status updates. There are new helpers for updating status updates with arbitrary fields, or putting them into specific (standardized) modes. These are smart in that they'll only make changes to status updates for fields that are given new values. Subclasses no longer need to implement separate code paths for publish and manual run. Instead, they just implement an optional `prepare_build()` method to filter configurations or supply state for builds, and `start_build()` for actually performing the build. Build state generation and validation is taken care of in the base class, and errors on status updates are automatically set based on whether `start_build()` raises a `CIBuildError` or a plain exception. This will soon be followed up by a change to make use of new `StatusUpdate` methods for status changes, and to correctly handle manual run requests for the right configuration. Both of those will be available in Review Board 5.0.3.
fcf1a5fa6c1a73f1dd40fbedff138245e3b0eaff
Description From Last Updated

In your description, 3rd paragraph, "Status Updates" should be "status updates"

daviddavid

Should add a docstring to rbintegrations/baseci/__init__.py.

maubinmaubin

Should be either "StatusUpdate" (probably with a link), or "status update"

daviddavid

Should be either "StatusUpdate" (with a link) or "status updates". Same throughout the rest of the change.

daviddavid

Let's change "They" to "It" here just to be a bit more clear.

daviddavid

Small nitpick: can use StatusUpdate here

maubinmaubin

Looks like the end of the sentence got cut off.

maubinmaubin

Could add a Returns section to the docstring while you're here.

maubinmaubin
david
  1. 
      
  2. Show all issues

    In your description, 3rd paragraph, "Status Updates" should be "status updates"

    1. I kept having to mentally make this correction. I feel we should brand more of these things. A simple "status update" can be read as a more general concept whereas "Status Update" is a feature we can refer to.

      Changing these though.

  3. rbintegrations/baseci/errors.py (Diff revision 1)
     
     
    Show all issues

    Should be either "StatusUpdate" (probably with a link), or "status update"

  4. rbintegrations/baseci/integration.py (Diff revision 1)
     
     
    Show all issues

    Should be either "StatusUpdate" (with a link) or "status updates". Same throughout the rest of the change.

  5. rbintegrations/baseci/integration.py (Diff revision 1)
     
     
    Show all issues

    Let's change "They" to "It" here just to be a bit more clear.

  6. 
      
chipx86
chipx86
david
  1. Ship It!
  2. 
      
maubin
  1. 
      
  2. Show all issues

    Should add a docstring to rbintegrations/baseci/__init__.py.

  3. rbintegrations/baseci/integration.py (Diff revision 3)
     
     
    Show all issues

    Small nitpick: can use StatusUpdate here

  4. Show all issues

    Looks like the end of the sentence got cut off.

    1. Sometimes you can see the points at which I had to context-switch to deal with something else :)

    2. Heh

  5. rbintegrations/jenkinsci/integration.py (Diff revision 3)
     
     
    Show all issues

    Could add a Returns section to the docstring while you're here.

  6. 
      
chipx86
maubin
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-3.x (2013b92)