Bamboo CI integration

Using Flood with Bamboo in your continuous integration pipeline

The Flood API allows for continuous integration with popular tools like Bamboo. You can find out more about our API here. This post is a brief introduction to getting iterative performance tests up and running with Bamboo.

To access the API you will need your API Token, which can be found in your account settings.

Builder Tasks

Builder tasks allows you to connect your Bamboo plan (or job) to a build tool. The build tool uses its existing configuration when the plan (or job) is built. In this post we'll configure a Bamboo task that uses a Script to interact with the Flood IO API.

To configure a Script task:

  • Navigate to the Tasks configuration tab for the job (this will be the default job if creating a new plan).
  • Click the name of an existing Script task, or click Add Task and then Script to create a new task.
  • Complete the following settings:

Task Description

A description of the task, which is displayed in Bamboo. e.g. flood_test

Script Location

For the purpose of demonstration, we'll use inline however you could also pass in a location to the script.

Script Body

The following is a recommended shell script which will start a flood test, poll its status and when complete, write a text based copy of the report to your Bamboo logs.

set -e

command -v jq >/dev/null 2>&1 || { echo >&2 "Please install  Aborting."; exit 1; }

echo "[$(date +%FT%T)+00:00] Starting grid"
grid_uuid=`curl -X POST --silent --user ${FLOOD_API_TOKEN}: \
-F "grid[infrastructure]=demand" \
-F "grid[instance_quantity]=1" \
-F "grid[region]=ap-southeast-2" \
-F "grid[stop_after]=60" | jq -r ".response.uuid"`

while [ `curl --silent --user ${FLOOD_API_TOKEN}:${grid_uuid} | \
 jq -r '.response.status == "started"'` = "false" ]; do
 echo -n "."
 sleep 3

echo "[$(date +%FT%T)+00:00] Starting flood on grid ${grid_uuid}"
flood_uuid=`curl -X POST --silent --user ${FLOOD_API_TOKEN}: \
-F "flood[tool]=jmeter-2.13" \
-F "flood[threads]=10" \
-F "flood[privacy]=public" \
-F "flood[name]=${bamboo.buildPlanName}" \
-F "flood[notes]=${bamboo.buildNumber}" \
-F "flood[tag_list]=${bamboo.buildNumber}" \
-F "flood_files[]=@/Users/timkoopmans/Git/flood/flood-support/examples-jmeter/jmeter_1000rpm.jmx" \
-F "grid=${grid_uuid}" \
-F "region=ap-southeast-2" | jq -r ".response.uuid"`

echo "[$(date +%FT%T)+00:00] Waiting for flood to finish ${flood_uuid}"
while [ `curl --silent --user ${FLOOD_API_TOKEN}:${flood_uuid} | \
 jq -r '.response.status == "finished"'` = "false" ]; do
 echo -n "."
 sleep 3

flood_report=`curl --silent --user ${FLOOD_API_TOKEN}:${flood_uuid}/report | \
 jq -r ""`

echo "[$(date +%FT%T)+00:00] Detailed results at${flood_uuid}"
echo "${flood_report}"

echo "[$(date +%FT%T)+00:00] Stopping grid"
curl -X DELETE --silent --user ${FLOOD_API_TOKEN}:${grid_uuid}

You can include variables (see Bamboo variables). We're going to give the flood test the same name as the Bamboo plan name. In the flood notes we're also going to use the Bamboo build number. We're also going to attach a list of tags to make finding the results in flood easier based on the build number and type of test we're running.


Now whenever you execute your build, you can have performance tests executed for the same build via the Flood IO API. We'll leave it to you to get creative with the results, and whether or not to block build completion as we have done in this example, or just fire off longer running performance tests in the background, with results collected later.

Start load testing now

It only takes 30 seconds to create an account, and get access to our free-tier to begin load testing without any risk.

Keep reading: related stories
Return to the Flood Blog