웹훅 이벤트 목록

Prev Next

Classic/VPC 환경에서 이용 가능합니다.

웹훅에 등록할 수 있는 이벤트는 다음과 같습니다.

참고
  • 이벤트 타입을 선택하면 하위 액션들은 모두 감지됩니다.
  • 이벤트 타입의 하위 액션별로 선택할 수 없습니다.
주의

새로운 브랜치를 생성한 경우에는 create 이벤트만 발생하며, push 이벤트는 발생하지 않습니다.

이벤트 타입 내용 하위 액션 액션 실행 방법 참고 자료
push 하나 이상의 커밋이 리포지토리에 push
  • commit: 커밋
Git 클라이언트 사용
pull_request Pull Request 작업
  • opened : Pull Request 생성 시 발생
  • closed : Pull Request 닫기 시 발생
  • merged : Pull Request 병합 시 발생
  • edited : Pull Request 수정 시 발생
  • updated_head : Pull Request from branch 의 HEAD가 바뀔 경우 발생
리포지토리 관리 - 풀 리퀘스트 사용
create 브랜치 또는 태그 생성
  • created: 생성
리포지토리 관리 - 브랜치 관리
delete 브랜치 또는 태그 삭제
  • deleted: 삭제
리포지토리 관리 - 브랜치 관리
meta 웹훅 삭제 N/A 웹훅 사용 - 웹훅 삭제
repository 리포지토리의 속성 변경
  • edited : 리포지토리의 설명, file safer 사용 유무 속성 수정 시 발생
리포지토리 관리 - 리포지토리 설정 변경
file_safer File Safer 악성 코드 검사 완료
  • done : File Safer 검사가 완료되었을 경우 발생
File Safer 악성 코드 검사
file_lock (LFS) file lock 사용
  • create : lfs file lock 사용 시 발생
  • delete : lfs file unlock 사용 시 발생
파일 잠금

웹훅 Payload 구성

웹훅 Payload는 웹훅 호출 시 전달되는 실질적인 데이터를 말합니다.

주의
  • Payload 데이터 사이즈가 65,535 bytes 보다 큰 경우, 정상적인 Webhook 호출이 불가능합니다.
  • Content Type이 application/x-www-form-urlencoded으로 설정되어 있는 경우, request body 내의 'payload' key에 해당하는 value로 전체 Payload 데이터가 전송됩니다.

웹훅 Payload 형식

웹훅 Payload 구성 형식은 아래와 같습니다.
event key 에 해당하는 부분은 이벤트 타입에 따라 달라지며, 나머지 version, repository, sender, timestamp는 일정한 형식을 가집니다.

{
    "version": <웹훅 버전>,
    "repository": {
        "id": <리포지토리 id>,
        "name": <리포지토리 이름>,
        "description": <리포지토리 설명>,
        "ssh_url": <리포지토리 git ssh 주소>,
        "https_url": <리포지토리 git https 주소>,
        "portaladdr": <리포지토리 포탈 주소>
        "created_at": <생성일자>,
        "owner": <생성자>
    },
    "sender": <송신자 정보>,
    "event": {
        "type": <이벤트 타입>
        "payload": <이벤트 정보>
    },
    "timestamp": <시간 정보>
}
타입 설명 비고
version string SourceCommit 웹훅 버전 현재 웹훅 최신 버전은 "v1"
repository.id number 리포지토리 id 값 -
repository.name string 리포지토리 이름 -
repository.description string 리포지토리 설명 -
repository.ssh_url string 리포지토리 git ssh 주소 -
repository.https_url string 리포지토리 git https 주소 -
repository.portaladdr string 리포지토리 포털 주소 -
repository.created_at number 리포지토리 생성 일자 timestamp
repository.owner string 리포지토리 생성한 유저 -
sender object 송신자 정보 참조: 송신자 정보 형식
event.type string 이벤트 타입 참조: 웹훅 이벤트
event.payload object 이벤트 정보 참조: 이벤트별 상세정보
timestamp number 웹훅 발생시간 unix timestamp -

송신자 정보 형식

송신자(sender) 정보의 형식은 다음과 같습니다.

  • https git 주소를 사용하여 이벤트가 발생한 경우

    {
        "mbrNo": <member-no>,
        "user_id": <user-id>,
        "id_no" : <id-No>
    }
    
  • ssh git 주소를 사용하여 이벤트가 발생한 경우

    {
        "mbrNo": <member-no>,
        "type": "Tenant" | "SubAccount",
        "user_id" : <user-id> // Provided only in case of subaccount
    }
    
  • file_safer 이벤트를 사용하는 경우

    {
      "mbrNo": <member-no>,
      "type": "system",
    }
    
