Migrating all your apps from Intel to Apple silicon with the Bitrise API

We have recently deprecated our Intel-based macOS build machines in favour of Apple silicon. After the migration, builds that were previously configured to run on Intel machines are automatically switched over to Apple silicon. However, we haven’t modified our users’ bitrise.yml files which contain the build configurations, including the machine type. If a bitrise.yml file contains a configuration with an Intel machine on a macOS stack, Bitrise automatically overrides it when starting a build.

Instead of relying on the automatic override, we recommend our users to change the machine type in their bitrise.yml files to make sure they use the Apple silicon machine that best fits their needs. For users with multiple apps, doing this manually in the Workflow Editor is a time-consuming process.

For that reason, we’ve introduced two API endpoints to help with the task. These endpoints migrate all apps owned by a given user or Workspace from one machine type to another:

Please note that these endpoints only work with a bitrise.yml file that is stored on bitrise.io. If you store your app’s bitrise.yml file in your repository, these endpoints won’t be able to modify the file. The API call won’t fail: these apps will be skipped.

  • PATCH /user/{user-slug}/apps/machine_types: For apps owned by individual users. Please note that only legacy accounts, which were initially concurrency-based, can own apps. More recent accounts need at least one Workspace to be able to add apps.
  • PATCH /organizations/{org-slug}/apps/machine_types: For apps owned by Workspaces. To successfully call the endpoint, the account that calls the API must be an owner of the Workspace.

Both endpoints allow users to quickly and seamlessly migrate their apps to the Apple silicon machines. Both endpoints take two parameters:

  • from_machine: The machine type you want to migrate from.
  • to_machine: The machine type you want to migrate to.

To call the relevant endpoint, you also need a user slug or Workspace slug: this is a unique identifier for the user account or Workspace that owns the apps that will be migrated.

Configuring the API call for the migration

To successfully set up the API call:

  1. If you don’t have one, create a Personal Access Token.
    Personal Access Tokens are used to authenticate users with the Bitrise API.
  2. Find the user slug or Workspace slug you need.
  1. Find the machine type you want to migrate from and the machine type you want to migrate to.
    Mapping of the macOS machine types:
  • Intel Standard: g2.4core
  • Intel Medium: g2.8core
  • Intel Large: g2.12core
  • M1 Medium: g2-m1.4core
  • M1 Large: g2-m1.8core
  • M1 Max Medium: g2-m1-max.5core
  • M1 Max Large: g2-m1-max.10core
    You can also find all available machine types here: Build machine types .
  1. Call the relevant endpoint with your personal access token, the user or Workspace slug, and the machine types.
    In the examples below, replace USER-SLUG, WORKSPACE-SLUG, and PERSONAL-ACCESS-TOKEN with your relevant slugs and token.
    Example 1: Migrating all apps owned by a user from Intel Standard machines to M1 Medium machines:
curl -X 'PATCH' \
  'https://api.bitrise.io/v0.1/user/USER-SLUG/apps/machine_types' \
  -H 'accept: application/json' \
  -H 'Authorization: PERSONAL-ACCESS-TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "from_machine": "g2.4core",
  "to_machine": "g2-m1.4core"
}'

Example 2: Migrating all apps owned by a Workspace from Intel Large machines to M1 Max Medium machines:

curl -X 'PATCH' \
  'https://api.bitrise.io/v0.1/organizations/WORKSPACE-SLUG/apps/machine_types' \
  -H 'accept: application/json' \
  -H 'Authorization: PERSONAL-ACCESS-TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
  "from_machine": "g2.12core",
  "to_machine": "g2-m1-max.5core"
}'

Finding your user slug

To find your user slug, call the https://api.bitrise.io/v0.1/me endpoint.

curl -X 'GET' \
  'https://api.bitrise.io/v0.1/me' \
  -H 'accept: application/json' \
  -H 'Authorization: PERSONAL-ACCESS-TOKEN'

The response will include the slug:

{
  "data": {
    "username": "your-username",
    "slug": "{user-slug}",
    "email": "your-email@email.com",
  }
}

Finding the Workspace slug

To find a Workspace slug:

  1. Log in to app.bitrise.io.
  2. Open the account selector menu on the top right corner.
  3. Select the Workspace you need and click the little gear icon next to its name. It’ll take you to the Workspace overview page.
  4. Get the Workspace slug from the URL in the browser’s address bar.