Consolidate base CI support into a new base class.

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

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.

Changes between revision 2 and 3

orig
1
2
3
4

Commits

Summary ID Author
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.
cab607aa3445cf366d930c9b50050f8ff94c74b2 Christian Hammond
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.
604074cf38b3eb742967e11757b5e906cc3360b3 Christian Hammond
rbintegrations/baseci/errors.py
rbintegrations/baseci/integration.py
rbintegrations/circleci/integration.py
rbintegrations/jenkinsci/integration.py
rbintegrations/travisci/integration.py
Loading...