vd-rd opened a new pull request, #11791: URL: https://github.com/apache/nifi/pull/11791
<!-- Licensed to the Apache Software Foundation (ASF) under one or more --> <!-- contributor license agreements. See the NOTICE file distributed with --> <!-- this work for additional information regarding copyright ownership. --> <!-- The ASF licenses this file to You under the Apache License, Version 2.0 --> <!-- (the "License"); you may not use this file except in compliance with --> <!-- the License. You may obtain a copy of the License at --> <!-- http://www.apache.org/licenses/LICENSE-2.0 --> <!-- Unless required by applicable law or agreed to in writing, software --> <!-- distributed under the License is distributed on an "AS IS" BASIS, --> <!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --> <!-- See the License for the specific language governing permissions and --> <!-- limitations under the License. --> # Summary [NIFI-16441](https://issues.apache.org/jira/browse/NIFI-16441) This pull request adds `GiteaFlowRegistryClient`, a Flow Registry Client for Gitea built on `AbstractGitFlowRegistryClient`. Forgejo instances, including Codeberg, provide the same REST API, so the client works with them as well. This contribution was co-generated with Claude Code (claude-opus-5-5). I reviewed and tested the changes and take responsibility for them. The client follows the Bitbucket and Azure DevOps clients. It uses the Gitea REST API (`/api/v1`) through `WebClientServiceProvider`, `HttpUriBuilder` and Jackson, with no additional dependencies. It authenticates with an Access Token. A new `nifi-gitea-bundle` contains the extension and the NAR, and the NAR is added to `nifi-assembly`. The NAR includes LICENSE and NOTICE files for the Jakarta Activation and XML Binding APIs (EDL 1.0), which are bundled through `nifi-git-flow-registry`. - Properties: Web Client Service, Gitea API URL (context paths supported, for example `https://example.com/gitea`), Repository Owner, Repository Name, Access Token. These are in addition to the common git registry properties. - Read and write access come from the repository permissions. Archived repositories and pull mirrors are read-only. - Updates and deletes send the current blob SHA. The server rejects a stale SHA, so concurrent commits cannot overwrite each other. Gitea returns HTTP 422 for that case and Forgejo returns HTTP 409, and both are reported as a version conflict. - At most the last 50 commits are retrieved for a given flow to limit API calls. This is similar to the GitHub and GitLab clients and is noted in the capability description. - Listing buckets on a branch that does not exist fails, so configuration verification reports the missing branch. Empty repositories still list no buckets, so the default bucket can be created. - Branch creation uses `old_ref_name` and supports both a commit SHA and a branch name. - Branch and bucket names containing `&` or `+` are not supported, because `HttpUriBuilder` does not encode those characters in query parameters. The Bitbucket and Azure DevOps clients have the same limitation. - OAuth2 is not included. The Gitea and Forgejo authorization servers support only the `authorization_code` and `refresh_token` grants. Forgejo invalidates refresh tokens after use by default, which does not work with the current refresh token handling in `StandardOauth2AccessTokenProvider`. Testing: - Unit tests use MockWebServer with `StandardWebClientService` and `StandardHttpUriBuilder`. - Integration tests ran outside this PR against Gitea 1.20.6, 1.21.11, 1.22.6 and 1.27.3, and against Forgejo 11.0.16 and 16.0.5. They covered: - empty repositories - repository paths - more than 100 commits for a single flow - stale SHA conflicts - application user commit authors - branch creation from a commit - deletion - read-only tokens - End-to-end testing ran on NiFi 2.12.0 with the client built for 2.12.0, against Gitea 1.27. It covered configuration verification, starting version control, committing changes, version history, changing versions, and importing a flow into another Process Group. # Tracking Please complete the following tracking steps prior to pull request creation. ### Issue Tracking - [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue created ### Pull Request Tracking - Pull Request title starts with Apache NiFi Jira issue number, such as `NIFI-00000` - Pull Request commit message starts with Apache NiFi Jira issue number, as such `NIFI-00000` - Pull request contains [commits signed](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits) with a registered key indicating `Verified` status ### Pull Request Formatting - Pull Request based on current revision of the `main` branch - Pull Request refers to a feature branch with one commit containing changes # Verification Please indicate the verification steps performed prior to pull request creation. ### Build - [ ] Build completed using `./mvnw clean install -P contrib-check` - [ ] JDK 21 - [ ] JDK 25 `./mvnw clean install -P contrib-check` passed for the new modules (`nifi-gitea-bundle`, `nifi-gitea-extensions`, `nifi-gitea-nar`) on JDK 21 and JDK 25. A full repository build was not completed locally, so these boxes are left for the CI workflows. ### Licensing - [x] New dependencies are compatible with the [Apache License 2.0](https://apache.org/licenses/LICENSE-2.0) according to the [License Policy](https://www.apache.org/legal/resolved.html) - [x] New dependencies are documented in applicable `LICENSE` and `NOTICE` files No new third-party dependencies are added to the project. The NAR bundles the Jakarta Activation and XML Binding APIs (EDL 1.0) through `nifi-git-flow-registry`, as the other git registry client NARs do. They are listed in the NAR LICENSE and NOTICE files. ### Documentation - [ ] Documentation formatting appears as expected in rendered files Claude code was used to generate some of the code here. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
