示例#1
0
def pai_build():

    if len(sys.argv) < 2:
        pai_build_info()
        return

    option = sys.argv[1]
    del sys.argv[1]

    if option not in ["build", "push"]:
        pai_build_info()
        return

    parser = argparse.ArgumentParser()
    parser.add_argument('-p', '--config-path', dest = "config_path", required=True, help="The path of your configuration directory.")
    parser.add_argument('-n', '--image-name', dest = "image_name", default='all', help="Build and push the target image to the registry")
    args = parser.parse_args(sys.argv[1:])

    config_path = args.config_path
    image_name = args.image_name
    cluster_object_model = load_cluster_objectModel_service(config_path)

    image_list = None
    if image_name != "all":
        image_list = [ image_name ]

    if option == "build":
        center = build_center.build_center(cluster_object_model, image_list)
        center.run()

    if option == "push":
        center = push_center.push_center(cluster_object_model, image_list)
        center.run()
示例#2
0
文件: paictl.py 项目: yds05/pai
    def image_push(self, args):
        cluster_object_model, image_list = self.process_args(args)

        center = push_center.push_center(cluster_object_model, image_list)
        center.run()