Adarshvk98 opened a new pull request, #3132: URL: https://github.com/apache/incubator-kie-tools/pull/3132
Closes [issue #11](https://github.com/apache/incubator-kie-issues/issues/11) ## Overview This PR introduces support for GitLab's structure and features within our KIE Sandbox. - Aligning with GitLab’s concepts of Groups, Projects, and Snippets, this implementation maps similar functionality using Groups and Projects, although GitLab doesn’t use the term “organization” like GitHub or Bitbucket. - The REST API endpoints themselves are consistent across GitLab’s three offerings: **GitLab.com**, **GitLab Self-Managed**, and **GitLab Dedicated**. Therefore, there is an assumption that it will work across private instances. - There is no officially maintained GitLab client, so a simple fetch client was implemented as part of this [Reference material for the REST API](https://docs.gitlab.com/api/rest/) --- ## Key Features Implemented ### 1. Authentication - Added support for authentication using **[Personal Access Tokens (PAT)](https://docs.gitlab.com/user/profile/personal_access_tokens/#create-a-personal-access-token)** to securely interact with GitLab APIs. - While creating a Personal Access Token, need to add the following scopes: `api`, `read_user`, `read_repository`, and `write_repository`. ### 2. Clone & Import Repository from URL - **Clone Project Repository:** Support cloning entire projects via URL. eg: `https://<domain>/<group>/<project>.git` - **Clone Specific Branch/Ref:** Ability to clone a specific branch or reference from a project. eg: `https://<domain>/<group>/<project>/-/tree/<branch>` - **Import File from Branch:** Import individual files directly from a specified branch in the repository. eg: `https://<domain>/<group>/<project>/-/blob/<branch>/<file-path>` - **User-Specific Project Support:** Cloning and importing also supported for user-specific projects. eg: `https://<domain>/<user-id>/<project>.git` ### 3. Clone & Import Snippet from URL - **Clone Standalone User-Specific Snippet:** Clone snippets that belong to an individual user outside any project context. eg: `https://<domain>/snippets/<snippet-id>.git` - **Import Standalone User-Specific Snippet File:** Import snippet files directly by URL. eg: `https://<domain>/snippets/<snippet-id>/raw/main/<file-name>` - **Clone Project Snippet:** Clone snippets associated with a specific project group. eg: `https://<domain>/<group>/<project>/-/snippets/<snippet-id>.git` - **Import Project Snippet File:** Import snippet files belonging to a project snippet by direct URL access. eg: `https://<domain>/<group>/<project>/-/snippets/<snippet-id>/raw/main/<file-name>` ### 4. Create Repository & Snippets - **Create Repository From Workspace:** - Lists groups under the dropdown for selection. - Supports creating repositories under user scope, group scope, or subgroup scope as selectable options. - **Create Snippet From Workspace:** - Lists projects under the dropdown for selection. - Supports creating snippets either under user scope or project scope. ### 5. Update GitLab Snippets - Enabled updating existing snippets only if the current authenticated user is the owner of the snippet (verified ownership before enabling update). --- ### Issue Observed To connect to gitlab.com, it is observed that need to disable TLS certificate verification to get a successful response from Git operations like ref-check, clone, push, and pull. However, it’s unclear how to resolve this issue since disabling TLS certificate verification would introduce security concerns. One possible solution is to send the `accept-encoding: “identity”` header from KIE Sandbox itself for GitLab authentication sessions. However it's not clear whether this is the right way to approach it. - **WIP** -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
