Using KaaS CLI

Step-by-step Guidance on Using the Tool

Getting started

This guide provides step-by-step instructions on how to use KaaS. You can use KaaS in two ways: as an authorized user or by providing a token. As an authorized user, you can simplify command execution and avoid specifying a token flag. To access someone else's project, you'll need to be a part of the same KaaS organization or Vault.

Using the CLI

Login

You can refer to Authentification Using Device Flow for the detailed guide on how to authenticate using CLI and github device flow.

Creating and Using a Token

Providing token allows you to skip authentication flow and have same level of access as authenticated users. To create and use a token for accessing the KaaS CLI, follow these steps:

  1. Create a Token:

    • Go to the KaaS dashboard.

    • Click on Profile picture in right top corner

    • Click on the Access Tokens button in the drop-down menu.

    • Create a new token and copy the Key.

  2. Obtain Organization Name and Vault Name:

    • Go to the KaaS dashboard.

    • Click the desired organization.

    • And click on a Vault.

    • Copy the vault name with organization name. It has format:

      • Refered to as Vault Spec: organization-name/vault-name

  3. Use the Token:

    • Replace xxx with your actual token from previous steps.

    • Replace organization-name/vault-name with names from the previous step

    • Replace tag - with short identifier

    • Use the following command for uploading:

          kaas-cli upload organization-name/vault-name:tag --token xxx
    • For downloading, use:

      kaas-cli download organization-name/vault-name:tag --token xxx

Use the command kaas-cli upload --help and kaas-cli download --help to see all available flags.

Authentication Using Environment Variables

Using Environment Variables for Authentication

To simplify the authentication process, the KaaS CLI tool allows using environment variables to store authentication credentials. Alternatively, you can use Device login. Below are the steps to configure and use environment variables for authentication:

  1. Setting Up Environment Variables:

    You need to set up the following environment variables in your operating system:

    • KAAS_SERVER_URL: The URL of the KaaS server (for development and testing).

    • KAAS_DIRECTORY: The directory path for KaaS configurations. Default is /out.

    • KAAS_TOKEN: The Token for accessing KaaS services. Can be obtained here.

    • KAAS_ORG_VAULT: The organization vault identifier for KaaS in the format orgname/vaultname.

    Example:

    On Windows:

    setx KAAS_DIRECTORY "your_directory"
    setx KAAS_TOKEN "your_token"
    setx KAAS_ORG_VAULT "your_org_vault"

    On Linux/macOS:

    export KAAS_DIRECTORY="your_directory"
    export KAAS_TOKEN="your_token"
    export KAAS_ORG_VAULT="your_org_vault"
  2. Using Environment Variables in the CLI Tool:

    The CLI tool will automatically read the values of KAAS_SERVER_URL, KAAS_DIRECTORY, KAAS_TOKEN, and KAAS_ORG_VAULT from the environment variables. You do not need to pass these values explicitly each time you run a command.

    Example Command:

    kaas-cli check-auth

    In this example, the CLI tool will authenticate using the credentials stored in the environment variables.

  3. Verifying Environment Variable Setup:

    You can verify that the environment variables are set correctly by running the following commands:

    On Windows:

    echo %KAAS_DIRECTORY%
    echo %KAAS_TOKEN%
    echo %KAAS_ORG_VAULT%

    On Linux/macOS:

    echo $KAAS_DIRECTORY
    echo $KAAS_TOKEN
    echo $KAAS_ORG_VAULT

Last updated