Honor DOCKER_DEFAULT_PLATFORM
All checks were successful
Lint Checks / Run linter (pull_request) Successful in 39s
Deploy Test / Run deploy test suite (pull_request) Successful in 6m1s
Webapp Test / Run webapp test suite (pull_request) Successful in 5m33s
K8s Deployment Control Test / Run deployment control suite on kind/k8s (pull_request) Successful in 7m39s
K8s Deploy Test / Run deploy test suite on kind/k8s (pull_request) Successful in 9m0s
Smoke Test / Run basic test suite (pull_request) Successful in 4m16s

This commit is contained in:
Thomas E Lackey 2024-08-29 14:57:35 -05:00
parent f1fdc48aaa
commit 4e5b5ff031

View File

@ -14,6 +14,7 @@
# along with this program. If not, see <http:#www.gnu.org/licenses/>. # along with this program. If not, see <http:#www.gnu.org/licenses/>.
import click import click
import os
from dataclasses import dataclass from dataclasses import dataclass
import json import json
import platform import platform
@ -84,13 +85,18 @@ def _filter_for_platform(container: str,
tag_list: List[str]) -> List[str] : tag_list: List[str]) -> List[str] :
filtered_tags = [] filtered_tags = []
this_machine = platform.machine() this_machine = platform.machine()
# Translate between Python and docker platform names if "DOCKER_DEFAULT_PLATFORM" in os.environ:
if this_machine == "x86_64": this_machine = os.environ["DOCKER_DEFAULT_PLATFORM"].split("/")[-1]
this_machine = "amd64" if opts.o.debug:
if this_machine == "aarch64": print(f"DOCKER_DEFAULT_PLATFORM says the architecture is: {this_machine}")
this_machine = "arm64" else:
if opts.o.debug: # Translate between Python and docker platform names
print(f"Python says the architecture is: {this_machine}") if this_machine == "x86_64":
this_machine = "amd64"
if this_machine == "aarch64":
this_machine = "arm64"
if opts.o.debug:
print(f"Python says the architecture is: {this_machine}")
docker = DockerClient() docker = DockerClient()
for tag in tag_list: for tag in tag_list:
remote_tag = f"{registry_info.registry}/{container}:{tag}" remote_tag = f"{registry_info.registry}/{container}:{tag}"