You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I'm working on a CI system that uses the current git branch to look up a build key and start a build in Bamboo.
So far, I'm using the /plan/{projectKey}-{buildKey}/branch endpoint to get all the branches and their keys to look up the key for the branch I'm trying to build. The problem is that the default branch doesn't appear in this list.
For example, if I have project key PK and build key BK, I call /plan/PK-BK/branch and get something like this back (leaving out a bunch of keys):
{
"branches": {
"branch": [{
"shortName": "my-feature-branch",
"key": "PK-BK123"
}, {
"shortName": "second-feature-branch",
"key": "PK-BK234"
}]
}
}
If my CI server is trying to build my-feature-branch or second-feature-branch, this works fine.
But there's nothing I can find that maps the default branch name - the one I see if I just navigate to /browse/PK-BK in the UI - to the PK-BK build key. Nor have I found anything that goes the other way: knowing that PK-BK is the default, look up what branch name that is. I can't hard code the branch name ("if the current branch is develop, use the root build key") because I want this to work in multiple repos that might have different default branches.
Is there something in the API that can give me this info, or is there a better strategy entirely for mapping from git branch to build key?
Help from Atlasian? Is there a way to query the build status of the default branch via the REST API?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.