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 urls add
- mabl environments build-files add
- mabl environments build-files 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} --application-id {app-id} --app-url https://www.example.com # Create a preview environment with variables mabl environments create -n {name} --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 urls add
Add one or more web or API URLs to an app-environment pair.
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 |
Examples
# Associate an application and environment with a new web application URL mabl environments urls add {env-id} --application-id {app-id} --app-url https://www.url1.com # Associate an application and environment with a new API URL mabl environments urls add {env-id} --application-id {app-id} --api-url https://www.api.example.com
To see all of the URLs and mobile builds associated with an app-environment pair, run mabl environments urls
list:
mabl environments urls list {env-id} -a {app-id}
mabl environments build-files add
Associate a mobile build file to an app-environment pair.
mabl environments build-files add {env-id} --application-id {app-id} --build-file-id {build-file-id}
For more details on managing mobile build files in the CLI, check out this article.
mabl environments build-files update
Swap out the mobile build file associated with an app-environment pair.
mabl environments build-files update {env-id} --application-id {app-id} --build-file-id {build-file-id}
If a different build file is already associated with the app-environment pair, the CLI replaces it with the new build file. This process is separate for Android and iOS. For example, running mabl environments build-files update
with an Android build only updates the Android build file associated with the app-environment pair. The same behavior applies for iOS builds.
If you want to run plans ad hoc with a build file just once to test it out, you can create a deployment event instead and use a build file override argument: --android-app-file-id
or --ios-app-file-id
.
Note
The mabl environments build-files update
command cannot update app-environment pairs that are already associated with multiple build files. For example, if two iOS builds are already associated with the app-environment pair, you cannot update them from the CLI. Use the mabl app instead: Configurations > Applications.
mabl environments delete
Delete an environment
mabl environments delete {env-id}