Bamboo
CI/CDツール
Bamboo
概要
BambooはAtlassianのエンタープライズ向けCI/CDサーバーです。Atlassian製品群との緊密な統合、堅牢なビルド管理、エンタープライズレベルのセキュリティ機能が特徴ですが、2024年2月にサーバー版のサポートが終了し、Bitbucket Pipelinesへの移行が推奨されています。
詳細
Bamboo(バンブー)は、Atlassianが提供するエンタープライズ向けのCI/CD(継続的インテグレーション・継続的デリバリー)サーバーとして長年にわたり多くの企業で採用されてきました。最新の安定版であるBamboo 8.0は2021年7月にリリースされ、ビルドレジリエンス、認証情報暗号化、Java 11へのプラットフォーム更新等のデータセンター・エンタープライズ機能に重点を置いています。重要な変更として、Atlassianは2024年2月15日をもってBamboo Serverエディションのサポート終了を発表しました。現在、既存ユーザーには段階的にBitbucket Pipelinesへの移行が推奨され、Bamboo Data Centerも提供予定ですが詳細は未発表です。Jira、Bitbucket、Confluenceとの深い統合により、Atlassianエコシステム内でシームレスなDevOpsワークフローを実現します。マルチステージビルドプラン、コミット時の自動トリガー、重要なビルドとデプロイメントへのエージェント割り当てが可能で、並列自動テストによりアジャイル開発を強力にサポートします。エンタープライズセキュリティとしてロールベースアクセス制御(RBAC)、LDAP・Active Directory認証に対応し、AWS CodeDeploy、Amazon S3、Dockerとの統合により幅広い技術スタックをサポートします。
メリット・デメリット
メリット
- Atlassian統合: Jira、Bitbucket、Confluenceとの深い連携
- エンタープライズセキュリティ: RBAC、LDAP/AD認証対応
- ビルドレジリエンス: 高可用性とスケーラビリティ
- デプロイメント自動化: 環境ごとの権限制御付きデプロイ
- ブランチ管理: Git/Mercurialの分散VCSとの最適化
- Jenkinsマイグレーション: ビルド設定の簡単インポート
- 並列処理: マルチエージェントによる並列ビルド・テスト
- AWS/Docker統合: モダンなクラウド・コンテナ環境対応
デメリット
- サーバー版サポート終了: 2024年2月でサポート終了済み
- 移行の必要性: Bitbucket Pipelinesまたは他ツールへの移行必須
- ライセンスコスト: エンタープライズ向けの高いライセンス費用
- 設定の複雑さ: 大規模環境での設定管理の複雑性
- アップデート頻度: 最新機能追加の頻度低下
- Cloud移行課題: オンプレミスからクラウドへの移行負荷
- 競合優位性: Jenkins、GitLab等との機能格差拡大
主要リンク
- Bamboo公式サイト
- Bamboo Documentation
- Bamboo から Bitbucket Pipelines への移行
- Atlassian Server サポート終了情報
- Bamboo REST API
- Bitbucket Pipelines
書き方の例
基本的なビルドプラン設定
# bamboo.yml (Bamboo 仕様書)
version: 2
# ビルドプランの定義
build-plan:
project-key: PROJ
plan-key: BUILD
plan-name: "Node.js Application Build"
# ステージとジョブの定義
stages:
- stage-name: "Build and Test"
jobs:
- job-name: "Build Job"
key: BUILD-JOB
artifacts:
- name: "dist"
pattern: "dist/**"
tasks:
- checkout-task
- script-task:
description: "Install Dependencies"
script: |
npm ci
npm run build
- script-task:
description: "Run Tests"
script: |
npm test
npm run coverage
final-tasks:
- test-parser-task:
type: "junit"
test-results: "**/test-results.xml"
# エージェント要件
agent-requirements:
- system.builder.node.version: "18"
- system.os.name: "Linux"
# 変数設定
variables:
- NODE_ENV: "test"
- BUILD_TYPE: "production"
Jira統合とリリース管理
# Bamboo Jira Integration Plan
plan-configuration:
project: MYPROJ
plan: RELEASE
stages:
- stage-name: "Build and Package"
jobs:
- job-name: "Build Application"
tasks:
- checkout-task
- script-task:
description: "Build Application"
script: |
npm ci
npm run build
tar -czf app-${bamboo.buildNumber}.tar.gz dist/
artifacts:
- name: "application-package"
pattern: "app-*.tar.gz"
- stage-name: "Deploy to Staging"
jobs:
- job-name: "Deploy Staging"
requirements:
- staging-environment
tasks:
- artifact-download-task:
artifact: "application-package"
- script-task:
description: "Deploy to Staging"
script: |
tar -xzf app-${bamboo.buildNumber}.tar.gz
aws s3 sync dist/ s3://staging-bucket/
# Jira統合 - デプロイ情報の更新
final-tasks:
- jira-task:
action: "transition-issue"
jql: "project = PROJ AND status = 'In Progress'"
transition: "Deploy to Staging"
comment: "Deployed build ${bamboo.buildNumber} to staging environment"
# デプロイメントプロジェクト設定
deployment-project:
name: "Application Deployment"
environments:
- name: "Staging"
tasks:
- script-task:
script: |
echo "Deploying to staging..."
kubectl apply -f k8s/staging/
- name: "Production"
approval-required: true
tasks:
- script-task:
script: |
echo "Deploying to production..."
kubectl apply -f k8s/production/
Docker統合とコンテナビルド
# Docker Integration Plan
version: 2
plan:
project-key: DOCKER
plan-key: BUILD
stages:
- stage-name: "Docker Build and Push"
jobs:
- job-name: "Docker Build"
docker:
image: "docker:latest"
requirements:
- system.docker.executable
tasks:
- checkout-task
- script-task:
description: "Build Docker Image"
script: |
docker build -t myapp:${bamboo.buildNumber} .
docker tag myapp:${bamboo.buildNumber} myapp:latest
- script-task:
description: "Run Container Tests"
script: |
docker run --rm myapp:${bamboo.buildNumber} npm test
- script-task:
description: "Push to Registry"
script: |
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
docker push myapp:${bamboo.buildNumber}
docker push myapp:latest
variables:
- DOCKER_USERNAME: "${bamboo.docker.username}"
- DOCKER_PASSWORD: "${bamboo.docker.password}"
# AWS統合設定
aws-configuration:
region: "us-west-2"
tasks:
- aws-codedeploy-task:
application-name: "myapp"
deployment-group: "production"
s3-bucket: "deployment-artifacts"
s3-key: "app-${bamboo.buildNumber}.tar.gz"
マルチブランチとパラレルビルド
# Multi-branch and Parallel Build Configuration
plan-branches:
# メインブランチの設定
master:
create-manually: false
cleanup-manually: false
# フィーチャーブランチの自動検出
feature-branches:
pattern: "feature/*"
auto-create: true
cleanup-after-days: 7
# リリースブランチ
release-branches:
pattern: "release/*"
auto-create: true
cleanup-manually: true
# パラレルステージ設定
stages:
- stage-name: "Parallel Tests"
jobs:
- job-name: "Unit Tests"
parallel: true
tasks:
- script-task:
script: |
npm run test:unit
- job-name: "Integration Tests"
parallel: true
tasks:
- script-task:
script: |
npm run test:integration
- job-name: "E2E Tests"
parallel: true
tasks:
- script-task:
script: |
npm run test:e2e
- stage-name: "Build and Deploy"
depends-on: ["Parallel Tests"]
jobs:
- job-name: "Build and Deploy"
tasks:
- script-task:
script: |
npm run build
npm run deploy
# エージェント管理
agents:
local-agents:
- name: "build-agent-1"
requirements:
- system.os.name: "Linux"
- system.builder.mvn.version: "3.6"
remote-agents:
- name: "aws-build-agent"
type: "elastic"
instance-type: "m5.large"
CI/CDパイプラインとBitbucket統合
# Bitbucket Integration and Advanced Pipeline
bitbucket-integration:
repository:
url: "https://bitbucket.org/myteam/myapp"
branch-detection: "automatic"
webhook-triggers: true
# 高度なトリガー設定
triggers:
- type: "repository-polling"
cron: "0 */5 * * * ?"
- type: "bitbucket-webhook"
events: ["push", "pull-request"]
- type: "scheduled"
cron: "0 2 * * *"
description: "Nightly build"
# 通知設定
notifications:
- type: "email"
events: ["build-failed", "build-successful"]
recipients: ["[email protected]"]
- type: "hipchat"
room: "devops"
events: ["build-failed"]
- type: "jira"
update-issues: true
jql: "project = MYPROJ AND status = 'In Progress'"
# 環境変数とセキュリティ
security:
variables:
- name: "API_KEY"
value: "${bamboo.vault.api.key}"
encrypted: true
- name: "DATABASE_URL"
value: "${bamboo.vault.db.url}"
encrypted: true
permissions:
- user: "admin"
permissions: ["admin", "build", "clone"]
- group: "developers"
permissions: ["build", "view"]
# 品質ゲートとレポート
quality-gates:
- type: "test-coverage"
threshold: 80
fail-build: true
- type: "code-quality"
sonarqube-task:
server: "sonar.company.com"
project-key: "myapp"
Bamboo から Bitbucket Pipelines への移行例
# bitbucket-pipelines.yml (移行後の設定例)
image: node:18
pipelines:
default:
- step:
name: Build and Test
caches:
- node
script:
- npm ci
- npm run build
- npm test
artifacts:
- dist/**
branches:
main:
- step:
name: Build and Test
caches:
- node
script:
- npm ci
- npm run build
- npm test
artifacts:
- dist/**
- step:
name: Deploy to Production
deployment: production
script:
- aws s3 sync dist/ s3://production-bucket/
- aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_ID --paths "/*"
pull-requests:
'**':
- step:
name: Build and Test PR
script:
- npm ci
- npm run build
- npm test
# Dockerコンテナでのビルド
definitions:
caches:
sonar: ~/.sonar/cache
services:
postgres:
image: postgres:13
variables:
POSTGRES_DB: testdb
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass