Skip to content

Integrate cfbot pgarchives #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

polobo
Copy link
Owner

@polobo polobo commented May 1, 2025

No description provided.

polobo added 2 commits April 28, 2025 17:56
Built without the proposed Workflow changes since this patch set
is intended to demonstrate the integration of CFBot into CFApp.

This first commit simply sets up the endpoint for pgarchives to
send a complete Thread with Patchset to CFApp and have a new patch
created.  This allows for real demos without having to setup dummy
data - though the later will be part of it as well.

The Patch screen thread display area has been reworked a bit, in
particular to accomodate the added contextual data available such
as is_patch and the specific thread message containing patches.
The model now also handles multiple attachments per thread message
by removing the too-constraining unique together specification.
The patch itself tracks which message contains its most recent
patch set and returns only those attachments upon request.
The premise of this patch is to incorporate and enhance the existing
CFBot application in CFApp/PGCommitfest.  This is definitely an
intermediate state where the goal of the CFBot is brought over
even though specific aspects of its implementation, in particular
its integrataion with CirrusCI, haven't been fully considered.

The existing CFBot implementation uses textual indirection and a
largely function programming paradigm.  I've choosen to structure
things a bit differently while keeping the Template Pattern nature
intact.  Namely by defining abstract classes for the templates
and, presently, implementing Local and a Test subclasses to handle
live patches, sourced from pgarchives, and test patches, saved
within the fixtures directory.

The existing Attach Thread feature has been tweaked to use this.

CfbotBranch and CfbotTask are modified to handle the processing flow.

CfbotQueue (and Item) are implemented.  A linked list backed ring queue
that determines which patch should next be processed.

BranchManager is where the logic of processing a patch is defined.
Actions such as apply, compile, and test, are delegated to the
contained PatchApplierTemplate, PatchCompilerTemplate, and
PatchTesterTemplate abstract classes which themselves have the
template methods of begin(), is_done(), and did_fail() (the
names make more sense when viewed in the context of the process()
method in BranchManager.

Auxillary classes for TaskCommands and TaskArtifacts are added,
and used to track applied patches at the momement.

A BranchHistory is added to capture the branch and task related
information that would otherwise be lost since branch is intended
to be a "most recent activity per-patch" table.

The bulk of the commit is implementing a rough control panel
for the entire module, along with the apiv1 endpoints the
control panel page uses.  The control panel itself is html
structure for tables and buttons, the javascript wiring up
of the buttons and populating of the tables.

The LocalPatchApplier is able to retrieve the patch content from
the locally running pgarchives where the patch came from.

The Local "Burner" uses a directory on the server, combined with
the branch_id, to operate.  It is required that the directory exist,
and that a "template" subdirectory with a clone of the postgres
git repo exist within the directory.

The Notifier class is intended to be the integration point from
branch manager process to Patch and Queue.  It hasn't gotten
that much attention as of yet.  More will come with artifact
processing and integration with CirrusCI.

An initial attempt at re-implementing the patch application script
is done here.  The main difference is that it applies one named
file at a time.  My present dev environment cannot use --allow-empty
so the related code is commented out for the time being.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant