def _delete_ecr_images()

in blogs/ecs-canary-deployments-pipeline/setup/scripts/delete_blog_contents.py [0:0]


def _delete_ecr_images(apps):
    """ Delete the ECR Images built by individual apps. """

    for app in apps:
        try:
            ECR_CLIENT.delete_repository(
                repositoryName=app,
                force=True
            )
            print("Deleted the ECR Repository: {} successfully.".format(app))
        except ClientError as ex:
            if ex.response['Error']['Code'] == 'RepositoryNotFoundException':
                print("Repository: {} is not found, no action needed".format(app))
                continue
            else:
                raise ex
    return True