UCS Microservice Builder CLI

The UCS Microservice Builder CLI tool can be used to create and build microservices. It can be used to list and view information about available microservices and perform a few NGC repository operations.

The tool is named ucf_ms_builder_cli.

Basic Operations

Viewing Help

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

positional arguments:

    service           Perform actions on a microservice
    registry          Perform actions on registry
    component         Perform actions on components

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

Checking the Tool Version

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

Service Command service

Service command service can be used to create and build microservices and list and view information about available microservices.

$ ucf_ms_builder_cli service [-h]  ...

positional arguments:

    create    Create a microservice scaffolding
    clone     Clone an existing microservice to a new version in prod
    build     Build a microservice
    validate  Validate a microservice
    list      List microservices
    versions  List versions of a microservice
    remove    Remove microservice from repo
    info      Info about a microservice
    sync      Sync a microservice from NGC to cache

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

Create Microservice Scaffolding

ucf_ms_builder_cli service create [-h] [-d DESCRIPTION] [-o OUTPUT_DIR] -n NAME -i
                                     {container-image,container-config,helm-chart} [-c CHART]

optional arguments:
  -h, --help            show this help message and exit
  -d DESCRIPTION, --description DESCRIPTION
                        description of microservice
  -o OUTPUT_DIR, --output_dir OUTPUT_DIR
                        output directory to place the created microservice

required arguments:
  -n NAME, --name NAME  name of the microservice
  -i {container-image,container-config,helm-chart}, --input {container-image,container-config,helm-chart}
                        Input:
                        container image
                        container builder config
                        helm chart
  -c CHART, --chart CHART
                        Chart path when using prebuilt helm chart (type=3)

e.g.

$ ucf_ms_builder_cli service create -n myservice -i container-image

Building a Microservice

ucf_ms_builder_cli service build [-h] -d DIRECTORY [-t TARGET] [--push] [--skip-tests] [--skip-compliance] [-f]
                                 [--keep-app-specs]

optional arguments:
  -h, --help            show this help message and exit
  --push                Push service to staging repo if it build is successful
  --skip-tests          Skip building of tests
  --skip-compliance     Skip compliance checks
  -f, --force-cleanup   Output directory contents will be cleaned up without user confirmation
  --keep-app-specs      Create app specs folder in user directory

required arguments:
  -d DIRECTORY, --directory DIRECTORY
                        path to microservice directory
  -t TARGET, --target TARGET
                        Target file path when using container builder config (type=2) (required by container builder)

e.g.

$ ucf_ms_builder_cli service build -d myservice/

List Available Microservices

ucf_ms_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

e.g.

$ ucf_ms_builder_cli service list

List Available Microservice Versions

ucf_ms_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

e.g.

$ ucf_ms_builder_cli service versions -n ucf.svc.myservice

View Microservice Information

ucf_ms_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

e.g.

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

Synchronize a Microservice

ucf_ms_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

e.g.

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

Registry Command registry

The Registry command registry can be used to perform various registry operations such as set the NGC API Key, sync all microservices from a NGC repository, cache management.

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

positional arguments:

    repo      Registry repository operations
    cache     Registry cache operations

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

Set NGC API Key

ucf_ms_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

e.g.

ucf_ms_builder_cli registry repo set-api-key -a XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

List Available Repositories

ucf_ms_builder_cli registry repo list [-h]

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

e.g.

ucf_ms_builder_cli registry repo list

View Information for a Repository

ucf_ms_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

e.g.

ucf_ms_builder_cli registry repo info -n public

Synchronize All Microservices in a Repository

ucf_ms_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

e.g.

ucf_ms_builder_cli registry repo sync -n public

Clear Local Repository

ucf_ms_builder_cli registry repo clear [-h]

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

e.g.

ucf_ms_builder_cli registry repo clear

Set the Registry Cache Path

ucf_ms_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

e.g.

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

View the Registry Cache Path

ucf_ms_builder_cli registry cache view [-h]

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

e.g.

ucf_ms_builder_cli registry cache view

Clear the Registry Cache

ucf_ms_builder_cli registry cache clear [-h]

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

e.g.

ucf_ms_builder_cli registry cache clear

Component Command component

The Component command component can be used to list and view information about components available that can be used to implement a microservice.

$ ucf_ms_builder_cli component [-h]  ...

positional arguments:

    add       Recursively scan directory for components and add them to cache
    list      List available components
    info      Display info of a component

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

List Components

ucf_ms_builder_cli component list [-h]

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

e.g.

ucf_ms_builder_cli component list

View Information for a Component

ucf_ms_builder_cli component info [-h] -c COMPONENT_NAME

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

required arguments:
  -c COMPONENT_NAME, --component COMPONENT_NAME
                        List component info

e.g.

ucf_ms_builder_cli component info -c ucf.k8s.container

Add Custom Components

ucf_ms_builder_cli component add [-h] -d DIR_PATH [--overwrite]

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

required arguments:
  -d DIR_PATH, --directory DIR_PATH
                        Directory path containing components
  --overwrite           Overwrite components in cache having the same type

e.g.

ucf_ms_builder_cli component add -d /home/nvidia/ucf_custom_components