OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

[Feat]: Support Gitlab PAT

Open malhotra5 opened this issue 10 months ago • 6 comments

  • [ ] This change is worth documenting at https://docs.all-hands.dev/
  • [ ] Include this change in the Release Notes. If checked, you must provide an end-user friendly description for your change below

End-user friendly description of the problem this fixes or functionality that this introduces.


Give a summary of what the PR does, explaining any non-trivial design decisions.

This PR is part 1 of adding support for Gitlab PAT in Openhands

  1. Added a GitLabService class similar to GitHubService class; this is responsible for interacting with GitLab APIs
  2. Made an util that will determine which provider the token is from, and use the appropriate service class
  3. Changed the typing from GithubUser, GithubRepository, etc to User, Repository, etc to share types with Github and GitLab service classes

Expected functionality of this PR -

  1. You cannot use GitLab PAT yet; this PR is just to build the scaffolding on which we can support GitLab more easily (keeping PRs small for review purposes)
  2. The GitHub PAT should behave as expected

Future PRs -

  1. Add FE logic/UI for GitLab token
  2. Add methods to ProviderHandler to paginate/combine results across all configured providers

Link of any specific issues this addresses. #7080


To run this PR locally, use the following command:

docker run -it --rm   -p 3000:3000   -v /var/run/docker.sock:/var/run/docker.sock   --add-host host.docker.internal:host-gateway   -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:1f211a3-nikolaik   --name openhands-app-1f211a3   docker.all-hands.dev/all-hands-ai/openhands:1f211a3

malhotra5 avatar Mar 02 '25 23:03 malhotra5

@openhands please fix the failing python unit tests

malhotra5 avatar Mar 03 '25 16:03 malhotra5

I'm working on a fix! @malhotra5 can track my progress at all-hands.dev

openhands-ai[bot] avatar Mar 03 '25 16:03 openhands-ai[bot]

@answer-huang this PR is only abstracting code (particularly in how we pass around tokens that are set in the FE) to support GitLab later. This PR does not support viewing repositories or starting agent jobs with GitLab provider (yet).

malhotra5 avatar Mar 11 '25 17:03 malhotra5

@answer-huang this PR is only abstracting code (particularly in how we pass around tokens that are set in the FE) to support GitLab later. This PR does not support viewing repositories or starting agent jobs with GitLab provider (yet).

@malhotra5 OK, I recently made some changes to support gitlab, ready to integrate it into the company's internal system, and I would love to work together to improve this feature.🤓

answer-huang avatar Mar 11 '25 17:03 answer-huang

Awesome! Feel free to open a PR, would love to take a look whenever you're ready

That being said I think there's likely a good amount of overlap between your work and the PRs that are already open for GitLab support, so let's chat more on the Openhands slack under #eng-integrations to see how we can collab more effectively

malhotra5 avatar Mar 11 '25 17:03 malhotra5

Awesome! Feel free to open a PR, would love to take a look whenever you're ready

That being said I think there's likely a good amount of overlap between your work and the PRs that are already open for GitLab support, so let's chat more on the Openhands slack under #eng-integrations to see how we can collab more effectively

@malhotra5 Yes, the implementation idea is basically the same. Our most important changes are support for SSO login and support for SAAS.

answer-huang avatar Mar 11 '25 17:03 answer-huang