InfoGrab Docs

외부 상태 검사 API

요약

이 API를 사용하여 외부 상태 검사를 관리합니다. 다음 엔드포인트를 사용하여 프로젝트의 외부 상태 검사 서비스에 대한 정보를 조회합니다: 다음 엔드포인트를 사용하여 프로젝트에 새 외부 상태 검사 서비스를 생성합니다: 외부 상태 검사는 정의된 외부 서비스에 적용 가능한 모든 머지 리퀘스트에 대한 정보를 보냅니다.

이 API를 사용하여 외부 상태 검사를 관리합니다.

프로젝트 외부 상태 검사 서비스 조회#

다음 엔드포인트를 사용하여 프로젝트의 외부 상태 검사 서비스에 대한 정보를 조회합니다:

GET /projects/:id/external_status_checks

파라미터:

속성 유형 필수 설명
id integer 프로젝트의 ID
[
  {
    "id": 1,
    "name": "Compliance Tool",
    "project_id": 6,
    "external_url": "https://gitlab.com/example/compliance-tool",
    "hmac": true,
    "protected_branches": [
      {
        "id": 14,
        "project_id": 6,
        "name": "main",
        "created_at": "2020-10-12T14:04:50.787Z",
        "updated_at": "2020-10-12T14:04:50.787Z",
        "code_owner_approval_required": false
      }
    ]
  }
]

외부 상태 검사 서비스 생성#

다음 엔드포인트를 사용하여 프로젝트에 새 외부 상태 검사 서비스를 생성합니다:

POST /projects/:id/external_status_checks
Warning

외부 상태 검사는 정의된 외부 서비스에 적용 가능한 모든 머지 리퀘스트에 대한 정보를 보냅니다. 여기에는 기밀 머지 리퀘스트도 포함됩니다.

속성 유형 필수 설명
id integer 프로젝트의 ID
name string 외부 상태 검사 서비스의 표시 이름
external_url string 외부 상태 검사 서비스의 URL
shared_secret string 아니요 외부 상태 검사의 HMAC 시크릿
protected_branch_ids array 아니요 규칙 범위를 지정할 보호된 브랜치의 ID

외부 상태 검사 서비스 업데이트#

다음 엔드포인트를 사용하여 프로젝트의 기존 외부 상태 검사를 업데이트합니다:

PUT /projects/:id/external_status_checks/:check_id
속성 유형 필수 설명
id integer 프로젝트의 ID
check_id integer 외부 상태 검사 서비스의 ID
name string 아니요 외부 상태 검사 서비스의 표시 이름
external_url string 아니요 외부 상태 검사 서비스의 URL
shared_secret string 아니요 외부 상태 검사의 HMAC 시크릿
protected_branch_ids array 아니요 규칙 범위를 지정할 보호된 브랜치의 ID

외부 상태 검사 서비스 삭제#

다음 엔드포인트를 사용하여 프로젝트의 외부 상태 검사 서비스를 삭제합니다:

DELETE /projects/:id/external_status_checks/:check_id
속성 유형 필수 설명
check_id integer 외부 상태 검사 서비스의 ID
id integer 프로젝트의 ID

머지 리퀘스트의 모든 상태 검사 목록 조회#

단일 머지 리퀘스트에 적용되는 외부 상태 검사 서비스와 해당 상태를 나열합니다.

GET /projects/:id/merge_requests/:merge_request_iid/status_checks

파라미터:

속성 유형 필수 설명
id integer 프로젝트의 ID
merge_request_iid integer 머지 리퀘스트의 IID
[
    {
        "id": 2,
        "name": "Service 1",
        "external_url": "https://gitlab.com/test-endpoint",
        "status": "passed"
    },
    {
        "id": 1,
        "name": "Service 2",
        "external_url": "https://gitlab.com/test-endpoint-2",
        "status": "pending"
    }
]

외부 상태 검사 상태 설정#

히스토리

단일 머지 리퀘스트의 외부 상태 검사 상태를 설정하여 GitLab에 머지 리퀘스트가 외부 서비스의 검사를 통과했음을 알립니다. 외부 검사의 상태를 설정하려면 사용된 개인 접근 토큰이 머지 리퀘스트의 대상 프로젝트에서 Developer, Maintainer 또는 Owner 권한을 가진 사용자에 속해야 합니다.

