UCS 应用程序构建器 CLI

UCS 应用程序构建器 CLI 工具可用于创建和构建应用程序。它可用于列出和查看有关可用微服务的信息,并执行一些 NGC 存储库操作。

该工具名为 ucf_app_builder_cli

基本操作

查看帮助

$ ucf_app_builder_cli -h
usage: ucf_app_builder_cli [-h] [-v] [-va]  ...

positional arguments:

    app               Perform actions on apps
    service           Perform actions on a microservice
    registry          Perform actions on registry

optional arguments:
  -h, --help          show this help message and exit
  -v, --version       Print MS Builder Version
  -va, --version-all  Print all versions

检查工具版本

$ ucf_app_builder_cli -v
Version:
        App Builder : v2.5.0
$ ucf_app_builder_cli --version-all
Versions:
        App Builder: v2.5.0
        UCF MS Spec: v2.5.0

应用程序命令 app

应用程序命令 app 可用于创建和构建应用程序。

$ ucf_app_builder_cli app -h
usage: ucf_app_builder_cli app [-h]  ...

positional arguments:

    create     Create UCF application graph boilerplate
    build      Build application from graph file and export to helm chart
    export-ms  Create a microservice from the application

optional arguments:
  -h, --help  show this help message and exit

创建应用程序样板

ucf_app_builder_cli app create [-h] [-o OUTPUT_DIR] name

positional arguments:
  name           Application Name

optional arguments:
  -h, --help     show this help message and exit
  -o OUTPUT_DIR  Directory where the application should be created

例如

$ ucf_app_builder_cli app create my-application

构建应用程序

ucf_app_builder_cli app build [-h] [-o OUTPUT_DIR] [--ignore-validation-errors]
                              [--keep-app-specs] [-f]
                              [-v VALUE-OVERRIDE] [--generate-params-override]
                              [--force-prod]
                              app [params [params ...]]

positional arguments:
  app                   UCF Application Graph File or Directory Containing app.yaml
  params                UCF Application Graph Parameters Files

optional arguments:
  -h, --help            show this help message and exit
  -o OUTPUT_DIR         Directory to build the application in
  --ignore-validation-errors
                        Ignore validation errors and build applicatoin
  --keep-app-specs      Retain app-specs used to create the application helmchart
  -f, --force-cleanup   Output directory contents will be cleaned up without user confirmation
  -v VALUE-OVERRIDE, --value-override VALUE-OVERRIDE
                        Input that provides the default values in the output value override file
  --generate-params-override
                        Generate override values for those impacted by parameter file

  --force-prod          Only microservices that are in prod should be selected

例如

$ ucf_app_builder_cli app build app.yaml params.yaml

将应用程序导出为微服务

ucf_app_builder_cli app export-ms [-h] [-o OUTPUT_DIR] [--ignore-validation-errors] [-f] [--force-prod] -e EXPORT_INFO app [params [params ...]]

positional arguments:
  app                   UCF Application Graph File or Directory Containing app.yaml
  params                UCF Application Graph Parameters Files

optional arguments:
  -h, --help            show this help message and exit
  -o OUTPUT_DIR         Directory to export the microservice in
  --ignore-validation-errors
                        Ignore validation errors and build application
  -f, --force-cleanup   Output directory contents will be cleaned up without user confirmation
  --force-prod          Only microservices that are in prod should be selected
  -e EXPORT_INFO        File containing additional user input required to export the application as a microservice

服务命令 service

服务命令 service 可用于列出和查看有关可用微服务的信息。

$ ucf_app_builder_cli service -h
usage: ucf_app_builder_cli service [-h]  ...

positional arguments:

    list      List microservices
    versions  List versions of a microservice
    info      Info about a microservice
    sync      Sync a microservice from NGC to cache

optional arguments:
  -h, --help  show this help message and exit

列出可用的微服务

ucf_app_builder_cli service list [-h] [-r REPO_NAME]

optional arguments:
  -h, --help            show this help message and exit
  -r REPO_NAME, --repo-name REPO_NAME
                        Select an repository name

例如

$ ucf_app_builder_cli service list

列出可用的微服务版本

ucf_app_builder_cli service versions [-h] -n NAME [-r REPO_NAME]

optional arguments:
  -h, --help            show this help message and exit
  -n NAME, --name NAME  Name of the microservice
  -r REPO_NAME, --repo-name REPO_NAME
                        Select an repository name

例如

$ ucf_app_builder_cli service versions -n ucf.svc.myservice

查看微服务信息

ucf_app_builder_cli service info [-h] [-v MS-VERSION] [--show-compliance-details] [--show-license] [--show-docs]
                                 [--show-changelog] -n NAME

optional arguments:
  -h, --help            show this help message and exit
  -v MS-VERSION, --version MS-VERSION
                        Version of the microservice to get info for
  --show-compliance-details
                        Show compliance check details for the microservice
  --show-license        Show license text for the microservice
  --show-docs           Show detailed documentation for the microservice
  --show-changelog      Show changelog for the microservice

required arguments:
  -n NAME, --name NAME  name of the ms

例如

$ ucf_app_builder_cli service info -n ucf.svc.myservice -v 0.0.1

同步微服务

ucf_app_builder_cli service sync [-h] -n NAME [-v MS-VERSION]

optional arguments:
  -h, --help            show this help message and exit
  -v MS-VERSION, --version MS-VERSION
                        Version of the microservice to sync (default: latest)

required arguments:
  -n NAME, --name NAME  Name of the microservice to sync

例如

$ ucf_app_builder_cli service sync -n ucf.svc.myservice -v 0.0.1

注册表命令 registry

注册表命令 registry 可用于执行各种注册表操作,例如设置 NGC API 密钥、从 NGC 存储库同步所有微服务、缓存管理。

$ ucf_app_builder_cli registry -h
usage: ucf_app_builder_cli registry [-h]  ...

positional arguments:

    repo      Registry repository operations
    cache     Registry cache operations

optional arguments:
  -h, --help  show this help message and exit

设置 NGC API 密钥

ucf_app_builder_cli registry repo set-api-key [-h] -a API_KEY

optional arguments:
  -h, --help            show this help message and exit

required arguments:
  -a API_KEY, --api-key API_KEY
                        Select a API key

例如

ucf_app_builder_cli registry repo set-api-key -a XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

列出可用的存储库

ucf_app_builder_cli registry repo list [-h]

optional arguments:
  -h, --help  show this help message and exit

例如

ucf_app_builder_cli registry repo list

查看存储库的信息

ucf_app_builder_cli registry repo info [-h] -n REPO_NAME

optional arguments:
  -h, --help            show this help message and exit

required arguments:
  -n REPO_NAME, --repo-name REPO_NAME
                        Select an repository name

例如

ucf_app_builder_cli registry repo info -n public

同步存储库中的所有微服务

ucf_app_builder_cli registry repo sync [-h] -n REPO_NAME [-a]

optional arguments:
  -h, --help            show this help message and exit
  -a, --all             Sync all versions of a microservice

required arguments:
  -n REPO_NAME, --repo-name REPO_NAME
                        Select an repository name

例如

ucf_app_builder_cli registry repo sync -n public

清除本地存储库

ucf_app_builder_cli registry repo clear [-h]

optional arguments:
  -h, --help  show this help message and exit

例如

ucf_app_builder_cli registry repo clear

设置注册表缓存路径

ucf_app_builder_cli registry cache set [-h] -p CACHE_PATH

optional arguments:
  -h, --help            show this help message and exit

required arguments:
  -p CACHE_PATH, --cache-path CACHE_PATH
                        Select a cache path

例如

ucf_app_builder_cli registry cache set -p /home/ubuntu/ucf_cache

查看注册表缓存路径

ucf_app_builder_cli registry cache view [-h]

optional arguments:
  -h, --help            show this help message and exit

例如

ucf_app_builder_cli registry cache view

清除注册表缓存

ucf_app_builder_cli registry cache clear [-h]

optional arguments:
  -h, --help            show this help message and exit

例如

ucf_app_builder_cli registry cache clear