Speed up Build Process

You are viewing an old version (v. 8) of this page.
The latest version is v. 21, last edited on Aug 06, 2009 (view differences | )
<< View previous version | view page history | view next version >>

Scenario

In a continuous integration environment, it is very important that a build can complete in a short time to provide feedback to developer as soon as possible after they submit a build verification request.

Solution

You can parallelizing CPU intensive build steps, and run them on different agent nodes. The results from different node can be collected back for further processing. Assuming a product comprises of component1 and component2, and both of them take a long time to build. You can parallelize build of component1 and component2 like below:

The node match condition property for these steps can be specified like below:

  • master: node.isAgent()
    this tells master step to run only on agent node (in order to reduce server load)
  • checkout: node==parent.node
    this tells step checkout to run on the same agent as the master step
  • build components: node==parent.node
    this tells step build components to run on the same agent as the master step
  • build component1: node.isAgent()
    this tells step build component1 to run on agent node selected by load balancing algorithem
  • build component2: node.isAgent()
    this tells step build component2 to run on agent node selected by load balancing algorithem
  • *package: node==parent.node
    this tells step package to run on the same agent as the master step
  • publish: node==parent.node
    this tells step publish to run on the same agent as the master step

The idea here is that step build component1 and build component2 is designed to run on least loaded agent nodes, while all other steps are running in the same agent node.

There are still problems: The nodes running step build component1 and build component2 are not guaranteed to be the same node running step checkout. How can we make sure that necessary files are available when build component1 and component2? The same issue exists when running step package, how to make sure that build results of component1 and component2 are available for packaging if the build steps and package step do not run on the same agent?

This is solved by specifying file requirements for steps. Let's assume that the agent node choosed to run master step is agent1, and the checkout step retrieves files into two folders into workspace resides on agent1: component1-src, and component2-src. Folder component1-src contains all files used to build component1, while folder component2-src contains all files used to build component2. Build results of comonent1 is saved to folder component1-binary, and build results of component2 is saved to folder component2-binary. Now we can specify file requirements as below:

  • for step build component1

    This will transfer folder component1-src (including all files inside it) from workspace of the agent running checkout step to the agent running step build component1
  • for step build component2

    This will transfer folder component2-src (including all files inside it) from workspace of the agent running checkout step to the agent running step build component2
  • for step package

    This will transfer:
    1. folder component1-binary (including all files inside it) from workspace of the agent running step build component1 to workspace of the agent running the package step.
    2. folder component2-binary (including all files inside it) from workspace of the agent running step build component2 to workspace of the agent running the package step.
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.