Skip to content

CLI

The VDC CLI is a command-line tool designed to interact with the VDC API, enabling users to submit and download ingredients. While primarily intended for automation, it can also be used locally.

Installation

Windows

To install the VDC CLI on Windows, run the following command in PowerShell:

$ProgressPreference = "SilentlyContinue"; (Invoke-WebRequest -Uri 'https://af01p-fm.devtools.intel.com/artifactory/vdc-client-fm-local/vdc/cli/prod/win-x64/vdc.exe' -OutFile '.\vdc.exe') | Out-Null; .\vdc.exe install; rm .\vdc.exe

Linux

To install the VDC CLI on Linux, use the following command:

wget https://af01p-fm.devtools.intel.com/artifactory/vdc-client-fm-local/vdc/cli/prod/linux-x64/vdc && chmod +x vdc && sudo ./vdc install && rm vdc

After installation, the CLI binary is added to the PATH system environment variable, allowing it to be used directly in a terminal by typing:

vdc

Using Token Authentication with VDC CLI

The VDC Command Line Interface (CLI) offers two methods for authenticating your commands: Windows Authentication and Token Authentication.

  1. Windows Authentication: This method uses the credentials of the currently logged-in Windows user. It's straightforward but only works on Windows operating systems. If your user account has the necessary permissions in VDC, you typically don't need to do anything extra when running commands on Windows.
  2. Token Authentication: This method uses a generated security token. It's more versatile as it works on all supported operating systems (Windows, macOS, Linux), making it ideal for cross-platform development or automation scripts.

This guide focuses on how to set up and use Token Authentication.

Step 1: Generating the Authentication Token

The token must be generated using the VDC CLI on a Windows machine, running under the user account that has the desired VDC permissions.

  1. Log in to the Windows machine using the relevant user account.
  2. Open a command prompt (cmd.exe) or PowerShell window.
  3. Run the following VDC CLI command:
    vdc token create
    
  4. The command will output a long alphanumeric string. This is your authentication token.
  5. Crucial: Copy this token immediately. Store it in a secure location (e.g., a password manager, secure note application, or environment variable). Treat this token like a password, as it grants access to VDC.

Step 2: Using the Token in VDC CLI Commands

Once you have your token, you can use it to authenticate VDC CLI commands on any supported operating system where the VDC CLI is installed.

To authenticate using the token, simply add the --token argument followed by the token string you generated to any VDC CLI command.

General Syntax:

vdc <command> [command_options...] --token <YOUR_GENERATED_TOKEN>

Usage scenarios

To display help information, run the following command:

$ vdc --help

Description:
  Validation DevOps Center CLI 1.0.0

Usage:
  vdc [command] [options]

Options:
  --verbose        Enable CLI to print additional logs for debugging [default: False]
  --token <token>  The VDC user token
  --version        Show version information
  -?, -h, --help   Show help and usage information

Commands:
  install                  Installs the VDC Client
  update                   Updates the VDC Client
  ingredient-release       Manages ingredient releases
  ingredient               Manages ingredients
  workflow                 Manages workflows
  workflow-run             Manages workflow runs
  workflow-run-build-step  Manages workflow run steps
  token                    Manages VDC token used for authentication

Each command supports the --verbose parameter. It makes the CLI print additional logs that may help with debugging.

Submission

To submit an ingredient and wait for it to complete, run:

$ vdc ingredient-release submit --project <PROJECT_NAME> --name <INGREDIENT_NAME> --wait --version <INGREDIENT_VERSION> --verbose --metadata <PATH_TO_METADATA_JSON_FILE> --packageFile <PATH_TO_ZIP_OR_BINARY>

The metadata file should follow the format below:

{
  "Description": "Initial release candidate",
  "BaseLine": {
    "ProjectName": "12345",
    "FeedName": "12345",
    "Name": "12345",
    "Version": "12345"
  },
  "ReleaseDate": "2023-10-01T12:00:00Z",
  "Dependencies": [
    {
      "ProjectName": "ProjectA",
      "FeedName": "FeedA",
      "Name": "DependencyA",
      "Version": "1.0.0"
    },
    {
      "ProjectName": "ProjectB",
      "FeedName": "FeedB",
      "Name": "DependencyB",
      "Version": "2.0.0"
    }
  ],
  "Milestones" : ["A", "B"]
}

You can skip the --wait parameter. In this case, the CLI uploads the ingredient but does not wait for the processing result. If you want to submit more package files for the release, provide many --packageFile parameters:

$ vdc ingredient-release submit --packageFile <PATH_TO_ZIP_OR_BINARY> --packageFile <PATH_TO_ZIP_OR_BINARY>

Download

To download an ingredient with a specific version, run:

$ vdc ingredient-release download --project <PROJECT_NAME> --name <INGREDIENT_NAME> --version <INGREDIENT_VERSION> --packageFile <PACKAGE_FILE>

To download the latest ingredient, skip the --version parameter. If there is only one package for the release, --packageFile parameter can be skipped.

Update

The VDC API does not guarantee compatibility with older versions of the CLI, so it is important to use the latest version. To ensure you have the latest version installed, run:

$ vdc update

The command checks if a newer version is available and replaces the installed VDC binary with the updated one if found.