Skip to main content
Version: QB13

Set Up Build Dependency

It is quite common that a product is comprised of different components, and a component is used by different products. We suggest to set up builds for these components and products separately in this case, and utilize QuickBuild's dependency mechanism to use result of component builds in product builds.

Dependency mechanism

QuickBuild implements build dependency through a special repository type - QuickBuild Repository. Assume we have two configurations: root/product and root/component . Configuration root/product is created to build the product, and configuration root/component is created to build component. To use component artifacts, you will need to:

  1. Switch to repositories tab of root/product , and define a QuickBuild repository there retrieving desired files from desired build of root/component.
  2. Switch to steps tab of root/product, and add a checkout step into step execution graph to check out from the repository defined above.

If the product depends on multiple components, you will just need to define multiple QuickBuild repositories corresponding to these components, and add multiple checkout steps to check out from these repositories in the product configuration. You can even arrange these checkout steps in a parallel composition step to resolve and retrieve multiple dependencies simultaneously.

Dependency resolution and change detection

Taking the example used in the above section, before retrieving artifacts from configuration root/component , QuickBuild needs to determine which build in root/componentA to be used. The process of resolving dependency build is called dependency resolution in QuickBuild, and is controlled by the property build when define the QuickBuild repository as shown below:

Currently this property can take one of below value:

  • latest finished build (generate new if necessary)
    If this value is selected, QuickBuild will check if a new build is necessary in the dependency configuration (root/component in this case) when resolve the dependency build. If the build is necessary, the newly generated build will be used as the actual dependency build; otherwise, the current latest finished build will be resolved.
    Variables can be specified to control the dependency build process in this case.
  • latest finished build
    If this value is selected, QuickBuild will directly resolve the dependency build as the latest finished build without attempting to generate a new build in the dependency configuration even if build condition is satisfied.
  • latest recommended build
    If this value is selected, QuickBuild will resolve the dependency build as the latest recommended build. This is very useful to make sure that the product builds always use good and approved builds from component configurations. Newly introduced features in component builds will not affect product builds unless they are approved.
  • latest successful build
    If this value is selected, QuickBuild will resolve the dependency build as latest successful build.
  • specify a build version
    If this option is choosed, you will need to specify a particular build version to be used as dependency build.

The dependency resolution process is recursive if the dependency configuration itself uses other dependencies. In this case, other dependency resolution processes will be triggered before current resolution finishes.

Like other repository types, changes will be detected in the QuickBuild repository when configuration root/product is triggered. When detecting changes, the dependency resolution process will run to get the actual dependency build. If the resulted dependency build is different from the dependency build used in previous build, QuickBuild will think that the dependency has changed and new build will be generated if the configuration is triggered by scheduler or by a recursive dependency resolution process.

Dependency types

Different dependency types are defined based on different resolution processes introduced above:

  • {#SetUpBuildDependency-activedependency} Active dependency
    This dependency refers to the dependency setup with resolution process set to "latest finished build (generate new if necessary)". It is called active since the resolution process can trigger new build in dependency configuration. We call configuration project1 actively depends on configuration project2 if project1 has an active dependency on project2.
  • {#SetUpBuildDependency-passivedependency} Passive dependency
    This dependency refers to the dependency setup with resolution process set to "latest finished build", "latest recommended build", and "latest successful build". It is called passive since the resolution process itself will never trigger a build actively. However, if there is a new build generated matching the criteria, it will be used as the new dependency. We call configuration project1 passively depends on configuration project2 if project1 has a passive dependency on project2.
  • {#SetUpBuildDependency-staticdependency} Static dependency
    This dependency refers to the dependency setup with resolution process set to "specify a build version". It is called static since the dependency build will remain unchanged unless another build is specified by the user.

Having explained dependency types, let is assume that configuration project1 actively depends on project2 , and project2 actively depends on project3 . If project3 has new source commits since last build, triggering of project1 will generate new build in project3 , project2 and project1 in turn.

Check dependent builds

In a continuous integration environment, when build/test a configuration, it is sometimes desirable to check if configurations depending on current build are successful or not. If dependent builds are failed, the dependency build will be marked as failed to indicate that it breaks the dependents. To achieve this, you will need to:

  1. Make sure the dependent configurations you want to check have an active dependency on the current configuration.
  2. Add an additional step Trigger Other Builds into step execution graph of the dependency configuration, and configure it to trigger desired dependent configurations. Dependent configurations specified here will be triggered parallely.

Future versions will add a dependent trigger step to find out configurations actively depending on current configuration automatically, and trigger them parallely.

Track build dependencies

Used dependencies in a particular build can be examined from the build overview page as explained here.