Skip to content

gitlab integration apis #468

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 5, 2024
Merged

gitlab integration apis #468

merged 3 commits into from
Jul 5, 2024

Conversation

adnanhashmi09
Copy link
Contributor

Linked Issue(s)

Closes #467

Proposed changes (including videos or screenshots)

This PR introduces the following 3 apis:

  • /orgs/<org_id>/integrations/gitlab/groups - Method: GET
  • /orgs/<org_id>/integrations/gitlab/user/repos - Method: GET
  • /orgs/<org_id>/integrations/gitlab/groups/<group_id>/repos - Method: GET

samad-yar-khan
samad-yar-khan previously approved these changes Jul 5, 2024
Comment on lines +112 to +122
gitlab_domain = (
integrations[0].provider_meta.get("custom_domain")
if integrations[0].provider_meta
else None
)

if not gitlab_domain:
LOG.warn(
f"Custom domain not found for intergration for org {org_id} and provider {UserIdentityProvider.GITLAB.value}"
)
return DEFAULT_DOMAIN
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would break for someone with github integration, and you are calling it irrespective of the provider

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Thanks :)

Comment on lines 137 to 150
if user_identity_provider == UserIdentityProvider.GITHUB:
return ExternalIntegrationsService(
org_id,
user_identity_provider,
_get_access_token(),
)

if user_identity_provider == UserIdentityProvider.GITLAB:
return ExternalIntegrationsService(
org_id,
user_identity_provider,
_get_access_token(),
_get_custom_gitlab_domain(),
)
Copy link
Contributor

@amoghjalan amoghjalan Jul 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if user_identity_provider == UserIdentityProvider.GITHUB:
return ExternalIntegrationsService(
org_id,
user_identity_provider,
_get_access_token(),
)
if user_identity_provider == UserIdentityProvider.GITLAB:
return ExternalIntegrationsService(
org_id,
user_identity_provider,
_get_access_token(),
_get_custom_gitlab_domain(),
)
custom_domain_name = None
if user_identity_provider == UserIdentityProvider.GITLAB:
custom_domain_name = _get_custom_gitlab_domain()
return ExternalIntegrationsService(
org_id,
user_identity_provider,
_get_access_token(),
custom_domain_name
)

Copy link
Contributor

@amoghjalan amoghjalan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@adnanhashmi09 adnanhashmi09 merged commit 56d1bc9 into main Jul 5, 2024
3 checks passed
@adnanhashmi09 adnanhashmi09 deleted the gitlab-repo-sync branch July 5, 2024 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement and APIs which will be called by the frontend
3 participants