머지 리퀘스트 자체를 승인할 권한이 있는 사용자로 이 API 호출을 실행하세요.

POST /projects/:id/merge_requests/:merge_request_iid/status_check_responses

파라미터:

속성 유형 필수 설명
id integer 프로젝트의 ID
merge_request_iid integer 머지 리퀘스트의 IID
sha string 소스 브랜치의 HEAD에 있는 SHA
external_status_check_id integer 외부 상태 검사의 ID
status string 아니요 검사를 대기 중으로 표시하려면 pending, 통과하려면 passed, 실패시키려면 failed로 설정
Note

sha는 머지 리퀘스트의 소스 브랜치 HEAD의 SHA여야 합니다.

머지 리퀘스트의 실패한 상태 검사 재시도#

히스토리

단일 머지 리퀘스트에 대해 지정된 실패한 외부 상태 검사를 재시도합니다. 머지 리퀘스트가 변경되지 않았더라도 이 엔드포인트는 머지 리퀘스트의 현재 상태를 정의된 외부 서비스에 다시 보냅니다.

POST /projects/:id/merge_requests/:merge_request_iid/status_checks/:external_status_check_id/retry

파라미터:

속성 유형 필수 설명
id integer 프로젝트의 ID
merge_request_iid integer 머지 리퀘스트의 IID
external_status_check_id integer 실패한 외부 상태 검사의 ID

응답#

성공한 경우 상태 코드는 202입니다.

{
    "message": "202 Accepted"
}

상태 검사가 이미 통과된 경우 상태 코드는 422입니다.

{
    "message": "External status check must be failed"
}

외부 서비스로 전송된 페이로드 예시#

{
  "object_kind": "merge_request",
  "event_type": "merge_request",
  "user": {
    "id": 1,
    "name": "Administrator",
    "username": "root",
    "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
    "email": "[REDACTED]"
  },
  "project": {
    "id": 6,
    "name": "Flight",
    "description": "Ipsa minima est consequuntur quisquam.",
    "web_url": "http://example.com/flightjs/Flight",
    "avatar_url": null,
    "git_ssh_url": "ssh://example.com/flightjs/Flight.git",
    "git_http_url": "http://example.com/flightjs/Flight.git",
    "namespace": "Flightjs",
    "visibility_level": 20,
    "path_with_namespace": "flightjs/Flight",
    "default_branch": "main",
    "ci_config_path": null,
    "homepage": "http://example.com/flightjs/Flight",
    "url": "ssh://example.com/flightjs/Flight.git",
    "ssh_url": "ssh://example.com/flightjs/Flight.git",
    "http_url": "http://example.com/flightjs/Flight.git"
  },
  "object_attributes": {
    "assignee_id": null,
    "author_id": 1,
    "created_at": "2022-12-07 07:53:43 UTC",
    "description": "",
    "head_pipeline_id": 558,
    "id": 144,
    "iid": 4,
    "last_edited_at": null,
    "last_edited_by_id": null,
    "merge_commit_sha": null,
    "merge_error": null,
    "merge_params": {
      "force_remove_source_branch": "1"
    },
    "merge_status": "can_be_merged",
    "merge_user_id": null,
    "merge_when_pipeline_succeeds": false,
    "milestone_id": null,
    "source_branch": "root-main-patch-30152",
    "source_project_id": 6,
    "state_id": 1,
    "target_branch": "main",
    "target_project_id": 6,
    "time_estimate": 0,
    "title": "Update README.md",
    "updated_at": "2022-12-07 07:53:43 UTC",
    "updated_by_id": null,
    "url": "http://example.com/flightjs/Flight/-/merge_requests/4",
    "source": {
      "id": 6,
      "name": "Flight",
      "description": "Ipsa minima est consequuntur quisquam.",
      "web_url": "http://example.com/flightjs/Flight",
      "avatar_url": null,
      "git_ssh_url": "ssh://example.com/flightjs/Flight.git",
      "git_http_url": "http://example.com/flightjs/Flight.git",
      "namespace": "Flightjs",
      "visibility_level": 20,
      "path_with_namespace": "flightjs/Flight",
      "default_branch": "main",
      "ci_config_path": null,
      "homepage": "http://example.com/flightjs/Flight",
      "url": "ssh://example.com/flightjs/Flight.git",
      "ssh_url": "ssh://example.com/flightjs/Flight.git",
      "http_url": "http://example.com/flightjs/Flight.git"
    },
    "target": {
      "id": 6,
      "name": "Flight",
      "description": "Ipsa minima est consequuntur quisquam.",
      "web_url": "http://example.com/flightjs/Flight",
      "avatar_url": null,
      "git_ssh_url": "ssh://example.com/flightjs/Flight.git",
      "git_http_url": "http://example.com/flightjs/Flight.git",
      "namespace": "Flightjs",
      "visibility_level": 20,
      "path_with_namespace": "flightjs/Flight",
      "default_branch": "main",
      "ci_config_path": null,
      "homepage": "http://example.com/flightjs/Flight",
      "url": "ssh://example.com/flightjs/Flight.git",
      "ssh_url": "ssh://example.com/flightjs/Flight.git",
      "http_url": "http://example.com/flightjs/Flight.git"
    },
    "last_commit": {
      "id": "141be9714669a4c1ccaa013c6a7f3e462ff2a40f",
      "message": "Update README.md",
      "title": "Update README.md",
      "timestamp": "2022-12-07T07:52:11+00:00",
      "url": "http://example.com/flightjs/Flight/-/commit/141be9714669a4c1ccaa013c6a7f3e462ff2a40f",
      "author": {
        "name": "Administrator",
        "email": "admin@example.com"
      }
    },
    "work_in_progress": false,
    "total_time_spent": 0,
    "time_change": 0,
    "human_total_time_spent": null,
    "human_time_change": null,
    "human_time_estimate": null,
    "assignee_ids": [
    ],
    "reviewer_ids": [
    ],
    "labels": [
    ],
    "state": "opened",
    "blocking_discussions_resolved": true,
    "first_contribution": false,
    "detailed_merge_status": "mergeable"
  },
  "labels": [
  ],
  "changes": {
  },
  "repository": {
    "name": "Flight",
    "url": "ssh://example.com/flightjs/Flight.git",
    "description": "Ipsa minima est consequuntur quisquam.",
    "homepage": "http://example.com/flightjs/Flight"
  },
  "external_approval_rule": {
    "id": 1,
    "name": "QA",
    "external_url": "https://example.com/"
  }
}

