Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Trigger deployment project after another deployment project done

i have 10 deployment projects. is it possible to trigger all 10 deployment projects without manually trigger each one at a time?

4 answers

1 accepted

0 votes
Answer accepted

i end up using powershell to call REST Api.

  1. loop all deployment plans
  2. pickup all project with name "Production"
  3. get the latest release id (first one return) from each project
  4. trigger deploy plans using REST  API

below is my code if you are interested:

$username = "bambooUserName"
$password = "bambooPassword"
$deployEnv = "PRODUCTION"

function Get-Data([string]$httpMethod, [string]$url) {
$credPair = "$($username):$($password)"
$encodedCredentials = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($credPair))
$headers = @{ Authorization = "Basic $encodedCredentials" }
$responseData = Invoke-WebRequest -Uri $url -Method $httpMethod -Headers $headers -ContentType 'application/json; charset=utf-8' -UseBasicParsing
return $responseData

function TriggerLatestDeployByProjectId([string]$projectId){

$data = Get-Data -httpMethod Get -url http://localhost:9087/bamboo/rest/api/latest/deploy/project/$projectId.json
$dataToDict = $data | ConvertFrom-Json

$envId = ""
for ($i=0; $i -lt $dataToDict.environments.length; $i++) {
$env = $dataToDict.environments[$i]
If ($ -eq $deployEnv)
$envId = $

if ($envId)
$releaseId = ""
$data = Get-Data -httpMethod Get -url http://localhost:9087/bamboo/rest/api/latest/deploy/project/$projectId/versions.json
$dataToDict = $data | ConvertFrom-Json

$releaseId = $dataToDict.versions[0].id

if ($releaseId)
$data = Get-Data -httpMethod POST -url "http://localhost:9087/bamboo/rest/api/latest/queue/deployment/?environmentId=$($envId)&versionId=$($releaseId)"
$dataToDict = $data | ConvertFrom-Json
return "Sucess: resultId= $($dataToDict.deploymentResultId)"
return "Error: $($projectId) Missing releaseId"
return "Error: $($projectId) Missing EnvId"

function DeployAll()
$data = Get-Data -httpMethod Get -url http://localhost:9087/bamboo/rest/api/latest/deploy/project/all.json
$dataToDict = $data | ConvertFrom-Json

for ($i=0; $i -lt $dataToDict.length; $i++) {
$currProject = $dataToDict[$i]
$deployResultId = TriggerLatestDeployByProjectId -projectId $
"Result:$deployResultId $($ - $($"


0 votes
Jimmy Seddon Community Leader Oct 28, 2019

Hi @Sai Yu,

Sorry I shouldn't have assumed that you were trying to deploy environments from the same project.  In this case I think the only way you can accomplish this is to use a script task at the end of "project A environment A1" that uses an API call to trigger "project B enviroment B1".

You can see more about how to do that here:


I hope that helps!


@Jimmy Seddon 

I was looking at the Rest Api trigger deploy too. But the problem i am facing is how to get the latest versionId?


my build plan needs to do all these

  1. get the latest versionId by projectID **curl rest/api/latest/deploy/project/7405569/versions'
  2. save it as variable (how to read response and how to save it as variable to use on the next step)
  3. use it on the curl command? (call another Rest Api using variable)


curl -X POST 'http://localhost:9087/bamboo/rest/api/latest/queue/deployment/?environmentId=7536641&versionId=28803073' 




thanks @Jimmy Seddon  for the quick reply.


The "after successful deployment" trigger only allow me to select deployment within the project. i need to be able to trigger different deployment project.


what i need to do is "project A environment A1" trigger deploy after successfully deployed "project B enviroment B1".

0 votes
Jimmy Seddon Community Leader Oct 25, 2019

Hello @Sai Yu

Welcome to the Community!

Yes you can do this, what you will need to do is on each environment you wish to deploy automatically.  Edit the environment, and select triggers:


Then you will want to click the add trigger button and select what type of trigger you would like to execute:


In the example above I'm using the successful completion of another deployment environment, but there are some other options as well.  This will automatically trigger the deployment of this environment when the trigger conditions are met.  You can use this to setup multiple environments the same way so they will all automatically trigger under the same conditions.

I hope that helps!


Suggest an answer

Log in or Sign up to answer

Atlassian Community Events