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

Warning if git is not installed #1414

Merged
merged 2 commits into from
Jan 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion flytekit/remote/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

from flyteidl.admin.signal_pb2 import Signal, SignalListRequest, SignalSetRequest
from flyteidl.core import literals_pb2 as literals_pb2
from git import Repo

from flytekit import Literal
from flytekit.clients.friendly import SynchronousFlyteClient
Expand Down Expand Up @@ -127,9 +126,14 @@ def _get_git_repo_url(source_path):
Get git repo URL from remote.origin.url
"""
try:
from git import Repo

return "github.com/" + Repo(source_path).remotes.origin.url.split(".git")[0].split(":")[-1]
except ImportError:
remote_logger.warning("Could not import git. is the git executable installed?")
except Exception:
# If the file isn't in the git repo, we can't get the url from git config
remote_logger.debug(f"{source_path} is not a git repo.")
return ""


Expand Down