Skip to content

Commit 33c1dd8

Browse files
committed
fix arch mismatch?
1 parent 169ffc9 commit 33c1dd8

1 file changed

Lines changed: 7 additions & 18 deletions

File tree

tests/scripts/check_container_packages.py

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -59,29 +59,18 @@
5959
cmd = systems[image["system"]]["cmd"]
6060
tag = f"{args.tag}{image['tag_suffix']}"
6161
full_tag = f"{image['image']}:{tag}"
62+
logger.debug(f"Pulling image {full_tag} for platform {platform}")
6263
try:
63-
i = client.images.get(full_tag)
64-
## check if the image is for the correct platform
65-
image_platform = f"{i.attrs.get('Os', '')}/{i.attrs.get('Architecture', '')}"
66-
if platform != image_platform:
67-
raise docker.errors.ImageNotFound(
68-
f"Image {full_tag} is not for platform {platform}, found {image_platform}"
69-
)
70-
except docker.errors.ImageNotFound:
71-
## pull the image
72-
logger.debug(f"Pulling image {full_tag} for platform {platform}")
73-
try:
74-
client.images.remove(full_tag, force=True)
75-
except Exception:
76-
pass
77-
i = client.images.pull(repository=image_name, tag=tag, platform=platform)
78-
logger.debug(f"Image {i.id} pulled successfully")
64+
client.api.pull(repository=image_name, tag=tag, platform=platform)
65+
logger.debug(f"Image {full_tag} for platform {platform} pulled successfully")
66+
except Exception as e:
67+
logger.debug(f"Pull attempt error: {e}")
7968
for package in image["packages"]:
8069
command = f"{cmd} {package['name']}"
8170
output = ""
8271
try:
8372
output = client.containers.run(
84-
i.id,
73+
full_tag,
8574
command,
8675
entrypoint="",
8776
platform=platform,
@@ -91,7 +80,7 @@
9180
except (docker.errors.ContainerError, docker.errors.NotFound) as e:
9281
logger.debug(f"{e}, retrying")
9382
output = client.containers.run(
94-
i.id,
83+
full_tag,
9584
command,
9685
entrypoint="",
9786
platform=platform,

0 commit comments

Comments
 (0)