Sample project that demostrates the functionality and use of jgitflow plugin provided by attlasian here - https://bitbucket.org/atlassian/jgit-flow/wiki/Home
Its a maven plugin that produces gitflow style releases.
To enable this - we add following into POM.xml
<plugin>
<groupId>external.atlassian.jgitflow</groupId>
<artifactId>jgitflow-maven-plugin</artifactId>
<version>1.0-m5.1</version>
<configuration>
<enableSshAgent>true</enableSshAgent>
<autoVersionSubmodules>true</autoVersionSubmodules>
<pushFeatures>true</pushFeatures>
<pushReleases>true</pushReleases>
<pushHotfixes>true</pushHotfixes>
<noDeploy>true</noDeploy>
<flowInitContext>
<developBranchName>develop</developBranchName>
<versionTagPrefix>version-</versionTagPrefix>
</flowInitContext>
<enableSshAgent>true</enableSshAgent>
<scmCommentPrefix>DEVOPS-000 </scmCommentPrefix>
</configuration>
</plugin>
Note:- If you are cloning this repo then you need not to add. Its already a part of this sample project.
GitFlow is one of the popular branching strategy in the software development practice. It mostly focuses on what kind of branches to set up and how to merge them together. This process helps in desgining better pipeline workflow to speed up the controlled S/W release processes.
- Our mainstream branch where continuous development happens, is
develop. - Feature branch is checked out from
developand pull request for it raised againstdevelop. releasebranch is cut fromdeveloponce all the intended features merged intodevelop. (Any bug-fixed that was missed during development branch testing will be done in thisreleasebranch.- Finally, upon QA sign-off
releasebranch merges into master and as well as back todevelop
Why maven jgitflow ?
maven jgit flow plugin is aligned with the gitflow process with extra bit of automation by handling the version and pom updates automatically freeing us from manual intervention.
- Make sure we have JAVA and MAVEN configured correctly along with their ENV variables. such
JAVA_HOME,M2_HOMEandMAVEN_HOME.
- Clone this repo
$ git clone https://github.com/tprakash17/atlassian-jgit-flow.git
After cloning make sure you upload this repository to the repo where you have write access. This is required to make sure plugin has all the necessary permissions to automatically merge the code.
- Checkout feature branch from development
Make sure you are on develop branch before checking out feature.
$ git checkout -b feature/DEVOPS-01
Make some changes to the code and raise the pull request against develop branch and merge it.
- Start release
maven jgitflow introduces few maven goals such as following to automate release workflow.
- jgitflow:release-start - Prepares the project for a release. Creates a release branch and updates pom(s) with the release version.
- jgitflow:release-finish - Releases the project. Builds the project, Merges the release branch (as per git-flow), optionally pushes changes and updates pom(s) to new development version.
There are few more goals this plugin provides. More details
$ mvn jgitflow:release-start
This should create a release branch with a tag release/$TAG. Check if the branch is created git branch -a
- Finish Release
$ mvn jgitflow:release-finish
This should automatically update the release version into master and bump the SNAPSHOT into development pom without us handling it manually.
