Jira and self-managed Gitlab integration


Introduction

此方法是整合Jira和自己架設的gitlab,不是gitlab官方提供的喔(gitlab.com)

目的是可以將git commit的message連結到Jira的issue
只要在message最前面加上 jira issue的id,commit到gitlab時issue id就會變成連結到jira project

下圖是gitlab project的檔案架構,CH-1是jira的issue id
可以看到CH-1會變成超連結,可以導向該issue

Jira

在jira產生api token給gitlab
進入 https://id.atlassian.com/manage-profile/security/api-tokens 後生成一個api token

https://about.gitlab.com/blog/2021/04/12/gitlab-jira-integration-selfmanaged/

Gitlab

在要整合的project的左側側邊欄 Settings > integrations > Add an integration

Web URL填寫 https://<domain>.atlassian.net
後面不用加上jira

完成後就可以用git commit或branch追蹤issue
使用說明:

git commit -m "CH-1 <message>"

issue id也可用於分支

git checkout -b CH-1-branch-name

Author: Hung-Lin, Chen
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint policy. If reproduced, please indicate source Hung-Lin, Chen !
  TOC