Skip to content

Commit

Permalink
fix(buildx): parsing attestation on docker desktop (#4155)
Browse files Browse the repository at this point in the history
fix(attestation): update parsing for docker desktop

Signed-off-by: Aaron <[email protected]>
  • Loading branch information
aarnphm authored Aug 29, 2023
1 parent 1b80859 commit 7a83d99
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/bentoml/_internal/container/buildx.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,19 @@ def health() -> bool:


def supports_attestation() -> bool:
return parse(
subprocess.check_output([find_binary(), "buildx", "version"])
.decode("utf-8")
.strip()
.split()[1]
) > parse("0.10.0")
try:
client = find_binary()
if client is None:
return False
outputs: str = (
subprocess.check_output([client, "buildx", "version"])
.decode("utf-8")
.strip()
.split()[1]
)
return parse(outputs.split("-")[0]) > parse("0.10.0")
except subprocess.CalledProcessError:
return False


def parse_dict_opt(d: dict[str, str]) -> str:
Expand Down

0 comments on commit 7a83d99

Please sign in to comment.