Agent commands

Build a Project from its airbuild.yaml: an everyday build, a signed build, or an unsigned device package.

runbuild builds a Project by running the build script in its airbuild.yaml, then brings back what the script built. It runs inside a Team’s Environment, where Agents work.

Team Where the build runs
Cloud Team The Project is uploaded to a macOS builder (ios), or a Linux builder (android_beta). pocketjs_beta builds on the Team’s own host.
Mac Team On the Team’s own Mac, with that Mac’s Xcode. android_beta builds in cloud Teams only.

runbuild never installs the app. When a build finishes, it prints the simulator commands that install and open it; you run them yourself, on the device you choose (see simulator).

Synopsis

Terminal window
# Start a build
runbuild <project-id> [--platform <platform>] [--source <directory>] [--sign | --unsigned] [--environment ID] [--no-cache]

# Reattach to a build already in progress (starts nothing)
runbuild <project-id> --follow [--run ID]

# Other
runbuild --cancel [--run ID]
runbuild --list-environments
runbuild --help

<project-id> is the Project’s ID, a UUID. Projects live under /projects/<project-id>.

Options

Option Value Default What it does
<project-id> UUID required to start or follow The Project to build. Exactly one.
--platform ios, pocketjs_beta, android_beta the default manifest Builds with .airbuild/airbuild.<platform>.yaml instead of the default airbuild.yaml.
--source directory the Project directory Builds that directory (a git worktree, for example) instead. It uses the directory’s own airbuild.yaml if it has one, else the Project’s. The result is recorded for the Project as usual. The path is relative to your current directory.
--sign — off A signed build. For iOS: an .ipa for TestFlight and the App Store; it needs a connected Apple team. For android_beta: the release: recipe’s .aab or .apk, signed with the app’s key.
--unsigned — off iOS only: an unsigned device .ipa and its Xcode archive (.xcarchive.zip, dSYMs included). No Apple team needed. This is the same package Download App Package gives people in the AirBuild app. Someone must sign it before it installs on a device.
--environment ID from --list-environments the default environment Cloud Teams: builds on that builder environment (a macOS and Xcode version). It picks what the app is built with, not where it runs, and may take longer to start.
--no-cache — caches on Starts from empty caches and saves nothing, for this run only.
--follow — — Reattaches to a build already running. If the build has already finished, it says so and replays that run’s saved output. It never starts a build.
--run run ID the running run, else the newest With --follow or --cancel: which run. Needed when several are running.
--cancel — — Asks the running build to stop and waits up to 30 seconds for confirmation.
--list-environments — — Cloud Teams: lists the builder environments, the default first.
-h, --help — — Prints the command’s help.

--sign and --unsigned are two different builds: pass one. --environment and --no-cache only apply when starting a build; --run only with --follow and --cancel. runbuild takes no --simulator: install with simulator install <path> --simulator ID after it has built.

Kinds of build

Build Script it runs Script gets Result
Ordinary (runbuild <id>) build.script AIRBUILD_SIGN=0 The built .app (iOS), .pocket (pocketjs_beta) or .apk (android_beta). The app’s name, bundle ID and icon are reported to AirBuild.
--sign release.script, else build.script AIRBUILD_SIGN=1 A signed .ipa and its dSYMs (iOS), or a signed .aab / .apk (android_beta).
--unsigned release.script, else build.script AIRBUILD_SIGN=0, AIRBUILD_DEVICE=1 An unsigned device .ipa and .xcarchive.zip.
  • A signed iOS build prepares signing for every Bundle ID in signing.bundles, then runs one archive and the IPA export. It does not change your own signing identities. Set the build number in the project before building: AirBuild does not change it.
  • A successful iOS --sign build uploads the app’s dSYMs to AirFeedback, so crash reports show function names and source lines.
  • With --unsigned, if the manifest’s artifact is not an .xcarchive (or there is no manifest), runbuild finds the Xcode workspace or project and the iOS app scheme itself.
  • android_beta: every build is re-signed after it is built with the app’s one key, the Team’s key for signing.package, created on the app’s first build. This covers the emulator .apk (which is also the APK people download) and, with --sign, the release .aab or .apk. The project’s own Gradle signing is replaced. The first time, the run prints Created the signing key for <package>.

