def execute_build_image(python_version, base_image_version): check.str_param(python_version, 'python_version') check.str_param(base_image_version, 'base_image_version') os.chdir(os.path.dirname(os.path.abspath(__file__))) builder_image = local_unit_snapshot_builder_image(python_version, base_image_version) docker_args = {'BASE_IMAGE': unit_base_image(python_version)} execute_docker_build(image=builder_image, docker_args=docker_args) root = git_repo_root() target_reqs_path = os.path.join( root, '.buildkite', 'images', 'unit', 'snapshot-reqs-{python_version}.txt'.format( python_version=python_version), ) # e.g. # docker run snapshot-builder pip freeze --exclude-editable check.invariant( os.system( 'docker run {builder_image} pip freeze --exclude-editable > {reqs}' .format(builder_image=builder_image, reqs=target_reqs_path)) == 0)
def execute_image_build(python_version, image_version): # always set cwd to the directory where the file lives os.chdir(os.path.dirname(os.path.abspath(__file__))) docker_args = { 'BASE_IMAGE': unit_base_image(python_version), 'PYTHON_VERSION': python_version, } local_image = local_unit_image(python_version=python_version, image_version=image_version) execute_docker_build(local_image, docker_args)
def execute_build_integration_image(python_version, image_version, base_integration_version): check.str_param(python_version, 'python_version') check.str_param(image_version, 'image_version') docker_args = { 'BASE_IMAGE': aws_integration_base_image(get_aws_account_id(), python_version, base_integration_version), 'PYTHON_VERSION': python_version, } local_image = local_integration_image(python_version=python_version, image_version=image_version) execute_docker_build(local_image, docker_args)
def execute_build_integration_image(python_version, image_version): check.str_param(python_version, 'python_version') check.str_param(image_version, 'image_version') ver = version.parse(python_version) major, minor, _dot = ver.release debian_version = 'buster' if major == 3 and minor == 8 else 'stretch' docker_args = { 'DEBIAN_VERSION': debian_version, 'PYTHON_VERSION': python_version, 'PYTHON_MAJOR_VERSION': str(major), } execute_docker_build( image=local_integration_base_image(python_version=python_version, image_version=image_version), docker_args=docker_args, )