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

geforz April 12, 2013

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

0 votes
Answer accepted
geforz April 14, 2013

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

0 votes
PiotrA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 14, 2013

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

0 votes
geforz April 14, 2013

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

0 votes
PiotrA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 14, 2013

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,

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events