페이지 트리

이 페이지는 Jira issue 변경을 외부 시스템에 알리는 방법 중 하나인 WebHook 구성에 대해 정리한다.

Overview

Webhooks은 HTTP 프로토콜의 사용자정의 콜백으로 Jira의 이벤트를 외부 시스템에 알리는 방법기 위해 webhook을 사용할 수 있다.

WebHook 구성 정보:

  • Name: Webhook의 이름
  • URL: 정의된 이벤트가 발생할 때 호출될 외부 URL
  • Scope: Webhook을 발생시킬 대상 이슈 정의. 예) 모든 이슈, 또는 JQL ("project = My Project" AND fixVersion = future")
  • Event: URL 호출할 이벤트 정의. 예) 모든 이벤트, 또는 update 이벤트 등

WebHook 구성 예시

Name: “A slightly more advanced webhook”
URLwww.myremoteapp.com/webhookreceiver
Scope: Project = JRA AND fixVersion IN (“6.4”, “7.0”)
Events: Issue Updated, Issue Created


Webhook 등록

관리자 화면 또는 REST API 두 가지 방법으로 등록 가능하다. 본 문서는 관리자 화면에서 webhook 등록하는 절차를 다룬다.

Step 1) Webhook 관리 화면으로 이동

관리자 메뉴 >> System >> Webhooks

Step 2) Create a webhook 클릭

Step 3) Webhook 구성

변수 치환 (Variable substitution) 기능을 활용하여 issue 정보를 이용해 webhook URL을 동적으로 구성 가능하다.

Step 4) Create 버튼을 클릭하여 등록

Webhook 수행

수행 방법

Event 발생

등록된 webhook은 scope과 event 조건이 만족되면 수행된다.

Workflow post function

등록된 webhook은 Workflow의 post function 에서 사용할 수 있다. 즉, 특정 transition이 발생하면 webhook 이 수행되도록 수성할 수 있다.

정보 전송

정보는 JSON 형식으로 전송된다. JSON body를 원하지 않을 때는 webhook 구성에서 Exclude body를 선택한다. 

{ 
    "timestamp"
    "event"
    "user": {
               --> See User shape in table below
    },
    "issue": { 
               --> See Issue shape in table below
    },
    "changelog" : {
               --> See Changelog shape in table below    
    },
    "comment" : {
               --> See Comment shape in table below  
    }
}

전송 정보 예시:


전송 정보 예시:
{
    "id": 2,
    "timestamp": "2009-09-09T00:08:36.796-0500",
    "issue": { 
        "expand":"renderedFields,names,schema,transitions,operations,editmeta,changelog",
        "id":"99291",
        "self":"https://jira.atlassian.com/rest/api/2/issue/99291",
        "key":"JRA-20002",
        "fields":{
            "summary":"I feel the need for speed",
            "created":"2009-12-16T23:46:10.612-0600",
            "description":"Make the issue nav load 10x faster",
            "labels":["UI", "dialogue", "move"],
            "priority": "Minor"
        }
    },
    "user": {
        "self":"https://jira.atlassian.com/rest/api/2/user?username=brollins",
        "name":"brollins",
        "emailAddress":"bryansemail at atlassian dot com",
        "avatarUrls":{
            "16x16":"https://jira.atlassian.com/secure/useravatar?size=small&avatarId=10605",
            "48x48":"https://jira.atlassian.com/secure/useravatar?avatarId=10605"
        },
        "displayName":"Bryan Rollins [Atlassian]",
        "active" : "true"
    },
    "changelog": {
        "items": [
            {
                "toString": "A new summary.",
                "to": null,
                "fromString": "What is going on here?????",
                "from": null,
                "fieldtype": "jira",
                "field": "summary"
            },
            {
                "toString": "New Feature",
                "to": "2",
                "fromString": "Improvement",
                "from": "4",
                "fieldtype": "jira",
                "field": "issuetype"
            }
        ],
        "id": 10124
    },
    "comment" : {
        "self":"https://jira.atlassian.com/rest/api/2/issue/10148/comment/252789",
        "id":"252789",
        "author":{
            "self":"https://jira.atlassian.com/rest/api/2/user?username=brollins",
            "name":"brollins",
            "emailAddress":"bryansemail@atlassian.com",
            "avatarUrls":{
                "16x16":"https://jira.atlassian.com/secure/useravatar?size=small&avatarId=10605",
                "48x48":"https://jira.atlassian.com/secure/useravatar?avatarId=10605"
            },
            "displayName":"Bryan Rollins [Atlassian]",
            "active":true
        },
        "body":"Just in time for AtlasCamp!",
        "updateAuthor":{
            "self":"https://jira.atlassian.com/rest/api/2/user?username=brollins",
            "name":"brollins",
            "emailAddress":"brollins@atlassian.com",
            "avatarUrls":{
                "16x16":"https://jira.atlassian.com/secure/useravatar?size=small&avatarId=10605",
                "48x48":"https://jira.atlassian.com/secure/useravatar?avatarId=10605"
            },
            "displayName":"Bryan Rollins [Atlassian]",
            "active":true
        },
        "created":"2011-06-07T10:31:26.805-0500",
        "updated":"2011-06-07T10:31:26.805-0500"
    },  
    "timestamp": "2011-06-07T10:31:26.805-0500",
    "webhookEvent": "jira:issue_updated"
}


참고

  • 레이블 없음