관련 주제#

외부 상태 검사 API

Tier: Ultimate
Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
원문 보기
요약

이 API를 사용하여 외부 상태 검사를 관리합니다. 다음 엔드포인트를 사용하여 프로젝트의 외부 상태 검사 서비스에 대한 정보를 조회합니다: 다음 엔드포인트를 사용하여 프로젝트에 새 외부 상태 검사 서비스를 생성합니다: 외부 상태 검사는 정의된 외부 서비스에 적용 가능한 모든 머지 리퀘스트에 대한 정보를 보냅니다.

이 API를 사용하여 외부 상태 검사를 관리합니다.

프로젝트 외부 상태 검사 서비스 조회#

다음 엔드포인트를 사용하여 프로젝트의 외부 상태 검사 서비스에 대한 정보를 조회합니다:

GET /projects/:id/external_status_checks

파라미터:

속성 유형 필수 설명
id integer 프로젝트의 ID
[
  {
    "id": 1,
    "name": "Compliance Tool",
    "project_id": 6,
    "external_url": "https://gitlab.com/example/compliance-tool",
    "hmac": true,
    "protected_branches": [
      {
        "id": 14,
        "project_id": 6,
        "name": "main",
        "created_at": "2020-10-12T14:04:50.787Z",
        "updated_at": "2020-10-12T14:04:50.787Z",
        "code_owner_approval_required": false
      }
    ]
  }
]

외부 상태 검사 서비스 생성#

다음 엔드포인트를 사용하여 프로젝트에 새 외부 상태 검사 서비스를 생성합니다:

POST /projects/:id/external_status_checks
Warning

외부 상태 검사는 정의된 외부 서비스에 적용 가능한 모든 머지 리퀘스트에 대한 정보를 보냅니다. 여기에는 기밀 머지 리퀘스트도 포함됩니다.

속성 유형 필수 설명
id integer 프로젝트의 ID
name string 외부 상태 검사 서비스의 표시 이름
external_url string 외부 상태 검사 서비스의 URL
shared_secret string 아니요 외부 상태 검사의 HMAC 시크릿
protected_branch_ids array 아니요 규칙 범위를 지정할 보호된 브랜치의 ID

