Atlassian Bamboo

note: This guide is now considered legacy and use of the new API is recommended. A high level guide to migrate to the new API can be found here.

Generate an External Auth Token for your build server to use from your Raygun User Settings page


In your Bamboo Deployment project, create a new Script task. Give it a description and use the following inline shell script as the script body:

# Run the script in bash rather than sh
if [ "$(ps -p "$$" -o comm=)" != "bash" ]; then
    bash "$0" "$@"
    exit "$?"
fi

url="https://app.raygun.com/deployments?authToken=${bamboo.raygun.authToken}"

read -d '' deployment <<- EOF
{
    apiKey: \"${bamboo.raygun.apiKey}\",
    version: \"${bamboo.deploy.version}\",
    ownerName: \"${bamboo.ManualBuildTriggerReason.userName}\",
    comment: \"${bamboo.resultsUrl}\"
}
EOF

echo "$deployment"

curl -H "Content-Type: application/json" -d "$deployment" $url

if [ "$?" -ne "0" ]; then
    echo "Could not send deployment details to Raygun"
    exit 1
fi

In your Bamboo Deployment project, create a new Script task. Give it a description, then tick the 'Run as Powershell script' option. Use the following inline Powershell script as the script body:

Write-Host "Adding deployment in Raygun"

$ownerName = '${bamboo.jira.username}'
if($ownerName -eq '${bamboo.jira.username}')
{
    ownerName = 'Build Server'
}

$command = ConvertTo-Json @{
    apiKey = '${bamboo.raygun.apiKey}'
    version = '${bamboo.deploy.version}'
    ownerName = $ownerName
    comment =' ${bamboo.resultsUrl}'
    scmIdentifier = '${bamboo.repository.revision.number}'
}

$url = "https://app.raygun.com/deployments?authToken=" + '${bamboo.raygun.authToken}'
try {
    Invoke-RestMethod -Uri $url -Body $command -Method Post -ContentType "application/json"
    Write-Host "Added deployment in Raygun"
} catch {
    Write-Host "Error received when adding deployment in Raygun: " $_
}

Add the following Variables to your Deployment Configuration: raygun.apiKey, and raygun.authToken.

raygun.apiKey should be set your Raygun Application's ApiKey (the same one you use to set Raygun up within your app).

raygun.authToken should be set to the External Auth Token you generated in Step 1.


Deploy your application and watch the deployments roll in!