Skip to content

Commit 3d1dfb0

Browse files
authored
Fix applying tags in local development (#1939)
1 parent 4f92f2c commit 3d1dfb0

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ linkcheck-docs: ## check broken links
6969

7070
hook/%: ## run post-build hooks for an image
7171
python3 -m tagging.write_tags_file --short-image-name "$(notdir $@)" --tags-dir /tmp/jupyter/tags/ --owner "$(OWNER)" && \
72-
python3 -m tagging.apply_tags --short-image-name "$(notdir $@)" --tags-dir /tmp/jupyter/tags/ --platform "$(shell uname -m)" --owner "$(OWNER)" && \
73-
python3 -m tagging.write_manifest --short-image-name "$(notdir $@)" --hist-line-dir /tmp/jupyter/hist_lines/ --manifest-dir /tmp/jupyter/manifests/ --owner "$(OWNER)"
72+
python3 -m tagging.write_manifest --short-image-name "$(notdir $@)" --hist-line-dir /tmp/jupyter/hist_lines/ --manifest-dir /tmp/jupyter/manifests/ --owner "$(OWNER)" && \
73+
python3 -m tagging.apply_tags --short-image-name "$(notdir $@)" --tags-dir /tmp/jupyter/tags/ --platform "$(shell uname -m)" --owner "$(OWNER)"
7474
hook-all: $(foreach I, $(ALL_IMAGES), hook/$(I)) ## run post-build hooks for all images
7575

7676

tagging/apply_tags.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
import plumbum
99

10+
from tagging.get_platform import unify_aarch64
11+
1012
docker = plumbum.local["docker"]
1113

1214
LOGGER = logging.getLogger(__name__)
@@ -55,7 +57,7 @@ def apply_tags(
5557
"--platform",
5658
required=True,
5759
type=str,
58-
choices=["x86_64", "aarch64"],
60+
choices=["x86_64", "aarch64", "arm64"],
5961
help="Image platform",
6062
)
6163
arg_parser.add_argument(
@@ -64,5 +66,6 @@ def apply_tags(
6466
help="Owner of the image",
6567
)
6668
args = arg_parser.parse_args()
69+
args.platform = unify_aarch64(args.platform)
6770

6871
apply_tags(args.short_image_name, args.owner, args.tags_dir, args.platform)

tagging/get_platform.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@
55
ALL_PLATFORMS = {"x86_64", "aarch64"}
66

77

8-
def get_platform() -> str:
9-
machine = platform.machine()
8+
def unify_aarch64(platform: str) -> str:
109
return {
1110
"aarch64": "aarch64",
1211
"arm64": "aarch64", # To support local building on aarch64 Macs
1312
"x86_64": "x86_64",
14-
}[machine]
13+
}[platform]
14+
15+
16+
def get_platform() -> str:
17+
machine = platform.machine()
18+
return unify_aarch64(machine)

0 commit comments

Comments
 (0)