Bazel: accept new SSH keys in git_lfs_probe.py

This commit is contained in:
Paolo Tranquilli
2024-05-17 16:39:18 +01:00
parent 170e2231d4
commit d01d657f89

View File

@@ -22,6 +22,7 @@ from dataclasses import dataclass
from typing import Dict
import argparse
def options():
p = argparse.ArgumentParser(description=__doc__)
p.add_argument("--hash-only", action="store_true")
@@ -69,7 +70,12 @@ def get_endpoint():
server, _, path = ssh_endpoint.partition(":")
ssh_command = shutil.which(os.environ.get("GIT_SSH", os.environ.get("GIT_SSH_COMMAND", "ssh")))
assert ssh_command, "no ssh command found"
resp = json.loads(subprocess.check_output([ssh_command, server, "git-lfs-authenticate", path, "download"]))
resp = json.loads(subprocess.check_output([ssh_command,
"-oStrictHostKeyChecking=accept-new",
server,
"git-lfs-authenticate",
path,
"download"]))
endpoint.href = resp.get("href", endpoint)
endpoint.update_headers(resp.get("header", {}))
url = urlparse(endpoint.href)