타입 설명 비고
mbrNo string 고객번호 -
id_no string 고객 식별 값 -
user_id string 유저 id -

Payload 전체 예시

event.type=create인 경우의 예시입니다.

{
    "version": "v1",
    "repository": {
        "id": 123456,
        "name": "test-name",
        "description": "test-description",
        "ssh_url": "ssh://devtools.ncloud.com/test/test-repo.git",
        "https_url": "https://devtools.ncloud.com/test/test-repo.git",
        "portaladdr": "https://devtools.ncloud.com/test/test-repo",
        "created_at": 1662524215000,
        "owner": "test@sample.com"
    },
    "sender": {
        "mbrNo": "123456789",
        "id_no": "aaaaaaaaa-bbbb-cccc-dddd-eeeeeeeeee",
        "user_id": "test-user"
    },
    "timestamp": 1663208183206,
    "event": {
        "type": "create",
        "payload": {
            "ref": "refs/heads/<branch name>",
            "type": "branch",
            "name": <branch-name>,
            "action": "created",
            "before": "0000000000000000000000000000000000000000",
            "after": "ce7c990a1e8762d13e5ef0dc98e605e7c0bd75ec",
            "sender": {
                "protocol": "https",
                "user_id": <user id>,
                "id_no": <id-no>
            },
            "head_commit": [
                {
                    "hash_id": "ce7c990a1e8762d13e5ef0dc98e605e7c0bd75ec",
                    "tree_id": "b9daacb4ab18228adf369b71b02eae916a00e081",
                    "parent_hash_id": "7b287cee698ca0a0f8df15a8b6133e895ba9e9bb",
                    "timestamp": "1655899275",
                    "author": {
                        "author_name": <author name>
                    },
                    "committer": {
                        "committer_name": <committer name>
                    },
                    "commit_message": <commit message>
                }
            ]
        }
    }
}

이벤트별 상세 정보

이벤트 타입에 따라 달라지는 웹훅 Payload 내 event 형식에 대해 설명합니다.

push 이벤트 상세 설명 및 예시

{
    "type": "push",
    "payload": {
        "ref": "refs/heads/<branch name>",
        "action": "commit",
        "before": "c3b67b4527cb196da2195082794cca1643aa7bba",
        "after":  "0eb7c3a853eb50ada35f8dc96ae796ba404d1485",
        "sender": {
            "protocol": "https",
            "user_id": <user id>,
            "id_no": <id-no>
        },
        "head_commit": [
            {   
                "hash_id": "0eb7c3a853eb50ada35f8dc96ae796ba404d1485",
                "tree_id": "d038fe14f2da4ac2227b982a20891a32fb8ae99c",
                "parent_hash_id": "71e03a954a845240b1944fdc93b9606adce98cc1",
                "timestamp": "1655899919",
                "author": {
                    "author_name": <author name>
                },
                "committer": {
                    "committer_name": <committer name>
                },
                "commit_message": <commit message>
            }
        ],
        "commits": [
            {   
                "hash_id": "0eb7c3a853eb50ada35f8dc96ae796ba404d1485",
                "tree_id": "d038fe14f2da4ac2227b982a20891a32fb8ae99c",
                "parent_hash_id": "71e03a954a845240b1944fdc93b9606adce98cc1",
                "timestamp": "1655899919",
                "author": {
                    "author_name": <author name>
                },
                "committer": {
                    "committer_name": <committer name>
                },
                "commit_message": <commit message>
            }
        ]
    }
}
타입 설명 비고
type string 이벤트 타입 "push"
payload.ref string push 대상 ref 정보
payload.action string 하위 액션 "commit"
payload.before string 이전 sha 값
payload.after string 이후 sha 값
payload.sender object 송신자 정보
  • ssh git 주소를 사용한 경우
    • "protocol" : "ssh"
    • "user_id" : "[Tenant Account]" or user_id"
  • https git 주소를 사용한 경우
    • "protocol" : "https"
    • "user_id" : "user_id",
    • "id_no" : "id-no"
