Selective builds

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:

  1. Make sure the appropriate Service credential user must be set on your app’s Team page.

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

  2. Click on your app on your Dashboard.

  3. Click Settings in the top navigation bar.

  4. Find the ENABLE SELECTIVE BUILDS option and toggle the switch on the right.

  5. Add filenames and file paths in the ADD FILENAME/PATH window. You can add multiple files or file paths here. A build will be triggered only if these files are changed.

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.