Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[v1.9.x] Fix aarch64 cd pipeline #20783

Merged
merged 5 commits into from
Dec 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions ci/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import shutil
import signal
import subprocess
from platform import machine
from itertools import chain
from subprocess import check_call, check_output
from typing import *
Expand All @@ -46,7 +47,7 @@
DOCKER_COMPOSE_FILES = set(['docker/build.centos7'])

# keywords to identify arm-based dockerfiles
AARCH_FILE_KEYWORDS = ['armv', 'aarch64']
AARCH_FILE_KEYWORDS = ['aarch64']

def get_dockerfiles_path():
return "docker"
Expand All @@ -60,15 +61,15 @@ def get_docker_compose_platforms(path: str = get_dockerfiles_path()):
return platforms


def get_platforms(path: str = get_dockerfiles_path(), arch='x86') -> List[str]:
def get_platforms(path: str = get_dockerfiles_path(), arch=machine()) -> List[str]:
"""Get a list of platforms given our dockerfiles"""
dockerfiles = glob.glob(os.path.join(path, "Dockerfile.*"))
dockerfiles = set(filter(lambda x: x[-1] != '~', dockerfiles))
files = set(map(lambda x: re.sub(r"Dockerfile.(.*)", r"\1", x), dockerfiles))
files = files - DOCKER_COMPOSE_FILES
files.update(["build."+x for x in get_docker_compose_platforms()])
arm_files = set(filter(lambda x: any(y in x for y in AARCH_FILE_KEYWORDS), files))
if arch == 'x86':
if arch == 'x86_64':
files = files - arm_files
elif arch == 'aarch64':
files = arm_files
Expand Down Expand Up @@ -300,7 +301,7 @@ def docker_run_cmd(cmd):
return 0


def list_platforms(arch='x86') -> str:
def list_platforms(arch=machine()) -> str:
return "\nSupported platforms:\n{}".format('\n'.join(get_platforms(arch=arch)))


Expand Down Expand Up @@ -357,8 +358,8 @@ def main() -> int:
type=str)

parser.add_argument("-A", "--architecture",
help="Architecture of images to build (x86 or aarch64). Default is x86.",
default='x86',
help="Architecture of images to build (x86_64 or aarch64). Default is current machine type.",
default=machine(),
dest='architecture')

parser.add_argument("-b", "--build-only",
Expand Down
1 change: 1 addition & 0 deletions ci/docker/install/requirements_aarch64
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ astroid==2.3.3 # pylint and astroid need to be aligned
requests<2.19.0,>=2.18.4
setuptools
coverage
wheel
3 changes: 2 additions & 1 deletion ci/docker_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import subprocess
import re
import sys
from platform import machine
from typing import *

import build as build_util
Expand Down Expand Up @@ -225,7 +226,7 @@ def script_name() -> str:

args = parser.parse_args()

platforms = build_util.get_platforms()
platforms = build_util.get_platforms(arch=machine())

if "dkr.ecr" in args.docker_registry:
_ecr_login(args.docker_registry)
Expand Down