외부 상태 검사 서비스 업데이트#

다음 엔드포인트를 사용하여 프로젝트의 기존 외부 상태 검사를 업데이트합니다:

PUT /projects/:id/external_status_checks/:check_id
속성 유형 필수 설명
id integer 프로젝트의 ID
check_id integer 외부 상태 검사 서비스의 ID
name string 아니요 외부 상태 검사 서비스의 표시 이름
external_url string 아니요 외부 상태 검사 서비스의 URL
shared_secret string 아니요 외부 상태 검사의 HMAC 시크릿
protected_branch_ids array 아니요 규칙 범위를 지정할 보호된 브랜치의 ID

외부 상태 검사 서비스 삭제#

다음 엔드포인트를 사용하여 프로젝트의 외부 상태 검사 서비스를 삭제합니다:

DELETE /projects/:id/external_status_checks/:check_id
속성 유형 필수 설명
check_id integer 외부 상태 검사 서비스의 ID
id integer 프로젝트의 ID

머지 리퀘스트의 모든 상태 검사 목록 조회#

단일 머지 리퀘스트에 적용되는 외부 상태 검사 서비스와 해당 상태를 나열합니다.

GET /projects/:id/merge_requests/:merge_request_iid/status_checks

파라미터:

속성 유형 필수 설명
id integer 프로젝트의 ID
merge_request_iid integer 머지 리퀘스트의 IID
[
    {
        "id": 2,
        "name": "Service 1",
        "external_url": "https://gitlab.com/test-endpoint",
        "status": "passed"
    },
    {
        "id": 1,
        "name": "Service 2",
        "external_url": "https://gitlab.com/test-endpoint-2",
        "status": "pending"
    }
]

외부 상태 검사 상태 설정#

히스토리

단일 머지 리퀘스트의 외부 상태 검사 상태를 설정하여 GitLab에 머지 리퀘스트가 외부 서비스의 검사를 통과했음을 알립니다. 외부 검사의 상태를 설정하려면 사용된 개인 접근 토큰이 머지 리퀘스트의 대상 프로젝트에서 Developer, Maintainer 또는 Owner 권한을 가진 사용자에 속해야 합니다.

머지 리퀘스트 자체를 승인할 권한이 있는 사용자로 이 API 호출을 실행하세요.

POST /projects/:id/merge_requests/:merge_request_iid/status_check_responses

파라미터:

속성 유형 필수 설명
id integer 프로젝트의 ID
merge_request_iid integer 머지 리퀘스트의 IID
sha string 소스 브랜치의 HEAD에 있는 SHA
external_status_check_id integer 외부 상태 검사의 ID
status string 아니요 검사를 대기 중으로 표시하려면 pending, 통과하려면 passed, 실패시키려면 failed로 설정
Note

sha는 머지 리퀘스트의 소스 브랜치 HEAD의 SHA여야 합니다.

머지 리퀘스트의 실패한 상태 검사 재시도#

히스토리

단일 머지 리퀘스트에 대해 지정된 실패한 외부 상태 검사를 재시도합니다. 머지 리퀘스트가 변경되지 않았더라도 이 엔드포인트는 머지 리퀘스트의 현재 상태를 정의된 외부 서비스에 다시 보냅니다.

POST /projects/:id/merge_requests/:merge_request_iid/status_checks/:external_status_check_id/retry

파라미터:

속성 유형 필수 설명
id integer 프로젝트의 ID
merge_request_iid integer 머지 리퀘스트의 IID
external_status_check_id integer 실패한 외부 상태 검사의 ID

응답#

성공한 경우 상태 코드는 202입니다.

{
    "message": "202 Accepted"
}

상태 검사가 이미 통과된 경우 상태 코드는 422입니다.

{
    "message": "External status check must be failed"
}

외부 서비스로 전송된 페이로드 예시#

