You may want to trigger a plan build when another plan's build has successfully completed. This ensures that changes to any job's source code associated with one plan does not break the build of another dependent plan (known in this context as a 'child' plan). For example, there could be two plans in Bamboo:
In this scenario, the Acme – Plugin plan is a child of Acme – Core. Any changes to source code associated with the Acme – Core plan should trigger a build of Acme – Plugin. In turn, every time a Acme – Plugin plan build completes successfully, you may want to run builds for some additional plans (e.g Acme – Functional Tests and Acme – Unit Tests). In this case, Acme – Plugin is a parent of the Acme – Functional Tests and Acme – Unit Tests plans, as well as being a child of the Acme – Core plan. |
Manual dependency management
To trigger a build when another build finishes:
- Click Dashboard and then the All Plans tab.
- Locate the plan in the list and click the edit icon
to display the plan's Configuration pages.
- Click the Dependencies tab
- Locate the 'Manual Dependency Management' section — all plans in your Bamboo system (other than the one you are configuring) are listed in the 'Child plans' and 'Parent plans' sections. Select plans in the following subsections:
- Child plans — Plans whose builds you want triggered as a result of successful completion of the plan you are configuring.
- Parent plans — Plans whose successful completion will trigger a build of the plan you are configuring. Any other plans in your Bamboo system that specify build dependencies, with the plan you are configuring, will have their check boxes selected.
- Click Save.
Automatic dependency management with Maven 2
Automatic Dependency Management is a feature for users who use Maven 2 and wish for their Parent and Child dependencies to be setup according to the dependencies in the Maven pom.xml. Every time the plan is run, the Bamboo Automatic Dependencies are updated to reflect any additions or removals of Maven dependencies.
To setup automatic dependency management:
- Click Dashboard and then the All Plans tab.
- Locate the plan in the list and click the edit icon
to display the plan's configuration pages.
- Locate the job that contains the pom.xml you wish to use to automatically update plan dependencies by analysing a Maven pom file.
- Choose Actions > Configure Job.
- Click on the Tasks tab.
Click Add Task and add the Maven Dependency Processor task to the job. For best results, ensure that the task runs last by dragging it to the bottom of the task list. For more information on configuring tasks, see Configuring tasks.
Setting Notes Override Project File Optional. The location relative to the working directory or sub-working directory where the project file (pom.xml) is located. Working Sub Directory Optional. The sub directory from which the Task should look for the project file (pom.xml) Alternate location of settings.xml Optional. Specify an alternate settings.xml to be used if the Task needs to resolve dependencies from specific Maven repositories. Path to Maven local repository Optional. Specify a full path to a local Maven repository for the Task to use to resolve dependencies. - Click Save.
- Use the Plan Navigator to return to the plan.
- Click the Dependencies tab.
- Select Automatic Dependency Management. You should see the name of the job for which you configured the Maven Dependency Processor appear.
- Click Save.
Dependency blocking
Dependency blocking is an advanced feature of dependent build triggering that can be used to manage plan builds with parent build dependencies. This ensures that a "tree" of dependent builds always runs in tree hierarchy order, even if child plan builds are triggered independently of their parents. For more information, see Dependency blocking strategies. Please note, dependency blocking only works when the plan uses a build strategy based on source code updates.
Notes
Build dependencies work together with the build strategies of plans to trigger builds of these plans. For example, you can set up Plan A to poll its repository for changes as well as configure a build dependency on a parent plan (Plan B). In this case, builds of Plan A will be triggered when code changes are detected in its repository and also when builds of Plan B complete successfully.
If you want your builds to only be triggered by successful parent builds from your build dependencies, you can do this by specifying Manual as the build strategy for your plan. See Triggering a plan build manually.
- If the child build uses the same source as the parent build (for example, the Subversion URL is the same), the child build will be forced to check out the same revision of source code as the parent build. This ensures that builds are consistent when triggering one build from another.
- Take care not to create circular dependencies, where your child build triggers one of its parent builds. Otherwise your plans may build continuously. See Triggering a plan build manually.