Skip to main content

Selective builds

Abstract

The Selective builds setting provides change detection for your builds. Enabling it allows you to only trigger a build of an app if certain files or folders have been modified.

The Selective builds setting provides change detection for your builds. Enabling it allows you to only trigger a build of an app if certain files or folders have been modified.

You may want to use this setting if:

  • You have multiple apps in a single repository.

  • Multiple apps share common files in your repository.

Selective Builds with non-Github projects

The current version of our Selective Builds feature only works with GitHub projects. If your repository is hosted by another Git hosting service, the option will not be available.

Example 1. Using the Selective builds feature

Let's say you want to make sure that a commit to your app's repository triggers a Bitrise build only if the mycode.go file on the develop branch is modified in the commit.

  • In this example, you have a branch called develop.

  • You have a trigger that starts a build every time a code push happens on the develop branch.

  • In the selective builds feature, you specified the mycode.go file in the input field.

If you make a commit on the develop branch that modifies the mycode.go file, Bitrise will trigger a build. If your commit doesn't modify the file in any way, Bitrise will not trigger a build.


To configure selective builds:

Admin access only

Only users with the role of admin on the app's team can access all functions of the App Settings page of an app.

  1. Open your app on Bitrise.

  2. Click on App Settings.

  3. Make sure the appropriate service credential user is set on the Integrations page.

    apps-service-credential-user.png

    This user must have admin right for the GitHub repository of the project.

  4. Click on your app on your Dashboard.

  5. On the left, select Builds.

    apps-selective-builds.png
  6. Find the Selective builds section.

  7. Click the Add path button.

    Can't find the button?

    If you can't find the button - like in the screenshot above -, it is because of two possible reasons:

    • The app's repository isn't hosted on GitHub.

    • The service credential user isn't set correctly or doesn't have admin rights to the repo.

  8. In the pop-up window, set the paths you need.

    You can add one path at a time.

Using patterns in the file name or file path

You do not need to set an exact file name or file path for the Selective builds feature: you can set patterns. Using regular expressions is not supported but the pattern may contain certain metacharacters:

  • *: Matches all files.

  • *a: Matches all files beginning with a.

  • a*: Matches all files containing an a.

  • **: Matches directories recursively.

  • ?: Matches any one character.

  • \: Escapes the next metacharacter.

  • [set]: Matches any one character in set.