Using Bamboo with Maven JGit Flow Plugin -- a success story.

853 views
Skip to first unread message

M. Erik Husby

unread,
Aug 22, 2014, 11:50:11 AM8/22/14
to maven-jgit...@googlegroups.com
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}"



Jonathan Doklovic

unread,
Aug 22, 2014, 1:57:08 PM8/22/14
to maven-jgit...@googlegroups.com
It's great to hear you've got it working. We've been struggling in many ways with the way bamboo uses a local (fake) repo as the remote. I think we have most of the kinsk worked out with version 1.0-m3 and the soon to be release 1.0-m4. Which version have you been using?

Thanks,

- Jonathan 

amirtha manoharan

unread,
Apr 14, 2020, 9:10:35 AM4/14/20
to Maven JGit Flow Plugin
Hi, Can you please share the task details in Bamboo for release versioning. Thanks.

Amir

Erik Husby

unread,
Apr 14, 2020, 12:17:05 PM4/14/20
to Maven JGit Flow Plugin
No longer using jgitflow plugin but switched to the new maven-gitflow-plugin which does all its git work from the command line thus avoiding the jgit compatibility issues -- https://github.com/aleksandr-m/gitflow-maven-plugin 

The Bamboo problems are because of the way Bamnoo caches GIT repositories. So in my Bamboo plans that use the maven gitflow options, I have a script task that resets the git remote settings so that subsequent  tasks can update the remote repository properly.

${bamboo.capability.system.git.executable} remote set-url origin ${bamboo.repository.git.repositoryUrl}
${bamboo.capability.system.git.executable} fetch --prune --verbose
${bamboo.capability.system.git.executable} config --local user.name "${bamboo.ManualBuildTriggerReason.userName}"
${bamboo.capability.system.git.executable} config --local user.email "${bamboo.ManualBuildTriggerReason.userName}"


Then one can use a Maven task to actually run the maven-gitflow-plugin

So for each build that I want to support release processing, I have these plans
  • Release Start 
    • Runs the tasks to create the release branch. 
  • Release Build
    • This is a branch build that is enabled when branches of the format "release/*" are found in the repo. Its builds are triggered by changes to the branch.
  • Release Finish
    • This is a branch build configured when the branches of the format "release/*" are found but is manually triggered. 
    • It will run the maven-gitflow-plugin:release-finish. It picks up the version information by using the Maven task Maven Version Variable Extractor
    • A Bamboo CLI task is then used to trigger the production build.
I also use tasks from Bob Swift CLI collection to manipulate other Bamboo builds and our JIRA projects.

I can not allow the production build to automatically deploy because I need to do production deploys off-hours. So after the production build finishes I need to manually click the create release for the deployment build. Then I can do the production deploy later.
Reply all
Reply to author
Forward
0 new messages