Working with VMware Application Catalog CLI

VMware Application Catalog (earlier known as Tanzu Application Catalog) is a SaaS solution from VMware for certified container images as well as their deployment automation using helm charts. Recently with VMware Application Catalog (VAC), customers can also have certified OVA images for softwares.

In this blog post, I will talk about how to setup the VAC CLI on a MAC system and then connect with VAC to run operations.

Steps to Install VAC CLI

– Login to VMware Cloud Service Console, https://console.cloud.vmware.com/

– Select an appropriate organization from the right hand corner screen, In case you have more than one organization access.

– Navigate to the Automation Center option

– Read the warning, Click on the Download CLI dropdown and select the OS type. Currently its supported on the Linux and MAC systems.

– It will open a new tab and you will be asked to select the download location for the binary.

 – Check the tar file using command line on the directory where you downloaded

ls -ltr
total 18784
-rw-r--r--@ 1 dinetrip  staff  9616433 Dec 15 22:14 app-catalog-cli-darwin-amd64.tar.gz

– Extract the tar file

$ tar -xvf app-catalog-cli-darwin-amd64.tar.gz            
x app-catalog
x README.md

– Move the app-catalog executable to the local bin folder

$ ls -ltr
total 57840
-rwxr-xr-x@ 1 dinetrip  staff  19980424 Dec 14 17:21 app-catalog
-rw-r--r--@ 1 dinetrip  staff     12282 Dec 14 17:21 README.md
-rw-r--r--@ 1 dinetrip  staff   9616433 Dec 15 22:14 app-catalog-cli-darwin-amd64.tar.gz
 $ chmod +x app-catalog                         
 $ mv app-catalog /usr/local/bin      

– When you try to run app-catalog command, you might see the below issue due to mac security, So you can allow that from MAC system preference -> security as shown in the belo screenshot.      

– Now, if you try running the app-catalog command again, you will be promote for making a selection, Select the Open option

– Finally, run the app-catalog command again and you will see that it is working.

$ app-catalog
                                                                                                        
VMware Application Catalog
==========================

App Catalog CLI allows the user to perform query operations
from a single point such as view all assets available, metadata, download artifacts etc.

Please note this is a beta version and is subject to change.

Usage:
  app-catalog [command]

Examples:

# Authenticate the CLI
app-catalog login

# Get all available apps
app-catalog get apps


Available Commands:
  config      config management
  get         allows inspection of resources
  login       Authenticates against CSP
  metadata    groups all metadata related operations
  version     print CLI version

Flags:
      --add_dir_header                   If true, adds the file directory to the header
      --alsologtostderr                  log to standard error as well as files (default true)
  -h, --help                             help for app-catalog
      --log_backtrace_at traceLocation   when logging hits line file:N, emit a stack trace (default :0)
      --log_dir string                   If non-empty, write log files in this directory
      --log_file string                  If non-empty, use this log file
      --log_file_max_size uint           Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
      --logtostderr                      log to standard error instead of files (default true)
      --skip_headers                     If true, avoid header prefixes in the log messages
      --skip_log_headers                 If true, avoid headers when opening log files
      --stderrthreshold severity         logs at or above this threshold go to stderr (default 2)
  -v, --v Level                          number for the log level verbosity (default 2)
      --vmodule moduleSpec               comma-separated list of pattern=N settings for file-filtered logging

Use "app-catalog [command] --help" for more information about a command.

Configuring VAC CLI

In the above steps, we have installed VAC CLI, here we will be talking about configuring the CLI and running a few commands.

Generate a Token

– Open the URL “https://console.cloud.vmware.com/csp/gateway/portal/#/user/tokens/generate

– Generate a new token

– Click on the Generate button.

– Copy the token for future use as it will not be displayed again. Click on Continue.

– You can see the token name displayed in the table.

– Login to VAC via CLI using the below command. Replace ***** with the token generated.

$ app-catalog login --api-token *********  --context-name vac-demo
Set as default context: y
Context "vac-demo" set as default
Context successfully saved

– Run the command to validate a connection with VAC.

$ app-catalog get apps
[
 {
  "asset_type": "DOCKER_IMAGE",
  "assets": [
   {
    "asset_type": "DOCKER_IMAGE",
    "bitnami_app_id": "dotnet",
    "dependencies": [],
    "description": ".NET is an open-source server-side framework to build applications and services.",
    "id": "62eba2c5ed293d3114bceffc202ee5e201ddf462",
    "labels": {
     "branch": "3.1",
     "distro": "centos-7",
     "registry": "demodocker"
    },
    "name": ".NET Core",
    "released_at": "2021-12-15T23:26:49.000Z",
    "revision": "1",
    "status": "RELEASED",
    "version": "3.1.22"
   },

Truncated output……..

For more commands, refer to the below url.

https://docs.vmware.com/en/VMware-Application-Catalog/services/main/GUID-using-cli.html

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s