Fix applying tags in local development (#1939)

This commit is contained in:
Ayaz Salikhov
2023-07-07 17:44:42 +04:00
committed by GitHub
parent 4f92f2c651
commit 3d1dfb0453
3 changed files with 13 additions and 6 deletions

View File

@@ -7,6 +7,8 @@ from pathlib import Path
import plumbum
from tagging.get_platform import unify_aarch64
docker = plumbum.local["docker"]
LOGGER = logging.getLogger(__name__)
@@ -55,7 +57,7 @@ if __name__ == "__main__":
"--platform",
required=True,
type=str,
choices=["x86_64", "aarch64"],
choices=["x86_64", "aarch64", "arm64"],
help="Image platform",
)
arg_parser.add_argument(
@@ -64,5 +66,6 @@ if __name__ == "__main__":
help="Owner of the image",
)
args = arg_parser.parse_args()
args.platform = unify_aarch64(args.platform)
apply_tags(args.short_image_name, args.owner, args.tags_dir, args.platform)

View File

@@ -5,10 +5,14 @@ import platform
ALL_PLATFORMS = {"x86_64", "aarch64"}
def get_platform() -> str:
machine = platform.machine()
def unify_aarch64(platform: str) -> str:
return {
"aarch64": "aarch64",
"arm64": "aarch64", # To support local building on aarch64 Macs
"x86_64": "x86_64",
}[machine]
}[platform]
def get_platform() -> str:
machine = platform.machine()
return unify_aarch64(machine)