Skip to content
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

fix(ingest): support git clone of non-github repos #7065

Merged
merged 3 commits into from
Jan 18, 2023

Conversation

hsheth2
Copy link
Collaborator

@hsheth2 hsheth2 commented Jan 18, 2023

Checklist

  • The PR conforms to DataHub's Contributing Guideline (particularly Commit Message Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable). If a new feature has been added a Usage Guide has been added for the same.
  • For any breaking change/potential downtime/deprecation/big changes an entry has been made in Updating DataHub

@github-actions github-actions bot added the ingestion PR or Issue related to the ingestion of metadata label Jan 18, 2023
if repo.startswith(_GITHUB_PREFIX):
return f"[email protected]:{repo[len(_GITHUB_PREFIX):]}.git"
elif repo.startswith(_GITLAB_PREFIX):
return f"[email protected]:{repo[len(_GITLAB_PREFIX):]}.git"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice - this is really awesome!! I was hoping we'd be able to generalize this

config.get_url_for_file_path(
"cmd/admin.go"
) == "https://gitea.com/gitea/tea/src/branch/main/cmd/admin.go"
config.repo_ssh_locator == "https://gitea.com/gitea/tea.git"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Awesome tests!

)
branch: str = Field(
"main",
description="Branch on which your files live by default. Typically main or master. This can also be a commit hash.",
)
base_url: str = Field(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are we safe to remove this? Do we want to have any mapping?

def simplify_repo_url(cls, repo: str) -> str:
if repo.startswith("github.com/"):
repo = f"https://{repo}"
elif repo.startswith("gitlab.com"):
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we want any trailing slash like github case

elif repo.startswith("gitlab.com"):
repo = f"https://{repo}"
elif repo.count("/") == 1:
repo = f"https://github.com/{repo}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

defaults to github?

Copy link
Collaborator

@jjoyce0510 jjoyce0510 left a comment

Choose a reason for hiding this comment

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

Overall this looks great. Only concern is compatibility. What do you think?

@hsheth2 hsheth2 merged commit d7aa612 into datahub-project:master Jan 18, 2023
@hsheth2 hsheth2 deleted the git-clone-other-providers branch January 18, 2023 21:30
ericyomi pushed a commit to ericyomi/datahub that referenced this pull request Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ingestion PR or Issue related to the ingestion of metadata
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants