MINOR: Fix Looker clone repo failure for bitbucket (#15590)

* MINOR: Fix Looker clone repo failure for bitbucket

* pyformat
This commit is contained in:
Mayur Singal 2024-03-16 20:14:14 +05:30 committed by GitHub
parent 4db9b775ea
commit 104b41cfd2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -54,14 +54,16 @@ def _clone_repo(
return return
url = None url = None
allow_unsafe_protocols = False
if isinstance(credential, GitHubCredentials): if isinstance(credential, GitHubCredentials):
url = f"https://x-oauth-basic:{credential.token.__root__.get_secret_value()}@github.com/{repo_name}.git" url = f"https://x-oauth-basic:{credential.token.__root__.get_secret_value()}@github.com/{repo_name}.git"
elif isinstance(credential, BitBucketCredentials): elif isinstance(credential, BitBucketCredentials):
url = f"https://x-token-auth::{credential.token.__root__.get_secret_value()}@bitbucket.or/{repo_name}.git" url = f"https://x-token-auth::{credential.token.__root__.get_secret_value()}@bitbucket.or/{repo_name}.git"
allow_unsafe_protocols = True
assert url is not None assert url is not None
Repo.clone_from(url, path) Repo.clone_from(url, path, allow_unsafe_protocols=allow_unsafe_protocols)
logger.info(f"repo {repo_name} cloned to {path}") logger.info(f"repo {repo_name} cloned to {path}")
except Exception as exc: except Exception as exc: