This page describes how to use Bamboo to get rapid feedback on your Java project. The example on this page builds a Bamboo plan where a developer commits code and Bamboo responds by:

  • Connecting to the code repository.
  • Checking out the source code.
  • Compiling the code
  • Running unit and integration tests
  • Reporting back test results

 

Information you need before you begin

This tutorial assumes you are using Bamboo OnDemand rather than Bamboo installed on your local network.  This allows the tutorial to make some basic assumptions about the resources available to Bamboo.  You can still use the tutorial if you are using Bamboo on a local network. You just need to make sure you or your company administrator have properly installed and configured Bamboo for running plans.

This tutorial relies on you having an individual Bitbucket account.  If you don't have one, it only takes minutes to create one.  You can always delete it after you are done.  

Step 1. Create a plan and run a build

A Bamboo plan defines the details of your continuous integration workflow.  You use a plan to identify the source code repository, specify the tasks to run in your build, and when to trigger a build.  Each plan belongs to a project.  You can add a plan to an existing project or create a new project. In this example, you create both a new project and a new plan in that project.

  1. Log into your Bamboo instance as a user with permissions to create plans.
  2. Choose Create Plan from the menu bar.
    The Create Plan page displays.  
  3. Complete the Plan Details section as follows:
    1. Select New Project from the Project drop down.
    2. Enter the following in the remaining fields:

      Project NameTestProject
      Project KeyTP
      Plan NameTutorials
      Plan KeyTUT
      Plan DescriptionBuild atlassian tutorials
  4. Complete the Source Repositories section as follows:
    1. Choose Bitbucket for the Source Repository.
    2. Complete the remaining fields:

      UsernameYour Bitbucket username.
      PasswordYour Bitbucket password.
      Repositoryatlassian_tutorial/hellworld (git)
      Branchmaster
      Use shallow clonesSet this checkbox
  5. Take the defaults for Trigger section.
  6. Press Configure Tasks.
    The Configure Tasks page displays.
  7. Leave the default task which is Source Code Checkout.
  8. Check Yes please! 
  9. Press Create.
    The Plan Summary page displays and Bamboo starts running your plan.  When the plan completes, a success message appears.

Step 2. Configure the plan details

and how Bamboo should report test results.  To create a plan, do the following:

  1. Log into your Bamboo instance as a user with permissions to create plans.
  2. Choose Create >  Create a New Plan from the menu bar.

Every plan belongs to a project. We don't have a project yet, so choose Project > New Project, and enter details for both the project and plan.

See Configuring plans for details.

2. Choose a source repository

Bamboo needs to know where the source code repository is located, and needs access to the repo so that it can check out the code when it runs a build.

Choose the repository type from Source Repository, and provide access details such as username and password.

See Connecting to code repositories for details.

3. Triggering the build

We can choose how Bamboo gets triggered to run the plan build.

We want Bamboo to build the project whenever code is checked into the repository.

Choose Trigger type > Repository triggers the build..., and optionally, specify an IP address for the repository server.

See Triggering builds for details.

4. Configure tasks

Each plan needs to have one or more tasks specified. Tasks do the real work of the plan.

The source code checkout task

A newly created plan has a default Source Code Checkout task that gets the source code from the source repository specified earlier.

See Checking out code for details.

The builder task

We also want to compile the code, and run the unit and integration tests. We'll add a builder task to the Bamboo plan to do that. We assume that your project already has a build process set up that Bamboo can call upon.

Click Add Task, then Builder and choose the task that matches the build tool for your project. Expand one of the following sections to see configuration details specific to that builder task:

See http://ant.apache.org/manual/index.html for information about Ant.

Bamboo also supports Maven 1.0 and Maven 2.0.  

See http://ant.apache.org/manual/index.html for information about Maven.

See http://grails.org/doc/latest/guide/index.html for information about Grails.

Note that:

Getting the test results

Your tests will be run when the builder task compiles the code. Each of the builder tasks above has a section to tell Bamboo to expect test results and where to look for them. You can specify a custom results location if your project directory doesn't use the conventional structure.

See Jobs and tasks for details.

5. Go!

Enable the plan, and click Create.

You should see the plan run. The 'Plan Summary' tab will report whether the build succeeded or not.

Tests in the appropriate directory in the source code repository will be run automatically as part of the build, and the test results will be displayed in Bamboo.

Now, whenever you commit a change to the repository, Bamboo will build your source code and report on your test results.

Get feedback

Bamboo displays a summary of the results of the build on the dashboard.

You can get further information about the build in the following ways:

  • Build results for one or more plans can be displayed on a wallboard.
  • You can get notifications about build results sent to you by email, IM and RSS feed.
  • You can get build statistics about plans, and about developers contributing code to the build.
  • You can drill down into the results to see the code changes that triggered the build, and the tests that were run for that build.

See Getting feedback for details.

  • No labels