payload.head_commit array push 된 커밋의 head commit
payload.head_commit[*].hash_id string commit 의 hash_id
payload.head_commit[*].tree_id string commit 의 tree_id
payload.head_commit[*].parent_hash_id string commit 의 parent_hash_id
payload.head_commit[*].timestamp string commit 의 timestamp
payload.head_commit[*].author.author_name string commit 의 author_name
payload.head_commit[*].committer.committer_name string commit 의 committer_name
payload.commits array push 된 commit 리스트 가장 최신 커밋이 0번 인덱스부터 시작
payload.commits[*].commit_message string commit 의 commit_message
payload.commits[*].hash_id string commit 의 hash_id
payload.commits[*].tree_id string commit 의 tree_id
payload.commits[*].parent_hash_id string commit 의 parent_hash_id
payload.commits[*].timestamp string commit 의 timestamp
payload.commits[*].author.author_name string commit 의 author_name
payload.commits[*].committer.committer_name string commit 의 committer_name
payload.commits[*].commit_message string commit 의 commit_message

create 이벤트 상세 설명 및 예시

{
    "type": "create",
    "payload": {
        "ref": "refs/heads/<branch name>",
        "type": "branch",
        "name": <branch-name>,
        "action": "created",
        "before": "0000000000000000000000000000000000000000",
        "after": "ce7c990a1e8762d13e5ef0dc98e605e7c0bd75ec",
        "sender": {
            "protocol": "https",
            "user_id": <user id>,
            "id_no": <id-no>
        },
        "head_commit": [
            {
                "hash_id": "ce7c990a1e8762d13e5ef0dc98e605e7c0bd75ec",
                "tree_id": "b9daacb4ab18228adf369b71b02eae916a00e081",
                "parent_hash_id": "7b287cee698ca0a0f8df15a8b6133e895ba9e9bb",
                "timestamp": "1655899275",
                "author": {
                    "author_name": <author name>
                },
                "committer": {
                    "committer_name": <committer name>
                },
                "commit_message": <commit message>
            }
        ]
    }
}
타입 설명 비고
type string 이벤트 타입 "create"
payload.ref string push 대상 ref 정보
payload.type string 생성 대상 타입 "branch" or "tag"
payload.action string 하위 액션 "created"
payload.before string 이전 sha 값
payload.after string 이후 sha 값
payload.sender object 송신자 정보
  • ssh git 주소를 사용한 경우
    • "protocol" : "ssh"
    • "user_id" : "[Tenant Account] or user_id""
  • https git 주소를 사용한 경우
    • "protocol" : "https"
    • "user_id" : "user_id",
    • "id_no" : "id-no"
payload.head_commit array push 된 커밋의 head commit
payload.head_commit[*].hash_id string commit 의 hash_id
payload.head_commit[*].tree_id string commit 의 tree_id
payload.head_commit[*].parent_hash_id string commit 의 parent_hash_id
payload.head_commit[*].timestamp string commit 의 timestamp
payload.head_commit[*].author.author_name string commit 의 author_name
payload.head_commit[*].committer.committer_name string commit 의 committer_name

delete 이벤트 상세 설명 및 예시

{
    "type": "delete",
    "payload": {
        "ref": "refs/heads/<branch name>",
        "type": "branch",
        "name": <branch-name>,
        "action": "deleted",
        "before": "68ed6fc3e2cdf74af0fa1b3591ff593d1e28a4cb",
        "after": "0000000000000000000000000000000000000000",
        "sender": {
            "protocol": "https",
            "user_id": <user id>,
            "id_no": <id-no>
        },
        "head_commit": [
            {
                "hash_id": "ce7c990a1e8762d13e5ef0dc98e605e7c0bd75ec",
                "tree_id": "b9daacb4ab18228adf369b71b02eae916a00e081",
                "parent_hash_id": "7b287cee698ca0a0f8df15a8b6133e895ba9e9bb",
                "timestamp": "1655899275",
                "author": {
                    "author_name": <author name>
                },
                "committer": {
                    "committer_name": <committer name>
                },
                "commit_message": <commit message>
            }
        ]
    }
}
타입 설명 비고
type string 이벤트타입 "delete"
payload.ref string push 대상 ref 정보
payload.type string 생성 대상 타입 "branch" or "tag"
payload.action string 하위 액션 "deleted"
payload.before string 이전 sha 값
payload.after string 이후 sha 값
payload.sender object 송신자 정보
  • ssh git 주소를 사용한 경우
    • "protocol" : "ssh"
    • "user_id" : "[Tenant Account] or user_id""
  • https git 주소를 사용한 경우
    • "protocol" : "https"
    • "user_id" : "user_id",
    • "id_no" : "id-no"
