Environment commands

Managing environments from the mabl CLI

In the mabl CLI, you can programmatically list, query, create, update, and delete environments from your workspace.

mabl environments list

The mabl environments list command lists environments in a workspace, including environment IDs, names, and the date each environment was created.

Options

OptionDetails
--limit, -lThe number of environments to return. The default is 10.
--output, -oSpecific the output format. The default is a table. Choices: "yaml", "json".

Examples

# List 20 environments in the workspace
mabl environments list --limit 20

# List five environments in json format
mabl environments list --limit 5 --output json

mabl environments describe

The mabl environments describe command returns details on the specific environment, including:

  • Time created and by whom
  • Time of last update and by whom
  • Page interaction speed
  • Link agent settings
  • Whether the environment is pinned to a snapshot

Options

OptionDetails
--decryptReturn environment variables in the output
--output, -oSpecify the output format. The default is yaml. Choices: "json", "yaml".

Examples

# Describe an environment in JSON format
mabl environments describe <environment-id> --format json

# Describe an environment, including its environment variables
mabl environments describe <environment-id> --decrypt

mabl environments create

When you create an environment using mabl environments create, the mabl CLI returns the ID of the new environment.

Options

OptionDetails
--application-idID of the application to associate with this environment
--app-urlWeb application URLs to associate with the application-environment pair
--api-urlAPI URLs to associate with the application-environment pair
--name, -nName of the environment
--descriptionDescription of the environment
--variablesKey-value environment variable pairs in the following format: var1:value1
--linkName of the link agent to use for this environment
--mabl-branchName of the mabl branch to associate with this environment. Tests that run against this environment will use the version on this branch. If a test does not exist on the specified branch, the test runs on master.
--previewSet to true to mark this as a preview environment

Examples

# Create an environment associated with an application and app URL
mabl environments create -n <name-of-environment> --application-id <app-id> --app-url https://www.example.com

# Create a preview environment with variables
mabl environments create -n <name-of-environment> --application-id <app-id> --app-url https://www.example.com --variables foo:bar --preview true

mabl environments update

Run mabl environments update to update an environment. The mabl CLI returns a message to indicate that the environment was updated. To view the updated values, run mabl environments describe.

Options

OptionDetails
--name, -nUpdate the name of the environment
--descriptionUpdate the description of the environment
--variablesUpdate key-value environment variable pairs in the following format: var1:value1
--linkUpdate the name of the link agent to use for this environment
--mabl-branchUpdate the mabl branch to associate with this environment. Tests that run against this environment will use the version on this branch. If a test does not exist on the specified branch, the test runs on master.
--previewUpdate to true to mark this as a preview environment

Examples

# Update the environment variables
mabl environments update <environment-id> --variables var1:value1 var2:value2

# Update an environment to run on a mabl branch called "test-branch"
mabl environments update <environment-id> --mabl-branch test-branch

mabl environments urls list

The mabl environments urls list command returns a list of applications and application URLs associated with a specific environment.

Options

OptionDescription
--limit, -lSpecify the number of URLs to return
--output, -oSpecify the output format: "json" or "yaml"

Examples

# Return up to 5 environment URLs
mabl environments urls list <environment-id> --limit 5

# Return environment URLs in json format
mabl environments urls list <environment-id> --output json

mabl environments urls add

Add one or more new web application URLs or API URLs to an application associated with a specific environment

Options

OptionDescription
--application-idID of the application to associate with this environment. This option is required.
--app-urlWeb application URLs to associate with the application-environment pair
--api-urlAPI URLs to associate with the application-environment pair

Examples

# Associate an application and environment with three new web application URLs
mabl environments urls add <environment-id> --application-id <app-id> --app-url https://www.url1.com https://www.url2.com https://www.url3.com 

# Associate an application and environment with a web application URL and an API URL
mabl environments urls add <environment-id> --application-id <app-id> --app-url https://www.example.com --api-url https://www.api.example.com 

mabl environments delete

Delete an environment

mabl environments delete <environment-id>