nipyapi icon indicating copy to clipboard operation
nipyapi copied to clipboard

Gitlab and Github registry client missing!

Open marcelo225 opened this issue 9 months ago • 3 comments

Hi!

In Apache NiFi version 2.2.0, I found these new registry clients in addition to NifiRegistryFlowRegistryClient:

Image

https://nipyapi.readthedocs.io/en/latest/nipyapi-docs/nipyapi.html#nipyapi.versioning.create_registry_client

The create_registry_client function only returns a FlowRegistryClientEntity object, but GitHubFlowRegistryClient and GitLabFlowRegistryClient expect a different object type.

The GitLabFlowRegistryClient registry client was created by NIFI WEB UI and the second one was created by NIPYAPI, acording de following images:

Image

By Nifi Web UI Image

By Nipyapi Image

How can I work around this issue?

Thanks!

marcelo225 avatar Feb 08 '25 09:02 marcelo225

Hi @marcelo225 - NiPy is currently built on the NiFi-1.27 API spec, and while that has some forward compatibility with the 2.x API spec, I haven't yet had the time to do the necessary refactoring to fully move to 2.x as there are a significant breaking changes in the OAS version used.

I do hope to get to it over the next month or so.

Chaffelson avatar Feb 08 '25 11:02 Chaffelson

@Chaffelson, thanks for your reply!

marcelo225 avatar Feb 08 '25 15:02 marcelo225

For anyone else landing here, here's a code snippet I just used successfully with NiFi 2.2.0. It's a workaround until create_registry_client is extended:

organization = "myorg"
repository = "myrepo"
branch = "mybranch"
version = "commit_or_branch_or_tag"
directory = "my/directory"
flow_name = "myflow"

# Register client
github_client = nipyapi.nifi.ControllerApi().create_flow_registry_client(
    body={
        "revision": {"version": 0},
        "component": {
            "name": "GitHubFlowRegistryClient",
            "type": "org.apache.nifi.github.GitHubFlowRegistryClient",
            "properties": {
                "Repository Owner": organization,
                "Repository Name": repository,
            },
            "bundle": {
                "group": "org.apache.nifi",
                "artifact": "nifi-github-nar",
                "version": "2.2.0",
            },
        },
    }
)

# Restore a process group
pg_id = get_root_pg_id()

nipyapi.nifi.ProcessGroupsApi().create_process_group(
    id = pg_id,
    body = {
        "revision": { "version": 0 },
        "component": {
            "position": { "x": 0, "y": 0 },
            "versionControlInformation": {
                "registryId": github_client.component.id,
                "flowId": flow_name,
                "bucketId": directory,
                "branch": branch,
                "version": version,
            },
        },
    },
)

dervoeti avatar Mar 12 '25 21:03 dervoeti

Apologies I should've updated this with the NiPyAPI 1.0 release - this should be resolved now if you move to ver1, as it supports NiFi v2.x, including the new git* clients.

Chaffelson avatar Nov 05 '25 09:11 Chaffelson