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

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

Avatar

1 badge earned

Collect

Participate in fun challenges

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

Challenges
Coins

Gift kudos to your peers

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

Recognition
Ribbon

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!

Leaderboard

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
4,464,541
Community Members
 
Community Events
176
Community Groups

How to get deploymentResultId using REST API?

How can I get deploymentResultId for specific deployment?

1 answer

1 accepted

1 vote
Answer accepted

Hello @Dmitrij Kultasev

I hope you are doing great!

Let me share a couple of steps you can use to get this information knowing just the plan associated with a given deployment.

  1. Get the <PLAN_KEY> and run the following request:
     curl -u <USER>:<PASSWORD> \
    -X GET -p <BAMBOO_URL>/rest/api/latest/deploy/project/forPlan?planKey=<PLAN-KEY> \
    | jq -r '.[] | "Name: " + .name + "\tdeploymentId: " + (.id|tostring)'
    It should give you a result like:
     Name: <DEPLOYMENT_NAME>       deploymentId: <DEPLOYMENT_ID>
  2. Get the <DEPLOYMENT_ID> and run:
    curl -u <USER>:<PASSWORD> \
    -X GET -p '<BAMBOO_URL>/rest/api/latest/deploy/project/<DEPLOYMENT_ID>' \
    | jq -r '.environments[] | "Name: " + .name + "\tenvironmentId: " + (.id|tostring)'
     As a result, you should get:
     Name: <ENVIRONMENT_NAME>      environmentId: <ENVIRONMENT_ID>
  3. Following the same idea, get the <ENVIRONMENT_ID> and run:
    curl -u <USER>:<PASSWORD> \
    -X GET -p '<BAMBOO_URL>/rest/api/latest/deploy/environment/<ENVIRONMENT_ID>/results' \
    | jq -r '.results[] | "Version" + .deploymentVersionName + "\tdeploymentResultId:" + (.id|tostring)'
    This one should give you the deploymentResultId you need:
     Version: release-XX deploymentResultId: <ENVIRONMENT_RESULT_ID> 

    ⚠️Please notice that the above request use both jq (command-line JSON processor) to simplify filtering the results.

 

I hope that helps.

@Daniel Santos  that's not what I needed. That's the ID I'm looking for to be used in  /deploy/result/{deploymentResultId} .

I might go wrong direction, but I want to find last successful deployment for specific plan.

Screenshot_6.png

Hi @Dmitrij Kultasev

Please give the steps above a chance. They will give you exactly a list of deploymentResultIds for a given environment.

This is the relationship between the plan and a  given deploymentResultId:

  • Build plan >> Deployment Project Id >> Deployment Environment Id >> deploymentResultId

I just tested these steps again. They should give you exactly what you want.
Please let me know if you face any issues to follow them.

yes, that works. Sorry.

No worries, sorry for not being clear in my first message.
I see you in the next thread!

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events