def cli_build(args):
assert check_output(['docker', 'ps']), "Docker required."
build_types = args.build_types
git_url = args.git_clone_url
git_branch = args.git_clone_branch
cli_version = args.cli_version
artifact_dir = tempfile.mkdtemp(prefix='cli-build-{}-'.format(datetime.datetime.now().strftime('%Y-%m-%d-%H-%M-%S')), dir=os.getcwd())
if len(build_types) == 1 and build_types[0] == '*':
build_types = BUILD_TYPES
print_heading('Building for {} from branch {} of {} '
'and version number will be {}\n'
'Build artifacts will be in {}'.format(', '.join(build_types), git_branch, git_url, cli_version, artifact_dir))
from concurrent.futures import ThreadPoolExecutor, as_completed
with ThreadPoolExecutor(max_workers=len(build_types)) as executor:
tasks = {executor.submit(build_dispatch, bt, git_url, git_branch, cli_version, artifact_dir, arg_ns=args) for bt in build_types}
for t in as_completed(tasks):
t.result()
print('Done.')
评论列表
文章目录