Skip to content

max-trunk/local-bamboo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Bamboo Test Environment

A Docker Compose setup for testing Atlassian Bamboo CI/CD server with a custom agent.

Overview

This project provides a complete Bamboo testing environment with:

  • Bamboo Server: Atlassian Bamboo CI/CD server
  • Bamboo Agent: Custom agent with Go and gotestsum pre-installed
  • PostgreSQL Database: Database backend for Bamboo

Prerequisites

  • Docker
  • Docker Compose

Quick Start

  1. Start all services:

    docker compose up -d
  2. Access Bamboo Server:

    • Open your browser to http://localhost:8085
  3. Setup Bamboo Server:

    • You'll need an Atlassian License key associated with your local server instance. Spinning up your server for the first time will generate a server ID, and that ID will be persistent on server restart so long as don't clear your Postgres database's data
    • I had to tweak the default Bamboo JMS broker configuration for the remote agent (which actually runs the builds) to be able to connect to the Bamboo server. I set the Broker URL to nio://0.0.0.0:54663?wireFormat.maxInactivityDuration=90000&transport.soWriteTimeout=45000 and the Broker client URL to failover:(tcp://bamboo:54663?wireFormat.maxInactivityDuration=90000)?initialReconnectDelay=15000&maxReconnectAttempts=10
    • Then, on every server startup, the remote agent will connect to the server, but access will need to be approved. You can approve access by clicking the gear in the top-right > Agents > Agent authentication
  4. Configure your Plan (workflow):

    • You'll want to link your Bamboo server with a repository to be able to check it out. You can set that up in the Repositories tab
    • Then, create a Plan with a default Job that checks out the repo (Checkout Task), runs a test command (Script Task), then invokes the analytics CLI (Final Task). You can also configure your Plan to automatically run when pull requests are created or branches are created in the source repo at > Actions > Configure Plan > Branches
    • Here's a scaffold of a Plan configuration expressed as a Spec:
version: 2
plan:
  project-key: <YOUR_PROJECT_KEY>
  key: <YOUR_PROJECT_KEY>
  name: Run Tests and Upload to Trunk.io

Run Tests and Upload to Trunk:
  key: <YOUR_JOB_KEY>
  tasks:
    - checkout:
        description: Checkout Source Code
        
    - script: ... # Script to run your tests

  final-tasks: # Upload your test results as a final task
    - script:
        name: Upload Test Results to Trunk.io
        body: |
          curl -fsSLO --retry 3 https://trunk.io/releases/trunk
          chmod +x ./trunk
          ./trunk flakytests upload --junit-paths "**/junit.xml" --org-url-slug <TRUNK_ORG_SLUG> --token ${bamboo.TRUNK_TOKEN}

variables:
  # Store your Trunk Token as a plan variable (Mark as 'Secret' in Bamboo UI)
  TRUNK_TOKEN: <YOUR_TRUNK_TOKEN>

branches: # create a plan branch on PRs to upload from PRs
  create:
    for-pull-request:
      accept-fork: false

Services

Bamboo Server

  • Port: 8085 (HTTP), 54663 (RMI)
  • Image: atlassian/bamboo-server:latest
  • Data: Persisted in bamboo_home volume

Bamboo Agent

  • Image: Custom build from Dockerfile
  • Features:
    • Go programming language
    • gotestsum for test execution
    • Pre-configured to connect to Bamboo server

PostgreSQL Database

  • Image: postgres:15
  • Database: bamboodb
  • User: bamboo
  • Password: bamboopass
  • Data: Persisted in db_data volume

Volumes

  • bamboo_home: Bamboo server data and configuration
  • db_data: PostgreSQL database data

Environment Variables

Bamboo Server

  • ATL_JDBC_URL: Database connection URL
  • ATL_JDBC_USER: Database username
  • ATL_JDBC_PASSWORD: Database password
  • ATL_DB_DRIVER: Database driver class
  • ATL_DB_TYPE: Database type

Bamboo Agent

  • BAMBOO_SERVER: URL of the Bamboo server

Stopping the Environment

docker compose down

To remove volumes (⚠️ this will delete all data, including your server configuration & persistent server ID linked to your license key):

docker compose down -v

Notes

  • The trunk-analytics-cli binary in bin/ can be mounted into the agent container for testing locally-built CLI tools
  • Default database credentials are for development only - change them for production use

About

A local Bamboo setup w/ docker compose to test the Trunk Analytics CLI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors