in sagemaker_studio_image_build/cli.py [0:0]
def validate_args(args, extra_args):
# Validate args
if args.repository:
# Validate the repository isn't a invalid reference (For e.g. my-repo-name:1:3 fails)
if args.repository.count(":") > 1:
raise ValueError(
f'Error parsing reference: "{args.repository}" is not a valid repository/tag'
)
vpc_config = [args.vpc_id, args.subnet_ids, args.security_group_ids]
none_arg_count = sum(arg is None for arg in [args.vpc_id, args.subnet_ids, args.security_group_ids])
if none_arg_count > 0 and none_arg_count < 3:
raise ValueError(
'Invalid input of the VPC configuration. Please either provide all of the VPC arguments or none of them,'\
'in which case the CodeBuild Project, by default, will not run within a VPC.'
)
# Validate extra_args
for idx, extra_arg in enumerate(extra_args):
# Validate that the path to the Dockerfile is within the PWD.
if extra_args == "-f" or extra_arg == "--file" and idx + 1 < len(extra_args):
file_value = extra_args[idx + 1]
if not os.path.realpath(file_value).startswith(os.getcwd()):
raise ValueError(
f"The value of the -f/file argument [{file_value}] is outside the working directory [{os.getcwd()}]"
)