After many tries, I believe that I have a reasonable way to get Bamboo
and Maven JGit Flow Plugin to work together. The problems I was
running into with Bamboo were caused by its use of a cache repository
instead of directly using the remote repository. This prevented Maven
JGit Flow Plugin from updating the remote repository with the release
branches. And in one annoying case it did not detect that the a
release branch was removed from the remote repository.
My solution is to add a script task after the plan's Source Code
Checkout task. My Bamboo server runs on Linux so I simply used the
inline script. I added the two lines:
${bamboo.capability.system.git.executable} remote set-url origin ${bamboo.repository.git.repositoryUrl}
${bamboo.capability.system.git.executable} fetch --prune --verbose
This switches the origin to the remote repository and fetches all the
changes. The --prune is crucial as it removes any branches from the
local repository that no longer exist on the remote repository.
I now have 3 Bamboo plans to handle my release processing.
- Release Start -- this is a manual build that creates a new release branch.
- Release Build -- this is an automatic branch build that builds and deploys the release branch.
- Release Finish -- this is a manual build that finishes up the release.
And one additional git command might prove useful for those sites who
need to track who started and finished the release. One can set the
user name in the local git configuration to the user name of the
person who triggered the manual build.
${bamboo.capability.system.git.executable} config --local user.name "${bamboo.ManualBuildTriggerReason.userName}"