웹훅 이벤트 목록
    • PDF

    웹훅 이벤트 목록

    • PDF

    Article Summary

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

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

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

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

    이벤트 타입내용하위 액션액션 실행 방법 참고 자료
    push하나 이상의 커밋이 리포지토리에 push
    • commit: 커밋
    Git 클라이언트 사용
    pull_requestPull 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_saferFile 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": <시간 정보>
    }
    
    키타입설명비고
    versionstringSourceCommit 웹훅 버전현재 웹훅 최신 버전은 "v1"
    repository.idnumber리포지토리 id 값
    repository.namestring리포지토리 이름
    repository.descriptionstring리포지토리 설명
    repository.ssh_urlstring리포지토리 git ssh 주소
    repository.https_urlstring리포지토리 git https 주소
    repository.portaladdrstring리포지토리 포털 주소
    repository.created_atnumber리포지토리 생성 일자timestamp
    repository.ownerstring리포지토리 생성한 유저
    senderobject송신자 정보참조: 송신자 정보 형식
    event.typestring이벤트 타입참조: 웹훅 이벤트
    event.payloadobject이벤트 정보참조: 이벤트별 상세정보
    timestampnumber웹훅 발생시간 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",
      }
      
    타입설명비고
    mbrNostring고객번호
    id_nostring고객 식별 값
    user_idstring유저 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>
                }
            ]
        }
    }
    
    키타입설명비고
    typestring이벤트 타입"push"
    payload.refstringpush 대상 ref 정보
    payload.actionstring하위 액션"commit"
    payload.beforestring이전 sha 값
    payload.afterstring이후 sha 값
    payload.senderobject송신자 정보
    • 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_commitarraypush 된 커밋의 head commit
    payload.head_commit[*].hash_idstringcommit 의 hash_id
    payload.head_commit[*].tree_idstringcommit 의 tree_id
    payload.head_commit[*].parent_hash_idstringcommit 의 parent_hash_id
    payload.head_commit[*].timestampstringcommit 의 timestamp
    payload.head_commit[*].author.author_namestringcommit 의 author_name
    payload.head_commit[*].committer.committer_namestringcommit 의 committer_name
    payload.commitsarraypush 된 commit 리스트가장 최신 커밋이 0번 인덱스부터 시작
    payload.commits[*].commit_messagestringcommit 의 commit_message
    payload.commits[*].hash_idstringcommit 의 hash_id
    payload.commits[*].tree_idstringcommit 의 tree_id
    payload.commits[*].parent_hash_idstringcommit 의 parent_hash_id
    payload.commits[*].timestampstringcommit 의 timestamp
    payload.commits[*].author.author_namestringcommit 의 author_name
    payload.commits[*].committer.committer_namestringcommit 의 committer_name
    payload.commits[*].commit_messagestringcommit 의 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>
                }
            ]
        }
    }
    
    키타입설명비고
    typestring이벤트 타입"create"
    payload.refstringpush 대상 ref 정보
    payload.typestring생성 대상 타입"branch" or "tag"
    payload.actionstring하위 액션"created"
    payload.beforestring이전 sha 값
    payload.afterstring이후 sha 값
    payload.senderobject송신자 정보
    • 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_commitarraypush 된 커밋의 head commit
    payload.head_commit[*].hash_idstringcommit 의 hash_id
    payload.head_commit[*].tree_idstringcommit 의 tree_id
    payload.head_commit[*].parent_hash_idstringcommit 의 parent_hash_id
    payload.head_commit[*].timestampstringcommit 의 timestamp
    payload.head_commit[*].author.author_namestringcommit 의 author_name
    payload.head_commit[*].committer.committer_namestringcommit 의 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>
                }
            ]
        }
    }
    
    타입설명비고
    typestring이벤트타입"delete"
    payload.refstringpush 대상 ref 정보
    payload.typestring생성 대상 타입"branch" or "tag"
    payload.actionstring하위 액션"deleted"
    payload.beforestring이전 sha 값
    payload.afterstring이후 sha 값
    payload.senderobject송신자 정보
    • 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_commitarraypush 된 커밋의 head commit
    payload.head_commit[*].hash_idstringcommit 의 hash_id
    payload.head_commit[*].tree_idstringcommit 의 tree_id
    payload.head_commit[*].parent_hash_idstringcommit 의 parent_hash_id
    payload.head_commit[*].timestampstringcommit 의 timestamp
    payload.head_commit[*].author.author_namestringcommit 의 author_name
    payload.head_commit[*].committer.committer_namestringcommit 의 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>
            },
        }
    }
    
    타입설명비고
    typestring이벤트 타입"pull_request"
    payload.actionstring하위 액션
    • opened : 새로운 pull request 가 생성되었을 경우
    • closed : pull request 가 닫힌 경우
    • merged : pull request 가 병합되었을 경우
    • edited : pull request 의 title , description 이 수정되었을 경우
    • updated_head : pull request 의 from branch 에 push 가 일어났을 경우
    payload.pull_request_numbernumber풀 리퀘스트 번호
    payload.pull_request_titlestring풀 리퀘스트 제목
    payload.pull_request_description.string풀 리퀘스트 설명
    payload.auto_merge_enableboolean충돌없이 병합 가능 여부payload.action 이 'opened' 와 'updated_head' 일 경우에만 제공
    from.branchstringfrom 브랜치의 이름
    from.shastringfrom 브랜치의 sha 값
    to.branchstringto 브랜치의 이름
    to.shastringto 브랜치의 sha 값
    sender.user_idstring유저 id 값

    meta 이벤트 상세 설명 및 예시

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

    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
            }
        }
    }
    
    타입설명비고
    typestring이벤트 타입"repository"
    payload.actionstring하위 액션"edited"
    payload.sender.user_idstring유저 id
    payload.before.descriptionstring수정 전 리포지토리 설명
    payload.before.file_saferboolean수정 전 file safer 사용 여부
    payload.after.descriptionstring수정 후 리포지토리 설명
    payload.after.file_saferboolean수정 후 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"
        }
    }
    
    키타입설명비고
    typestring이벤트 타입"file_safer"
    payload.target_hashstring타겟 해시 값
    payload.actionstring하위 액션done
    payload.total_file_countnumber총 검사 파일 개수
    payload.infected_file_countnumber총 악성 파일 개수
    payload.request_datestring파일 검사 요청 시간
    payload.complete_datestring파일 검사 완료 시간

    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"
        }
    }
    
    타입설명비고
    typestring이벤트 타입"file_lock"
    payload.actionstring하위 액션
    • create : 파일 lock 을 사용할 경우
    • delete : 파일 unlock 을 사용할 경우
    payload.sender.user_idstring유저 id
    pathstring파일 경로
    locked_timestringlock 이 수행된 시간action 이 create인 경우에만 제공
    unlocked_timestringunlock 이 수행된 시간action 이 delete인 경우에만 제공

    이 문서가 도움이 되었습니까?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.