{
  "object_kind": "merge_request",
  "event_type": "merge_request",
  "user": {
    "id": 1,
    "name": "Administrator",
    "username": "root",
    "avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
    "email": "[REDACTED]"
  },
  "project": {
    "id": 6,
    "name": "Flight",
    "description": "Ipsa minima est consequuntur quisquam.",
    "web_url": "http://example.com/flightjs/Flight",
    "avatar_url": null,
    "git_ssh_url": "ssh://example.com/flightjs/Flight.git",
    "git_http_url": "http://example.com/flightjs/Flight.git",
    "namespace": "Flightjs",
    "visibility_level": 20,
    "path_with_namespace": "flightjs/Flight",
    "default_branch": "main",
    "ci_config_path": null,
    "homepage": "http://example.com/flightjs/Flight",
    "url": "ssh://example.com/flightjs/Flight.git",
    "ssh_url": "ssh://example.com/flightjs/Flight.git",
    "http_url": "http://example.com/flightjs/Flight.git"
  },
  "object_attributes": {
    "assignee_id": null,
    "author_id": 1,
    "created_at": "2022-12-07 07:53:43 UTC",
    "description": "",
    "head_pipeline_id": 558,
    "id": 144,
    "iid": 4,
    "last_edited_at": null,
    "last_edited_by_id": null,
    "merge_commit_sha": null,
    "merge_error": null,
    "merge_params": {
      "force_remove_source_branch": "1"
    },
    "merge_status": "can_be_merged",
    "merge_user_id": null,
    "merge_when_pipeline_succeeds": false,
    "milestone_id": null,
    "source_branch": "root-main-patch-30152",
    "source_project_id": 6,
    "state_id": 1,
    "target_branch": "main",
    "target_project_id": 6,
    "time_estimate": 0,
    "title": "Update README.md",
    "updated_at": "2022-12-07 07:53:43 UTC",
    "updated_by_id": null,
    "url": "http://example.com/flightjs/Flight/-/merge_requests/4",
    "source": {
      "id": 6,
      "name": "Flight",
      "description": "Ipsa minima est consequuntur quisquam.",
      "web_url": "http://example.com/flightjs/Flight",
      "avatar_url": null,
      "git_ssh_url": "ssh://example.com/flightjs/Flight.git",
      "git_http_url": "http://example.com/flightjs/Flight.git",
      "namespace": "Flightjs",
      "visibility_level": 20,
      "path_with_namespace": "flightjs/Flight",
      "default_branch": "main",
      "ci_config_path": null,
      "homepage": "http://example.com/flightjs/Flight",
      "url": "ssh://example.com/flightjs/Flight.git",
      "ssh_url": "ssh://example.com/flightjs/Flight.git",
      "http_url": "http://example.com/flightjs/Flight.git"
    },
    "target": {
      "id": 6,
      "name": "Flight",
      "description": "Ipsa minima est consequuntur quisquam.",
      "web_url": "http://example.com/flightjs/Flight",
      "avatar_url": null,
      "git_ssh_url": "ssh://example.com/flightjs/Flight.git",
      "git_http_url": "http://example.com/flightjs/Flight.git",
      "namespace": "Flightjs",
      "visibility_level": 20,
      "path_with_namespace": "flightjs/Flight",
      "default_branch": "main",
      "ci_config_path": null,
      "homepage": "http://example.com/flightjs/Flight",
      "url": "ssh://example.com/flightjs/Flight.git",
      "ssh_url": "ssh://example.com/flightjs/Flight.git",
      "http_url": "http://example.com/flightjs/Flight.git"
    },
    "last_commit": {
      "id": "141be9714669a4c1ccaa013c6a7f3e462ff2a40f",
      "message": "Update README.md",
      "title": "Update README.md",
      "timestamp": "2022-12-07T07:52:11+00:00",
      "url": "http://example.com/flightjs/Flight/-/commit/141be9714669a4c1ccaa013c6a7f3e462ff2a40f",
      "author": {
        "name": "Administrator",
        "email": "admin@example.com"
      }
    },
    "work_in_progress": false,
    "total_time_spent": 0,
    "time_change": 0,
    "human_total_time_spent": null,
    "human_time_change": null,
    "human_time_estimate": null,
    "assignee_ids": [
    ],
    "reviewer_ids": [
    ],
    "labels": [
    ],
    "state": "opened",
    "blocking_discussions_resolved": true,
    "first_contribution": false,
    "detailed_merge_status": "mergeable"
  },
  "labels": [
  ],
  "changes": {
  },
  "repository": {
    "name": "Flight",
    "url": "ssh://example.com/flightjs/Flight.git",
    "description": "Ipsa minima est consequuntur quisquam.",
    "homepage": "http://example.com/flightjs/Flight"
  },
  "external_approval_rule": {
    "id": 1,
    "name": "QA",
    "external_url": "https://example.com/"
  }
}

관련 주제#