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

 

はじめる前に知っておくべき情報

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. プランを作成できる権限を持つユーザーとして Bamboo インスタンスにログインします。
  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:

      プロジェクト名TestProject
      プロジェクト キーTP
      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:

      ユーザ名Your Bitbucket username.
      パスワードYour Bitbucket password.
      リポジトリatlassian_tutorial/hellworld (git)
      ブランチmaster
      Use shallow clones (shallow clone を使用する)Set 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. プランを作成できる権限を持つユーザーとして Bamboo インスタンスにログインします。
  2. Choose Create >  Create a New Plan from the menu bar.

すべての計画がプロジェクトに属しています。まだプロジェクトがないため、[プロジェクト] > [新規プロジェクト] を選択して、プロジェクトと計画の両方についての詳細を入力します。

See Configuring plans for details.

2. ソース リポジトリを選択する

Bamboo はソース コード リポジトリがどこにあるかを知る必要があり、ビルド実行時にコードをチェックアウトできるよう、リポジトリにアクセスする必要があります。

ソース リポジトリからリポジトリ タイプを選択し、ユーザー名やパスワードなどのアクセス詳細を指定します。

See Connecting to code repositories for details.

3. ビルドをトリガーする

Bamboo がどのようにトリガーされて計画ビルドを実行するかを選択できます。

コードがリポジトリにチェックインされるたびに、Bamboo がプロジェクトをビルドするようにします。

[トリガーのタイプ] > [Repository triggers the build (... リポジトリはビルドをトリガー)] を選択して、オプションで、リポジトリ サーバーの IP アドレスを指定します。

See Triggering builds for details.

4. タスクの設定

計画ごとに 1 つ以上のタスクを指定する必要があります。タスクは計画の実際の作業を実行します。

ソース コード チェックアウト タスク

新しく作成された計画には、先ほど指定したソース リポジトリからソース コードを取得する既定のソース コード チェックアウト タスクがあります。

See Checking out code for details.

ビルダー タスク

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.

[タスクを追加] をクリックしてから [ビルダー] をクリックして、プロジェクトのビルド ツールに合ったタスクを選択します。次のセクションのいずれかを展開して、そのビルダー タスクに固有の設定詳細を表示します。

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

Bamboo では Maven 1.0 と 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.

注意:

テスト結果を取得する

ビルダー タスクによってコードがコンパイルされるとテストが実行されます。上記の各ビルダー タスクには、テスト結果が生成されること、およびテスト結果の保存場所を Bamboo に通知するセクションがあります。プロジェクト ディレクトリで従来の構造を使用していない場合は、結果が保存される場所を指定できます。

See Jobs and tasks for details.

5. 実行

計画を有効にして、[作成] をクリックします。

計画が実行されるのを確認できます。[プラン概要] タブにビルドが成功したかどうかが表示されます。

ソース コード リポジトリの適切なディレクトリでのテストは、ビルドの一部として自動的に実行され、そのテスト結果は Bamboo に表示されます。

これで、リポジトリに変更をコミットするたびに、Bamboo がソース コードをビルドしてテスト結果をレポートします。

フィードバックを取得する

Bamboo のダッシュボードにビルド結果の要約が表示されます。

ビルドに関する詳細情報は、次の方法で入手できます。

  • 1 つ以上の計画のビルド結果をウォールボードで確認できます。
  • ビルド結果に関する通知をメール、インスタント メッセージ (IM)、RSS フィードで受信できます。
  • 計画に関するビルド統計や、ビルドにコードを提供している開発者に関するビルド統計を取得できます。
  • 結果を掘り下げて、ビルドをトリガーしたコードの変更内容と、そのビルドに対して実行されたテストを確認できます。

See Getting feedback for details.

  • ラベルなし