Managing mobile build files in the CLI

For the full index of agent-friendly pages, see llms.txt.

In the mabl CLI, you can programmatically manage your mobile build files for mobile testing, including integrating with CI/CD. This article highlights mabl CLI commands that are useful for testing out new builds and updating release candidates in your pipeline.

Upload mobile build files

The mabl mobile-build-files upload command uploads and creates a new mobile build file. The file input must be a relative path to the file you upload to your mabl workspace. 

When you upload a build file, the CLI returns a build file ID ending in -maf.  Use this ID to associate build files with test environments and run plans with build file overrides.

mabl mobile-build-files upload {build-file-path}
Option Details
–branch Branch from which this mobile build file was built.
–labels Space delimited labels to save the test with.
–platform The mobile platform. Choices: “android” or “ios”. By default, the platform is inferred from the build file’s binary extension.
–version The version of the mobile build file

Associate build files with test environments

To update the build file for plan runs, use the ID returned from the mabl mobile-build-files upload command with the mabl environment build-files update command. This command updates the build file associated with the app-environment pair.

Example

# Upload a build file as a release candidate
mabl mobile-build-files upload sample-build.app --version 1.2

# Associate the app and environment used for scheduled plan runs with the new build file
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.

Note: 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.

Run plans with build file overrides

To test out your plans with a new build, use mabl deployments create with a build file override. Build file override flags are platform-specific and require the ID returned from mabl mobile-build-files upload.

Option Details
--android-app-file-id Android mobile app file to be used in deployment event
--ios-app-file-id iOS mobile app file to be used in deployment event

To get a list of all mobile build files and their IDs, run mabl mobile-build-files list.

Example

# Upload a build file that is currently under development
mabl mobile-build-files upload sample-build.apk --version 3.4

# Run plans with a build file override to test out the build
mabl deployments create -e {env-id} -a {app-id} --android-app-file-id {build-file-id}