I try to use the variable ${bamboo.repository.name} in further tasks, but it's always substituted with name of the same branch.
Example:
I push on "Branch", the variable has the value "Branch".
I push on "Master", the variable has the value "Branch"... but normally it should have the value "Master", shouldn't it?
Is there another variable to figure out the name of the branch to which something was pushed?
Hello,
Yes you need to use branch variable stated in the documentation. What you are using is repository name variable.
https://confluence.atlassian.com/bamboo/bamboo-variables-289277087.html
Check out bamboo.planRepository.<position>.branchName variable.
Regards,
Elifcan
bamboo.planRepository.<position>.branchName uses static values.
f.e. bamboo.planRepository.1.branchName=master and
bamboo.planRepository.2.branch
But I need a variable which changes its value depending on the branch it's pushed to.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @DavidJng,
bamboo.planRepository.1.branchName
and
bamboo.planRepository.2.branch
are not different branches with the same repository they are the current branch from two linked repositories in your Build Plan (that is assuming that when your Build Plan executes, you are checking out code from two repositories).
If you use: ${bamboo.planRepository.1.branchName} when pushing to master it will substitute with the value 'master'
If you use ${bamboo.planRepository.1.branchName} when pushing to test_branch it will substitute with the value 'test_branch'
I hope that helps!
-Jimmy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Jimmy Seddon
I always want to checkout everything. But in further tasks I only want to use the branch where something was pushed from.
f.e.
or
Best regards,
David
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi David,
That's not exactly how Source Code checkout tasks work in Bamboo:
https://confluence.atlassian.com/bamboo/checking-out-code-289277060.html
You will only be checking out a single branch per repository at any given time. But that's precisely how bamboo.planRepository.1.branchName is able to correctly identify the branch you have checked out.
If you are attempting to try and use some other method to checkout multiple branches at the same time, can you describe in a bit more detail what you are using to accomplish this?
-Jimmy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jimmy,
Given the following example:
__master
____test-branch1
____test-branch2
If a user pushes something on test-branch1, I want to read a properties file inside test-branch1 and inject them.
Also I want to do the same for test-branch2 and master without using the Bamboo branch-plan feature.
Best regards,
David
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi David,
As I stated previously, Bamboo doesn't handle trying to checkout from multiple branches for the same repository at the same time. From what you have described as far as what you want to accomplish it really sounds like 'test-branch1' & 'test-branch2' should be the master branches of their own repositories, and then you would link all three repositories in your build plan. That way when someone makes a change in repo 'test-branch1' you will automatically pull the repo for test-branch2 (and it's configuration).
That's just my two cents.
-Jimmy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.