A Docker Compose setup for testing Atlassian Bamboo CI/CD server with a custom agent.
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
- Docker
- Docker Compose
-
Start all services:
docker compose up -d
-
Access Bamboo Server:
- Open your browser to
http://localhost:8085
- Open your browser to
-
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 configurationfor the remote agent (which actually runs the builds) to be able to connect to the Bamboo server. I set theBroker URLtonio://0.0.0.0:54663?wireFormat.maxInactivityDuration=90000&transport.soWriteTimeout=45000and theBroker client URLtofailover:(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
-
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- Port:
8085(HTTP),54663(RMI) - Image:
atlassian/bamboo-server:latest - Data: Persisted in
bamboo_homevolume
- Image: Custom build from
Dockerfile - Features:
- Go programming language
- gotestsum for test execution
- Pre-configured to connect to Bamboo server
- Image:
postgres:15 - Database:
bamboodb - User:
bamboo - Password:
bamboopass - Data: Persisted in
db_datavolume
bamboo_home: Bamboo server data and configurationdb_data: PostgreSQL database data
ATL_JDBC_URL: Database connection URLATL_JDBC_USER: Database usernameATL_JDBC_PASSWORD: Database passwordATL_DB_DRIVER: Database driver classATL_DB_TYPE: Database type
BAMBOO_SERVER: URL of the Bamboo server
docker compose downTo remove volumes (
docker compose down -v- The
trunk-analytics-clibinary inbin/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