payload.head_commit array push 된 커밋의 head commit
payload.head_commit[*].hash_id string commit 의 hash_id
payload.head_commit[*].tree_id string commit 의 tree_id
payload.head_commit[*].parent_hash_id string commit 의 parent_hash_id
payload.head_commit[*].timestamp string commit 의 timestamp
payload.head_commit[*].author.author_name string commit 의 author_name
payload.head_commit[*].committer.committer_name string commit 의 committer_name

pull_request 이벤트 상세 설명 및 예시

{
    "type": "pull_request",
    "payload": {
        "action": "opened" | "closed" | "merged" | "edited" | "updated_head",
        "pull_request_number": 10,
        "pull_request_title": <pull request name>,
        "pull_request_description": <pull request description>,
        "auto_merge_enable": true,
        "from": {
            "branch": "sub",
            "sha": <sha>
        },
        "to": {
            "branch": "master",
            "sha": <sha>
        },
        "sender": {
            "user_id": <user id>
        },
    }
}
타입 설명 비고
type string 이벤트 타입 "pull_request"
payload.action string 하위 액션
  • opened : 새로운 pull request 가 생성되었을 경우
  • closed : pull request 가 닫힌 경우
  • merged : pull request 가 병합되었을 경우
  • edited : pull request 의 title , description 이 수정되었을 경우
  • updated_head : pull request 의 from branch 에 push 가 일어났을 경우
payload.pull_request_number number 풀 리퀘스트 번호 -
payload.pull_request_title string 풀 리퀘스트 제목 -
payload.pull_request_description. string 풀 리퀘스트 설명 -
payload.auto_merge_enable boolean 충돌없이 병합 가능 여부 payload.action 이 'opened' 와 'updated_head' 일 경우에만 제공
from.branch string from 브랜치의 이름 -
from.sha string from 브랜치의 sha 값 -
to.branch string to 브랜치의 이름 -
to.sha string to 브랜치의 sha 값 -
sender.user_id string 유저 id 값 -

meta 이벤트 상세 설명 및 예시

{
    "type": "meta",
    "payload": {
        "webhook": {
            "id": <webhook id>,
            "name": <webhook name>
        }
    }
}
타입 설명 비고
type string 이벤트 타입 "meta"
payload.webhook.id number webhook id 값 -
payload.webhook.name string webhook 이름 -

repository 이벤트 상세 설명 및 예시

{
    "type": "repository",
    "payload": {
        "action": "edited",
        "sender": {
            "user_id": <user id>
        },
        "before": {
            "description": "before description",
            "file_safer": true
        },
        "after": {
            "description": "after description",
            "file_safer": false
        }
    }
}
타입 설명 비고
type string 이벤트 타입 "repository"
payload.action string 하위 액션 "edited"
payload.sender.user_id string 유저 id -
payload.before.description string 수정 전 리포지토리 설명 -
payload.before.file_safer boolean 수정 전 file safer 사용 여부 -
payload.after.description string 수정 후 리포지토리 설명 -
payload.after.file_safer boolean 수정 후 file safer 사용 여부 -

file_safer 이벤트 상세 설명 및 예시

{
    "type": "file_safer",
    "payload": {
        "target_hash": "123456117f77a541bdcb68d36234dbb317c7f1f7",
        "action": "done",
        "total_file_count": 1,
        "infected_file_count": 0,
        "request_date": "2022-09-14T11:24:28.000Z",
        "complete_date": "2022-09-14T11:24:40.000Z"
    }
}
타입 설명 비고
type string 이벤트 타입 "file_safer"
payload.target_hash string 타겟 해시 값
payload.action string 하위 액션 done
payload.total_file_count number 총 검사 파일 개수 -
payload.infected_file_count number 총 악성 파일 개수 -
payload.request_date string 파일 검사 요청 시간 -
payload.complete_date string 파일 검사 완료 시간 -

file_lock 이벤트 상세 설명 및 예시

{
    "type": "file_lock",
    "payload": {
        "action": "create",
        "sender": {
            "user_id": <user id>
        },
        "path": "file.txt",
        "locked_time": "2022-01-01 00:00:00.00",
        "unlocked_time": "2022-01-01 00:00:00.00"
    }
}
타입 설명 비고
type string 이벤트 타입 "file_lock"
payload.action string 하위 액션
  • create : 파일 lock 을 사용할 경우
  • delete : 파일 unlock 을 사용할 경우
payload.sender.user_id string 유저 id -
path string 파일 경로 -
locked_time string lock 이 수행된 시간 action 이 create인 경우에만 제공
unlocked_time string unlock 이 수행된 시간 action 이 delete인 경우에만 제공