This post is the first of a three parts series of articles about manage development and CI/CD workflow with jGit-flow and Pipeline
As the team grows bigger, and the projects become more complex, proper development conventions, workflow and CI/CD process become very important. In this series of posts I’ll describe such flow and process, from the Jira ticket to the delivery (and deployment), using a popular stack, including Jira, Git, Maven, and Jenkins.
Let’s start with a quick review of the tools we’ll use for the workflow implementation
Atlassian Jira is a popular proprietary issue tracking system.We’ll manipulate Atlassian Jira feature tickets along the flow. This can be skipped if you don’t use Jira.The project we’ll manage would be part of the Server team (ST) and the feature that we like to implement and deploy would be ST-145.Its initial ticket status is ‘open’, the resolution is ‘unresolved’:
GitFlowGitFlow is a branching model for Git, created by Vincent Driessen.The GitFlow workflow defines a strict branching model designed around the project release. It uses the following branches:
If you’re new to git-flow, please take some time to read about it in Driessen’s post or in Atlassian’s Guide.
JGit-Flowmaven plugin is a Java implementation of GitFlow, and like Jira, it was published by Atlassian. It designs for releasing a maven-based project and includes many other useful features.‘JGit-flow’ provides the following git-flow basic functionality:
Each feature contains many attributes, providing very useful functionality (described in the links), that we’ll use later on.
JGit-Flow-Jira is a fork that I made for ‘jgit-flow’, which uses a Jira client to change the state of a Jira ticket during the lifecycle of a feature. Unfortunately, jgit-flow is not bug-free, and currently maintained mostly by the users and not by Atlassian. It is, however, published as open source and written very clearly. Jgitflow-jira contains a fix for this open bug as well.
Jenkins Pipeline (or simply “Pipeline”) is a suite of plugins which supports implementing and integrating continuous delivery pipelines into Jenkins.
As opposed to the historic Gui-driven CI/CD tools for Jenkins jobs, the definition of a Pipeline is written into a text file (called a Jenkinsfile) as a code. This in turn can be committed to a project’s source control repository.We will use Pipeline for build, tests and release.The Pipeline script would be written in Groovy and would use Jenkins syntax and shell commands.
The flow-chart below describes the entire workflow, from the Jira ticket to deployment, that we’ll learn how to implement in the following sections.We’ll review a development flow of a feature that was assigned to the ‘server team’ called ‘ST-145’, and the process of releasing and deploying the next version: v 1.2.0, of an application called ‘volcano’.There are many shapes and arrows in the graph, but there’s no need to make sense of them all right now, since we’re going to do exactly that in the following sections.