Operations 12 min read

How to Build a Seamless Jira‑Jenkins‑GitLab Release Pipeline

This article outlines a comprehensive release workflow that integrates Jira, GitLab, and Jenkins using webhooks, detailing manual and automated publishing methods, configuration steps for each tool, pipeline design, and code examples to achieve a closed‑loop deployment process.

Ops Development Stories
Ops Development Stories
Ops Development Stories
How to Build a Seamless Jira‑Jenkins‑GitLab Release Pipeline

Release Methods

Online release is a routine operation; common methods include:

Manual release

Jenkins release platform

GitLab CI

......

In addition, there are open‑source tools with good release management features.

Problems Faced

As an operations engineer, a normal release process involves:

Requester submits a release task and follows the release process

Provider executes the release

Although the steps seem simple, there are gaps. Enterprises often use generic channels (email, DingTalk, Feishu) that are hard to link with the release platform and lack visibility. Therefore we need to solve:

Connect the process with the operations platform

Form a closed loop from initiation to completion

Why Choose JIRA?

JIRA offers excellent project management and issue tracking, with visual workflow and board modes that clearly show the current stage. Its webhook capability enables easy integration with other platforms. Since developers, testers, and project managers already use JIRA, adoption costs are low, allowing us to build an all‑in‑one release platform.

Solution Design

Design Idea

Fully leverage JIRA and GitLab webhook functions together with Jenkins flexibility.

Update status in JIRA to trigger Jenkins merge‑branch pipeline

GitLab merge success triggers Jenkins release pipeline

Notify results via DingTalk or similar tools

The main difficulty is Jenkins retrieving data from JIRA and GitLab; the

Generic Webhook Trigger

plugin makes this flexible.

Release Process Scheme

Overall flow diagram:

Involved Software

Jira – release workflow management

Jenkins – execute pipelines

GitLab – code repository

Kubernetes – application management

Helm/kustomize – package management

DingTalk – message notification

Trivy – image scanning

Aliyun image repository – image storage

PS: No specific software deployment is included here.

Jira and Jenkins Integration for Branch Merging

Jenkins Configuration

Jenkins configuration has two parts:

Configure Jenkins Shared Library

Write a Jenkinsfile triggered by JIRA

Configure Shared Library:

Create pipeline, configure webhook and add Jenkinsfile.

Configure trigger

First set a variable and regex:

Then configure a token:

Configure pipeline and add corresponding Jenkinsfile

Jenkinsfile main logic:

<code>#!groovy

@Library('lotbrick') _

def gitlab = new org.devops.gitlab()
def tool = new org.devops.tools()
def dingmes = new org.devops.sendDingTalk()

pipeline {
    agent { node { label "master" } }

    environment {
        DINGTALKHOOK = "https://oapi.dingtalk.com/robot/send?access_token=xxxx"
    }

    stages{
        stage("FileterData"){
            steps{
                script{
                    response = readJSON text: """${webHookData}"""
                    env.eventType = response["webhookEvent"]
                    if (eventType == "jira:issue_updated"){
                        env.jiraStatus = response['issue']['fields']['status']['name']
                        env.gitlabInfos = response['issue']['fields']['customfield_10219']
                        infos = "${gitlabInfos}".split("\r\n")
                        for (info in infos){
                            prName = "$info".split("/")[0]
                            brName = info - "${prName}/"
                            if (jiraStatus == "已发布(UAT)"){
                                println('进行合并PRE分支操作')
                            } else if (jiraStatus == "已发布(PROD)"){
                                println('进行合并PROD分支操作')
                            } else if (jiraStatus == "已完成"){
                                println('进行分支打Tag并删除原分支')
                            } else {
                                println("查无此项")
                            }
                        }
                    }
                }
            }
        }
        // other stages omitted for brevity
    }

    post{
        failure{
            script{
                println("failure:只有构建失败才会执行")
                dingmes.SendDingTalk("分支合并失败 ❌")
            }
        }
        aborted{
            script{
                println("aborted:只有取消构建才会执行")
                dingmes.SendDingTalk("分支合并取消 ❌","暂停或中断")
            }
        }
    }
}
</code>

Jira Configuration

Main steps on JIRA:

Create workflow

Associate workflow with project

Configure project webhook

Workflow creation:

Associate workflow with project:

Configure webhook (Settings → System → Webhooks):

GitLab and Jenkins Integrated Release System

Development Branch Overview

Feature‑branch development model with the following branches:

DEV – development environment

TEST – testing environment

UAT – integration environment

PRE – pre‑release environment

MASTER – production environment

Merge route: DEV → TEST → UAT → PRE → MASTER, with deployment decisions based on the target branch.

Jenkins Pipeline Configuration

(1) Configure Webhook plugin parameters

Obtain GitLab branch and define push conditions so that only relevant commits trigger the pipeline.

Define filter regex to trigger only on commit events.

(2) Jenkinsfile configuration

<code>def labels = "slave-${UUID.randomUUID().toString()}"
// ... (pipeline definition similar to previous example)
</code>

(3) Configure GitLab webhook

Conclusion

The described operations release workflow is not overly complex; it mainly leverages webhook capabilities of each tool and Jenkins’ rich plugin ecosystem to connect release planning with execution, forming a closed loop.

Recording this approach may help others with similar needs.

CI/CDOperationsRelease AutomationGitLabJenkinsWebhookJira
Ops Development Stories
Written by

Ops Development Stories

Maintained by a like‑minded team, covering both operations and development. Topics span Linux ops, DevOps toolchain, Kubernetes containerization, monitoring, log collection, network security, and Python or Go development. Team members: Qiao Ke, wanger, Dong Ge, Su Xin, Hua Zai, Zheng Ge, Teacher Xia.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.