In the mabl CLI, you can programmatically manage the environments in your workspace:
- mabl environments list
- mabl environments describe
- mabl environments create
- mabl environments update
- mabl environments delete
The mabl environments
command includes two subcommands for managing the URLs and build files associated with your test environments. Learn more here.
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
Option | Details |
---|---|
--limit , -l
|
The number of environments to return. The default is 10. |
--output , -o
|
Specific 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
Option | Details |
---|---|
--decrypt |
Return environment variables in the output |
--output , -o
|
Specify 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
Option | Details |
---|---|
--application-id |
ID of the application to associate with this environment |
--app-url |
Web application URLs to associate with the application-environment pair |
--api-url |
API URLs to associate with the application-environment pair |
--name , -n
|
Name of the environment |
--description |
Description of the environment |
--variables |
Key-value environment variable pairs in the following format: var1:value1 |
--link |
Name of the link agent to use for this environment |
--mabl-branch |
Name 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. |
--preview |
Set 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
Option | Details |
---|---|
--name , -n
|
Update the name of the environment |
--description |
Update the description of the environment |
--variables |
Update key-value environment variable pairs in the following format: var1:value1 |
--link |
Update the name of the link agent to use for this environment |
--mabl-branch |
Update 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. |
--preview |
Update to true to mark this as a preview environment |
Examples
# Update the environment variables mabl environments update <env-id> --variables var1:value1 var2:value2 # Update an environment to run on a mabl branch called "test-branch" mabl environments update <env-id> --mabl-branch test-branch
mabl environments delete
Delete an environment
mabl environments delete <env-id>