bamboo.repository.git.branch variable not pointing to branch

Hi,

I'm automating the build of an android application with bamboo and I have trouble archiving the resulting .apk-files in a webserver directory.

The code is hosted in a bitbucket git repository with multiple branches which bamboo recognizes and builds different apks for each branch.

Once the build is complete the apk file should be copied to a webserver directory, so I added a script task with the following content:

dir="/var/www/android/${bamboo.repository.git.branch}/"

mkdir -p $dir

cp bin/appname.apk $dir/appname_b${bamboo.buildNumber}.apk

The result for build 45 in the branch "foo" should be a file in

/var/www/android/foo/appname_b45.apk

The problem is, that the file is copied to the same folder for all branches:

/var/www/android/master/appname_b45.apk

i.e. the variable pointing to the branch is always master and I would assume it should be foo in this case?

I stripped my configuration to the minimum:

  • One Stage
  • One Job
  • One Task: Source Code Checkout from the default repository
  • One Task: Script which just prints the variable to the logfile (with the same result)

Thanks,

Kai

4 answers

1 accepted

The answer is:

a) Don't use bamboo.repository.git if you are using bitbucket

b) use bamboo.repository.branch.name if you are using version 4.4.5

Hi Kai,

Can you tell something more about your setup? I'm particularly interested in:
* your plan->configuration->repository configuration (how is your 'default' repository configured - can you for example attach screenshot here of that configuration?)
* how is your plan-branch configured - can you tell me if you're using some Bamboo built-in 'merging' strategy like Gatekeeper or Updater?
* how is repository override configured in your plan-branch (foo)? (branch->configuration->repository settings) - can you attach a screenshot here?

I think that {bamboo.repository.git.branch} should work for your case, but I'm worried that some corner-case kicks in and overrides the branch name with the plan's default repository settings. Above informations could shed some light on that hyphothesis. Oh, and BTW: which Bamboo version are you running?

regards,

Hi,

thanks for the reply.

I checked all the information and realized it was due to me not using git directly, but via bitbuchet which apparently does not set the git-variables although it's using git ;-)

However I found bamboo.repository.branch.name which is working in my 4.4.5 version so sorry for your time ;-)

Regards,

Kai

No problem. Glad to hear that you've resolved the issue. :)

Suggest an answer

Log in or Join to answer
Community showcase
Renan Battaglin
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,079 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot