Bamboo does not automatically create branch in the plan - bamboo

Bamboo:
On my current build plan I've checked an option create branch plan when new branch in repository is created and matches expression and set value hotfix*
Repository from the Bitbucket is of course linked to this build plan.
Bitbucket:
I have created branch named hotfix/test in Bitbucket git repository and set Bamboo plan branch.
After several hours branch was not automatically created and I have no idea what do I wrong.

I've resolved this by making the following changes:
Changed match pattern from hotfix* to hotfix/.*
Be also sure, that new hotfix repository you're creating in Bitbucket doesn't have activity older than you've set in other option Delete plan branch - After branch inactivity in repository.

Related

How to override the default plan branch configuration?

Currently we are in the process of migrating our projects from jenkins to bamboo. In this process, I am looking for an option in bamboo plan for a plan branch to be created when a new branch is created in the bitbucket repo and also when pull request is created.
As I see in the branch configuration of a plan, it is possible only to choose one option (new branch or pull request) for plan branch. is there any way where i can choose both options? Can I override the configuration using shell script? our bamboo server is currently running version 6.10.
Bamboo doesn't support multiple options for plan branch creation. What's the reason to have both options?
Before you create PR VCS branch already exists so why option to create plan branch on Bitbucket branch creation is not enough?

How to use one sourceode checkout for all the Bamboo stages?

I am planning to create 4 stages
Source code checkout stages
Build for dev env stages
Build for uat env stages
Build for Prod env stages
Is it possible to use the same source code check out for all the stages? How?
This is actually straight forward:
Define your repository in the Repository tab of the plan configuration
Add a Sourcecode Checkout task for each build job in the plan.
By virtue of the repository definition for the plan, a consistent snapshot at the time the plan was started, will be used for the checkout tasks i.e. they will each fetch the same code.
This is not clearly documented in the Bamboo docs but is discussed here https://answers.atlassian.com/questions/33651/stages-and-artifact-passing
Above answer works, but I think you should not build same branch with all environments. It might be better to use better branching workflow,so that you can easily deploy correct change to required environment.

How can I get the username of the person who triggered a build in Bamboo?

I am trying to integrate Atlassian Bamboo with a CloudFormation template that creates and deploys environments in AWS. One of the tags we add to the VPCs and EC2 instances is the name of the engineer that triggered the build.
I can't find a bamboo variable that contains the name of the user that triggered a build. I found one that has the username of the person who created a release in Jira, but this isn't what I want.
https://confluence.atlassian.com/display/BAMBOO/Bamboo+variables
Is there a way to get this variable?
You are looking for ManualBuildTriggerReason.userName, that will be the name of the person who manually triggered a build but if it was off a trigger this will not be present.
For the name of the person who didn't trigger the build manually but did it through a source code commit then you could probably be:
git log <commitFrom>..<commitTo> --format="%aN <%aE>" --reverse
And then you could use repository.revision.number for the current revision and then repository.previous.revision.number for the previous revision.

How to select the particular repository in bamboo during build?

I am new to use the bamboo server. In the application, i have multiple branches, during the build time, it is possible to normal user to select the particular branch to build other than default repository.
Thanks in advance
You can use plan branches to build for specific or all branches. See https://confluence.atlassian.com/display/BAMBOO/Using+plan+branches for more details.

update location scm url for maven multi module project

I have a maven multi module project. If I need to branch, I use the maven-versions plugin to go through my project and update the parent version number rather easily. Is there a similar plugin to update my scm location in all of my poms?
Why don't you use the Maven Release Plugin and its release:branch mojo for that? From the Create a branch page:
Creating a branch executes the
following steps:
Check that there are no uncommitted changes in the sources
Change the version in the poms if you want to change it in the branch
(you will be prompted for the versions
to use)
Transform the SCM information in the POM to include the final destination
of the tag
Commit the modified POMs
Tag the code in the SCM as a new branch with a version name (this will
be prompted for)
Bump the version in the POMs if you want to change it to a new value
y-SNAPSHOT (these values will also be
prompted for)
Commit the modified POMs