Caches

Cloud builds keep caches between builds:

  • iOS: the Project’s DerivedData. The first airbuild-xcode install or airbuild-xcode test of a build brings it back, so only what changed recompiles. airbuild-xcode archive (signed and device builds) keeps none.
  • android_beta: Gradle’s build cache and compiled build scripts.
  • Anything else: the script restores it with airbuild-cache.

Each cache is saved again after every build, after the result is back, and only the newest copy is kept. --no-cache turns this off for one run.

What runbuild reads from airbuild.yaml

runbuild looks for airbuild.yaml at the Project root, then in .airbuild/. If both exist, it uses the root one and prints Using airbuild.yaml at the project root; .airbuild/airbuild.yaml is ignored while the root manifest exists.

A Project can have one manifest per platform:

File Platform
airbuild.yaml (root, else .airbuild/) what its platform: says; versions 2 and 3 are ios
.airbuild/airbuild.<platform>.yaml <platform>; its platform: must say the same

Without --platform, runbuild uses the default airbuild.yaml; if there is none and only one manifest, it uses that one. When it uses a named file it prints Platform <platform>: <path>.

Key Used for
version 2, 3 or 4. Version 2 supports only ordinary builds; signing needs version 3 or later.
platform Version 4 only, required: ios, pocketjs_beta or android_beta. Not allowed in version 3.
build.script The Bash script of an ordinary build. It runs from the source root with -e -o pipefail (not -u).
build.artifact.path What the build script writes: the .app (iOS), the .pocket package (pocketjs_beta), or the .apk (android_beta).
release.script, release.artifact.path Run by --sign and --unsigned. For iOS the path ends in .xcarchive; for android_beta in .aab or .apk.
signing.bundles iOS: every app and extension Bundle ID in the archive. An App Clip is a mapping, { id: <clip ID>, app_clip_of: <parent app ID> }.
signing.package android_beta: the app’s applicationId. Without it, runbuild uses the one applicationId found in the Gradle build files and tells you to pin it.
test Read by runtest, not runbuild.

A minimal iOS manifest:

airbuild.yamlYML
version: 3
build:
  script: |
    airbuild-xcode install -project App.xcodeproj -scheme App \
      DSTROOT="$PWD/.airbuild/artifacts/install"
  artifact:
    path: .airbuild/artifacts/install/Applications/App.app
release:
  script: |
    airbuild-xcode archive -project App.xcodeproj -scheme App \
      -archivePath .airbuild/artifacts/App.xcarchive
  artifact:
    path: .airbuild/artifacts/App.xcarchive
signing:
  bundles:
    - com.example.app

Output

Output is plain text; there is no JSON mode. Lines start with • (progress), ✓ (done), ! (warning) or ✗ (failure). A cloud iOS build looks like this:

• Build started in the Environment. Run: <run-id>
• It runs to completion even if this command is interrupted (reattach with: runbuild <project-id> --follow --run <run-id>).
Airbuild remote build

✓ Build <build-id> created.
✓ Source uploaded (<size>).
✓ Build queued.
✓ Builder started.
… the build script's own output …
✓ Build succeeded in <time>.
✓ Built Example.
  App: /tmp/…/Example.app

  simulator terminate <bundle-id>
  simulator install <path to the .app>
  simulator launch <bundle-id>

✓ Build finished.
  Build: <build-id>
  App: /tmp/…/Example.app

The closing block can also show Artifact:, Xcode archive: and Note: lines. A signed build prints Signed .ipa ready (…) with Saved to: and dSYMs:; an unsigned one prints Unsigned device .ipa ready (…) with Saved to: and Xcode archive:. A macOS app builds but prints macOS apps have no Team Simulator preview; use runmacos to run it.

Stop the running copy of the app before installing a new one: an install leaves the old process running. An app that cannot open on its own (a sticker pack, for example) is installed only; launch the app that hosts it.

--list-environments prints:

Builder environments (runbuild --environment ID):

  <id> (default)
      <name> · <platform>
      <summary>

Running several builds

Each command (runbuild, runtest, runmacos, runlinux) has its own slot and keeps its latest results. Cloud Teams run several builds at once, each on its own builder; Mac Teams run one at a time. Starting a build prints its run ID. When several are running, --follow and --cancel need --run ID (or a project ID only one of them uses). Pressing Ctrl-C only detaches the display; the build keeps going.

Exit codes

Code Meaning
0 The build (or the cancellation) finished.
1 The build failed, or the Environment refused or lost it. Reason: says why.
2 A wrong option or argument; nothing was started. Also: no airbuild.yaml found.
130 The build was canceled, or you detached with Ctrl-C.
other The build script’s own nonzero exit code.

Errors

Message What to do
Expected a Project id (UUID), got: … Pass the Project’s UUID.
airbuild.yaml is missing from the project root (and .airbuild/): … Add a manifest.
--sign and --unsigned are two different builds; pass one. Choose one.
runbuild does not install. Once it has built, install with simulator install <path> --simulator ID. Drop --simulator; install after the build.
--environment takes an id from runbuild --list-environments. Use an ID that list shows.
Builder environments belong to cloud Teams; this Team builds with the Xcode on its owning Mac. On a Mac Team, leave out --environment and --list-environments.
<name> is not a platform. Platforms: ios, pocketjs_beta, android_beta. Use one of those names.
This project has no <platform> manifest (…). Its platforms: … Add .airbuild/airbuild.<platform>.yaml or pick a listed platform.
This project has a manifest for several platforms and no default airbuild.yaml; choose one with --platform: … Pass --platform.
Two manifests are for <platform>: … Keep one. Remove one of the two files.
<path> says platform: <x>; a file named for a platform must be for that platform. Fix platform: or rename the file.
Set version to the number 2, 3 or 4. Fix version.
Version 4 needs platform: one of … Add platform:.
List every app and extension Bundle ID in signing.bundles before requesting signing. Add signing.bundles.
Signing requires an archive: add a release: recipe whose airbuild-xcode archive writes release.artifact.path ending in .xcarchive (or end build.artifact.path in .xcarchive). Add a release: recipe that archives.
A signed Android build runs the manifest's release recipe. Add release: … Add release: to the android_beta manifest.
A signed Android build needs signing.package: … Add signing.package.
The build finished without writing build.artifact.path (…). Make the script write the file the manifest names, or fix the path.
A runbuild execution is already running in this Team's Environment. Follow it (runbuild <id> --follow) or cancel it.
This Team's Environment is already running N runbuild executions, the limit. Wait for one to finish, or follow one.
No build to follow. Nothing has run yet; start a build.
No execution is running to cancel. Nothing to do.
Cancellation was requested, but the execution has not confirmed it stopped within 30 seconds. The request still stands. Check with --follow.
The build's result is gone (replaced by a newer build, or the Environment restarted). Build again.
The Build succeeded, but its app information could not be saved. Build again before installing. Build again.

Examples

Terminal window
# Everyday build of the default manifest
runbuild 3f6c1a2e-8b4d-4f0a-9c1e-2d7b5a6e9f10
Terminal window
# Signed build for TestFlight
runbuild 3f6c1a2e-8b4d-4f0a-9c1e-2d7b5a6e9f10 --sign
Terminal window
# Android build, without caches
runbuild 3f6c1a2e-8b4d-4f0a-9c1e-2d7b5a6e9f10 --platform android_beta --no-cache
Terminal window
# Pick up a build after detaching
runbuild 3f6c1a2e-8b4d-4f0a-9c1e-2d7b5a6e9f10 --follow