minder icon indicating copy to clipboard operation
minder copied to clipboard

Add a ReconcileEntityRegistration method to the Providers API and a reconcile repository implementation to the GitHub App

Open jhrozek opened this issue 1 year ago • 0 comments

In order to trigger repository reconciliation to either cover the case where we miss a webhook or after the initial enablement of the auto-enrollment we need a way to tell the provider to reconcile the auto-registered repositories with the upstream repositories.

To do that, we'd extend the providers API with an ReconcileEntityRegistration method exposed as an RPC. The Github app provider would implement it to reconcile repositories.

The RPC might look like this:

rpc ReconcileEntityRegistration (ReconcileEntityRegistrationRequest) returns (ReconcileEntityRegistrationResponse) {
        option (google.api.http) = {
            post: "/api/v1/repository/provider/{provider}/register_all"
            additional_bindings {
                post: "/api/v1/repository/register_all",
                body: "*"
            }
            body: "*"
        };

        option (rpc_options) = {
            target_resource: TARGET_RESOURCE_PROJECT
	     // TODO: ensure that we either have per-entity APIs or we have a relation that allows any entity
            relation: RELATION_REPO_CREATE
        };
    }

message ReconcileEntityRegistrationRequest {
    Context context = 1;
    Entity entity = 2; // reconcile this entity type only
}

message RegisterRepositoryResponse {
	// empty by design
}

jhrozek avatar May 07 '24 15:05 jhrozek