This post is the second of a three-part series of articles about manage development and CI/CD workflow with jgit-flow and Pipeline
The Git workflow is based on ‘git-flow’, with some modifications, and implemented here with ‘Jgit-flow-jira’.This section covers the green and purple steps in the workflow graph (from part-1).The following is the basic plugin configuration needed for our story. It gives a name to the Git branches and tags. The ‘scmCommentPrefix’ would be the prefix for the commits performed by ‘jGit-flow’(i.e. the Git ‘squash’ operation)
A new feature starts with the command mvn jgitflow:feature-start.
A new feature branch is then checked out from ‘develop’ and the ticket status is updated to ‘IN PROGRESS’:
The command mvn jgitflow:feature-finish ends the feature lifecycle.It prompts the user for the desired feature name to finish, where the default is the current branch.
The feature branch is then merged into ‘develop’, and ‘develop’ is pushed.Before the merge, we like branch ‘develop’ to be pulled and the commits in the feature branch to be squashed, and so cleaner.To achieve that, we’ll add the followings configuration to jgit-flow plugin:
When the feature is done, we like to resolve it and pass to the QA guy. Hence, it’s resolution should be switched to ‘Done’, and it’s status ‘QA’
After all the features of the next version have been completed and merged to ‘develop’ branch, it’s time for the git flow release process to kick in.
A release process starts with the command mvn jgitflow:release-start on branch ‘develop’, which prompts the user for the version name.
The default is the next major version (according to the pom file), in this case, 1.2.0. Then it performs the following actions:
<autoVersionSubmodules>true</autoVersionSubmodules>
Once the version is approved by QA, the ‘git-flow’ release can be completed. The command mvn jgitflow:release-finish performs the following:
Checkout and push ‘master’ branch would start the release process
When there is a need for a quick fix for a code that is already in production, the ‘git-flow’ hotfix comes to the rescue.
The ‘master’ branch is always synced with the latest deployment code. The Feature starts with the command mvn jgitflow:hotfix-start prompts the user for the version name.
The default is the next minor version (according to the pom file), in this case, 1.2.1
<pullMaster>true</pullMaster>
Once the version is approved by QA, the ‘hotfix’ git flow can be completed. The command mvn jgitflow:hotfix-finish performs actions which are quite similar to the ‘release-finish’:
Checkout and push ‘master’ branch would start the release process
We’ve reviewed the git workflow of a new feature, ‘release’ and ‘hotfix’, and ended up with the following ‘jgit-flow’ configuration:In Part III we’ll review the Jenkins Pipeline script, which compiles, runs the tests and performs the release process.