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
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 <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
Option | Description |
---|---|
--limit , -l | Specify the number of URLs to return |
--output , -o | Specify 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
Option | Description |
---|---|
--application-id | ID of the application to associate with this environment. This option is required. |
--app-url | Web application URLs to associate with the application-environment pair |
--api-url | API 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>
Updated about 2 months ago