Export (0) Print
Expand All

Define a Gated Check-In Build Process to Validate Changes

When a developer checks in changes that break the build, the result can be a significant hassle for small teams. The cost to larger teams can be even more expensive when measured by lost productivity and schedule delays. You can guard some or all of your code base against these problems by creating a gated check-in build definition.

In this topic

When your team puts a gated check-in build process in place, changes that the developers submit are placed in shelvesets and are automatically built and possibly tested by your build system.

Gated Check-in dialog box

The build must be successful for the check-in process to be completed. For more information, see Check in to a Folder that is Controlled by a Gated Check-in Build Process.

If some of your users must bypass the gated check-in, you can set the Override check-in validation by build permission to Allow for a group of your users. For more information, see Team Foundation Server Permissions.

Required Permissions

To perform this procedure, your Edit build definition permission must be set to Allow. For more information, see Team Foundation Server Permissions.

To define a gated check-in build

  1. In Team Explorer:

    1. If you are not already connected to the team project that you want to work in, then connect to the team project.

    2. Choose Home icon Home, and then choose Builds Icon Builds.

    3. On the Builds page, choose New Build Definition.

    A new build definition window appears.

  2. On the Trigger tab:

    • Choose Gated Check-in.

    • (Optional) To increase the efficiency of your build process, select Merge and build up to n submissions For more information, see Avoid Blocking Your Team.

  3. On the Workspace tab, in the Working folders table, map the version-control folders that this build definition will control to local folders on the build agent.

    Tip Tip

    Follow these guidelines:

    • To ensure that your build process functions correctly and to improve performance, include all folders—and only these folders—that contain files that your build process requires.

    • Make sure that you do not specify any version-control folder that is also specified on the Workspace tab of another gated check-in build definition. Otherwise, when a user checks in files to these folders, the build system requires them to decide which build definition to queue.

    • For more information about how to specify the mappings, see Work with Build Workspaces.

  4. On the Build Defaults tab, to improve performance, choose This build does not copy output files to a drop folder.

  5. On the Process tab, under Build process template, the Default Template is selected by default. In the Items to Build parameter, specify the solutions or code projects that you want to build.

  6. On the Process tab, set the parameters to ensure that check-ins meet the specific standards for code quality of your team without delaying your developers unnecessarily.

    For more information, see Guidelines to Improve Build Process Function and Performance later in this topic.

  7. Specify build process options on the other tabs. For more information, see Create a Build Definition.

To minimize the time that is required to process the build, you should consider following these guidelines when you specify values for the build process parameters on the Process tab.

Required node

  • Items to Build, Configurations to Build: If you leave this parameter empty, the default platform and configuration is used for each solution and project. To optimize performance, adhere to the following guidelines:

    • If a platform-configuration pair builds more quickly than other pairs, specify it in this parameter.

    • Specify as few platform-configuration pairs as possible.

Basic node

  • Clean Workspace: For faster performance, set this value to None (recommended) or Outputs. However, your team is more likely to miss some types of defects, such as those introduced during refactoring, if the workspace is not cleaned. For more information, see Define a Build Process that is Based on the Default Template.

  • Perform Code Analysis: For faster performance, set this value to Never.

  • Source and Symbol Server Settings, Index Sources: For faster performance, set this value to False.

Advanced node

  • Agent Settings

    • Name Filter or Tags Filter: Use either a build agent name or a tag to bind this build definition to a build agent that is designed specifically for running this build. The build agent should run on hardware that is sufficiently powerful to process this build quickly enough to meet your team's performance expectations.

      For example, you and your team might not mind waiting 15 minutes for the build to finish. But you are not likely to want to wait eight hours before you can determine whether your code has successfully checked in.

    • Maximum Execution Time: Set this value to a reasonably small number. For example, 15 minutes might work for your team, but eight hours is probably too long.

  • Create Work Item on Failure: The system takes this value as False, even if you set it to True.

  • Disable Tests:

    • For faster performance, select True.

    • If your code must pass certain tests, select False, and then define a set of tests to run in the build. You can improve performance by running only the tests that you require. To designate those tests, filter them by either category or priority. For more information, see Run Tests in Your Build Process.

  • Label Sources: Set this value to False.

For more information about Default Template build process parameters, see Define a Build Process that is Based on the Default Template.

Each gated check-in build definition can have only one running build at a time. Therefore, large and active teams are more likely to develop a large queue of gated check-in builds. The following best practices can help you to avoid blocking team progress:

  • To increase the efficiency of your build process on the Trigger tab, select the Merge and build up to n submissions option and specify the maximum number of check-ins you want to build together in any given batch. In general, you don't risk much disruption by using this option. Each check-in is individually committed or rejected.

    For example, if three check-ins are built together in a batch and the build does not succeed, the system queues individual builds of all three check-ins.

    However, this option presents some risk of one check-in interfering with others. This can occur, for example, if multiple check-ins modify the same file and a version control conflict occurs. In this case, the earlier check-in is committed and the later check-ins are rejected.

  • Define the build so that the build agent does only the work that is required to validate the quality of code that is being checked in. For more information, see Guidelines for Settings on the Process Tab earlier in this topic.

  • Dedicate a build machine that has powerful hardware—for example, a fast processor and a fast hard disk—to the build agent that your gated check-in build definition uses.

Developers who want to feel more confident about the changes that they are checking in can manually queue a build of a shelveset. When they take this approach, they can specify one of two options for what the system does next if the build succeeds:

  • System checks in the changes (manual gated check-in build): This option can be handy for teams that do not want to require gated check-in but still want to enable developers to voluntarily validate their code before checking in.

  • System does not check in the changes (private build): Developers can use this option when they want to validate some changes in a shelveset but not check them in.

For more information, see Queue a Build.

Show:
© 2015 Microsoft