- 파이프라인 페이지 매김
- 프로젝트 파이프라인 목록
- 단일 파이프라인 가져오기
- 새 파이프라인 생성
- 파이프라인에서 작업 재시도
- 파이프라인 작업 취소
- 파이프라인 삭제
- 파이프라인 메타데이터 업데이트
파이프라인 API
파이프라인 페이지 매김
기본적으로 GET
요청은 20개의 결과를 한 번에 반환합니다. API 결과는 페이지 매김이 되어 있습니다.
페이지 매김에 대한 자세한 내용을 참조하세요.
프로젝트 파이프라인 목록
iid
응답에서 도입됨 GitLab 14.6.name
응답에서 도입됨 GitLab 15.11 플래그와 함께pipeline_name_in_api
라는 이름으로. 기본적으로 비활성화되어 있습니다.name
요청에서 도입됨 15.11 플래그와 함께pipeline_name_search
라는 이름으로. 기본적으로 비활성화되어 있습니다.name
응답에서 일반 사용 가능 GitLab 16.3. 기능 플래그pipeline_name_in_api
가 제거되었습니다.name
요청에서 일반 사용 가능 GitLab 16.9. 기능 플래그pipeline_name_search
가 제거되었습니다.- 자식 파이프라인 반환 지원
source
가parent_pipeline
로 설정된 경우 도입됨 GitLab 17.0.
프로젝트에서 파이프라인을 나열합니다.
기본적으로 자식 파이프라인은 결과에 포함되지 않습니다. 자식 파이프라인을 반환하려면 source
를 parent_pipeline
으로 설정하세요.
GET /projects/:id/pipelines
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id |
integer/string | 예 | 프로젝트의 ID 또는 URL 인코딩 경로 |
name |
string | 아니오 | 지정된 이름이 있는 파이프라인을 반환합니다. |
order_by |
string | 아니오 |
id , status , ref , updated_at 또는 user_id 로 파이프라인을 정렬합니다 (기본값: id ) |
ref |
string | 아니오 | 파이프라인의 ref |
scope |
string | 아니오 | 파이프라인의 범위 중 하나: running , pending , finished , branches , tags
|
sha |
string | 아니오 | 파이프라인의 SHA |
sort |
string | 아니오 | 파이프라인을 asc 또는 desc 순서로 정렬합니다 (기본값: desc ) |
source |
string | 아니오 | 파이프라인 소스. |
status |
string | 아니오 | 파이프라인의 상태, 가능한 값: created , waiting_for_resource , preparing , pending , running , success , failed , canceled , skipped , manual , scheduled
|
updated_after |
datetime | 아니오 | 지정된 날짜 이후에 업데이트된 파이프라인을 반환합니다. ISO 8601 형식으로 예상됩니다 (2019-03-15T08:00:00Z ). |
updated_before |
datetime | 아니오 | 지정된 날짜 이전에 업데이트된 파이프라인을 반환합니다. ISO 8601 형식으로 예상됩니다 (2019-03-15T08:00:00Z ). |
username |
string | 아니오 | 파이프라인을 트리거한 사용자의 사용자 이름 |
yaml_errors |
boolean | 아니오 | 잘못된 구성이 있는 파이프라인을 반환합니다. |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/pipelines"
응답 예시
[
{
"id": 47,
"iid": 12,
"project_id": 1,
"status": "pending",
"source": "push",
"ref": "new-pipeline",
"sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
"name": "Build pipeline",
"web_url": "https://example.com/foo/bar/pipelines/47",
"created_at": "2016-08-11T11:28:34.085Z",
"updated_at": "2016-08-11T11:32:35.169Z"
},
{
"id": 48,
"iid": 13,
"project_id": 1,
"status": "pending",
"source": "web",
"ref": "new-pipeline",
"sha": "eb94b618fb5865b26e80fdd8ae531b7a63ad851a",
"name": "Build pipeline",
"web_url": "https://example.com/foo/bar/pipelines/48",
"created_at": "2016-08-12T10:06:04.561Z",
"updated_at": "2016-08-12T10:09:56.223Z"
}
]
단일 파이프라인 가져오기
- GitLab 14.6에서 응답의
iid
가 도입됨.- GitLab 15.11에서 응답의
name
가 도입됨 플래그pipeline_name_in_api
와 함께. 기본적으로 비활성화됨.- GitLab 16.3에서 응답의
name
가 일반적으로 사용 가능. 기능 플래그pipeline_name_in_api
가 제거됨.
프로젝트에서 하나의 파이프라인을 가져옵니다.
단일 하위 파이프라인도 가져올 수 있습니다.
GET /projects/:id/pipelines/:pipeline_id
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id |
integer/string | 예 | 프로젝트의 ID 또는 URL 인코딩된 경로 |
pipeline_id |
integer | 예 | 파이프라인의 ID |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/pipelines/46"
응답 예시
{
"id": 287,
"iid": 144,
"project_id": 21,
"name": "Build pipeline",
"sha": "50f0acb76a40e34a4ff304f7347dcc6587da8a14",
"ref": "main",
"status": "success",
"source": "push",
"created_at": "2022-09-21T01:05:07.200Z",
"updated_at": "2022-09-21T01:05:50.185Z",
"web_url": "http://127.0.0.1:3000/test-group/test-project/-/pipelines/287",
"before_sha": "8a24fb3c5877a6d0b611ca41fc86edc174593e2b",
"tag": false,
"yaml_errors": null,
"user": {
"id": 1,
"username": "root",
"name": "Administrator",
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"web_url": "http://127.0.0.1:3000/root"
},
"started_at": "2022-09-21T01:05:14.197Z",
"finished_at": "2022-09-21T01:05:50.175Z",
"committed_at": null,
"duration": 34,
"queued_duration": 6,
"coverage": null,
"detailed_status": {
"icon": "status_success",
"text": "passed",
"label": "passed",
"group": "success",
"tooltip": "passed",
"has_details": false,
"details_path": "/test-group/test-project/-/pipelines/287",
"illustration": null,
"favicon": "/assets/ci_favicons/favicon_status_success-8451333011eee8ce9f2ab25dc487fe24a8758c694827a582f17f42b0a90446a2.png"
}
}
최신 파이프라인 가져오기
- 응답의
name
은 GitLab 15.11에서pipeline_name_in_api
라는 플래그와 함께 도입되었습니다. 기본적으로 비활성화되어 있습니다.- 응답의
name
은 GitLab 16.3에서 일반적으로 제공됩니다. 기능 플래그pipeline_name_in_api
가 제거되었습니다.
특정 프로젝트의 특정 참조에 대한 최신 커밋의 최신 파이프라인을 가져옵니다. 커밋에 대한 파이프라인이 존재하지 않으면 403
상태 코드가 반환됩니다.
GET /projects/:id/pipelines/latest
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
ref |
문자열 | 아니오 | 최신 파이프라인을 확인할 브랜치 또는 태그. 지정되지 않으면 기본 브랜치로 기본값을 설정합니다. |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/pipelines/latest"
응답 예시
{
"id": 287,
"iid": 144,
"project_id": 21,
"name": "Build pipeline",
"sha": "50f0acb76a40e34a4ff304f7347dcc6587da8a14",
"ref": "main",
"status": "success",
"source": "push",
"created_at": "2022-09-21T01:05:07.200Z",
"updated_at": "2022-09-21T01:05:50.185Z",
"web_url": "http://127.0.0.1:3000/test-group/test-project/-/pipelines/287",
"before_sha": "8a24fb3c5877a6d0b611ca41fc86edc174593e2b",
"tag": false,
"yaml_errors": null,
"user": {
"id": 1,
"username": "root",
"name": "Administrator",
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"web_url": "http://127.0.0.1:3000/root"
},
"started_at": "2022-09-21T01:05:14.197Z",
"finished_at": "2022-09-21T01:05:50.175Z",
"committed_at": null,
"duration": 34,
"queued_duration": 6,
"coverage": null,
"detailed_status": {
"icon": "status_success",
"text": "passed",
"label": "passed",
"group": "success",
"tooltip": "passed",
"has_details": false,
"details_path": "/test-group/test-project/-/pipelines/287",
"illustration": null,
"favicon": "/assets/ci_favicons/favicon_status_success-8451333011eee8ce9f2ab25dc487fe24a8758c694827a582f17f42b0a90446a2.png"
}
}
파이프라인 변수 가져오기
파이프라인의 변수를 가져옵니다. 파이프라인 일정에서 오는 변수는 포함되지 않습니다.
자세한 내용은 문서 250850을 참조하세요.
GET /projects/:id/pipelines/:pipeline_id/variables
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id |
integer/string | 예 | 프로젝트의 ID 또는 URL 인코딩된 경로 |
pipeline_id |
integer | 예 | 파이프라인의 ID |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/pipelines/46/variables"
응답 예시
[
{
"key": "RUN_NIGHTLY_BUILD",
"variable_type": "env_var",
"value": "true"
},
{
"key": "foo",
"value": "bar"
}
]
파이프라인의 테스트 보고서 가져오기
참고: 이 API 경로는 단위 테스트 보고서 기능의 일부입니다.
GET /projects/:id/pipelines/:pipeline_id/test_report
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id |
integer/string | 예 | 프로젝트의 ID 또는 URL 인코딩된 경로 |
pipeline_id |
integer | 예 | 파이프라인의 ID |
샘플 요청:
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/pipelines/46/test_report"
샘플 응답:
{
"total_time": 5,
"total_count": 1,
"success_count": 1,
"failed_count": 0,
"skipped_count": 0,
"error_count": 0,
"test_suites": [
{
"name": "Secure",
"total_time": 5,
"total_count": 1,
"success_count": 1,
"failed_count": 0,
"skipped_count": 0,
"error_count": 0,
"test_cases": [
{
"status": "success",
"name": "Security Reports can create an auto-remediation MR",
"classname": "vulnerability_management_spec",
"execution_time": 5,
"system_output": null,
"stack_trace": null
}
]
}
]
}
파이프라인의 테스트 보고서 요약 가져오기
참고: 이 API 경로는 단위 테스트 보고서 기능의 일부입니다.
GET /projects/:id/pipelines/:pipeline_id/test_report_summary
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id |
integer/string | 예 | 프로젝트의 ID 또는 URL 인코딩된 경로 |
pipeline_id |
integer | 예 | 파이프라인의 ID |
샘플 요청:
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/pipelines/46/test_report_summary"
샘플 응답:
{
"total": {
"time": 1904,
"count": 3363,
"success": 3351,
"failed": 0,
"skipped": 12,
"error": 0,
"suite_error": null
},
"test_suites": [
{
"name": "test",
"total_time": 1904,
"total_count": 3363,
"success_count": 3351,
"failed_count": 0,
"skipped_count": 12,
"error_count": 0,
"build_ids": [
66004
],
"suite_error": null
}
]
}
새 파이프라인 생성
iid
응답에서 도입됨 GitLab 14.6에서.
POST /projects/:id/pipeline
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id |
integer/string | 예 | 프로젝트의 ID 또는 URL 인코딩 경로 |
ref |
string | 예 | 파이프라인을 실행할 브랜치 또는 태그. 병합 요청 파이프라인의 경우 병합 요청 엔드포인트를 사용하세요. |
variables |
array | 아니오 | 파이프라인에서 사용할 수 있는 변수를 포함하고 있는 해시 배열. 구조는 [{ 'key': 'UPLOAD_TO_S3', 'variable_type': 'file', 'value': 'true' }, {'key': 'TEST', 'value': 'test variable'}] 입니다. variable_type 이 제외된 경우 기본값은 env_var 입니다. |
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/pipeline?ref=main"
응답 예시
{
"id": 61,
"iid": 21,
"project_id": 1,
"sha": "384c444e840a515b23f21915ee5766b87068a70d",
"ref": "main",
"status": "pending",
"before_sha": "0000000000000000000000000000000000000000",
"tag": false,
"yaml_errors": null,
"user": {
"name": "관리자",
"username": "root",
"id": 1,
"state": "활성화됨",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"web_url": "http://localhost:3000/root"
},
"created_at": "2016-11-04T09:36:13.747Z",
"updated_at": "2016-11-04T09:36:13.977Z",
"started_at": null,
"finished_at": null,
"committed_at": null,
"duration": null,
"queued_duration": 0.010,
"coverage": null,
"web_url": "https://example.com/foo/bar/pipelines/61"
}
파이프라인에서 작업 재시도
iid
응답에서 도입됨 GitLab 14.6에서.
실패하거나 취소된 작업을 파이프라인에서 재시도합니다. 파이프라인에 실패하거나 취소된 작업이 없다면, 이 엔드포인트를 호출해도 아무런 효과가 없습니다.
POST /projects/:id/pipelines/:pipeline_id/retry
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id |
integer/string | 예 | 프로젝트의 ID 또는 URL 인코딩 경로 |
pipeline_id |
integer | 예 | 파이프라인의 ID |
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/pipelines/46/retry"
응답:
{
"id": 46,
"iid": 11,
"project_id": 1,
"status": "pending",
"ref": "main",
"sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
"before_sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
"tag": false,
"yaml_errors": null,
"user": {
"name": "관리자",
"username": "root",
"id": 1,
"state": "활성화됨",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"web_url": "http://localhost:3000/root"
},
"created_at": "2016-08-11T11:28:34.085Z",
"updated_at": "2016-08-11T11:32:35.169Z",
"started_at": null,
"finished_at": "2016-08-11T11:32:35.145Z",
"committed_at": null,
"duration": null,
"queued_duration": 0.010,
"coverage": null,
"web_url": "https://example.com/foo/bar/pipelines/46"
}
파이프라인 작업 취소
POST /projects/:id/pipelines/:pipeline_id/cancel
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id |
정수/문자열 | 예 | 프로젝트의 ID 또는 URL 인코딩된 경로 |
pipeline_id |
정수 | 예 | 파이프라인의 ID |
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/pipelines/46/cancel"
응답:
{
"id": 46,
"iid": 11,
"project_id": 1,
"status": "canceled",
"ref": "main",
"sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
"before_sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
"tag": false,
"yaml_errors": null,
"user": {
"name": "Administrator",
"username": "root",
"id": 1,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"web_url": "http://localhost:3000/root"
},
"created_at": "2016-08-11T11:28:34.085Z",
"updated_at": "2016-08-11T11:32:35.169Z",
"started_at": null,
"finished_at": "2016-08-11T11:32:35.145Z",
"committed_at": null,
"duration": null,
"queued_duration": 0.010,
"coverage": null,
"web_url": "https://example.com/foo/bar/pipelines/46"
}
파이프라인 삭제
파이프라인을 삭제하면 모든 파이프라인 캐시가 만료되고, 빌드, 로그, 아티팩트 및 트리거와 같은 모든 관련 객체가 삭제됩니다.
이 작업은 취소될 수 없습니다.
파이프라인을 삭제해도 자동으로 자식 파이프라인이 삭제되지는 않습니다.
자세한 내용은 관련 문제를 참조하세요.
DELETE /projects/:id/pipelines/:pipeline_id
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id |
정수/문자열 | 예 | 프로젝트의 ID 또는 URL 인코딩된 경로 |
pipeline_id |
정수 | 예 | 파이프라인의 ID |
curl --header "PRIVATE-TOKEN: <your_access_token>" --request "DELETE" "https://gitlab.example.com/api/v4/projects/1/pipelines/46"
파이프라인 메타데이터 업데이트
파이프라인의 메타데이터를 업데이트할 수 있습니다. 메타데이터에는 파이프라인의 이름이 포함됩니다.
PUT /projects/:id/pipelines/:pipeline_id/metadata
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id |
정수/문자열 | 예 | 프로젝트의 ID 또는 URL 인코딩된 경로 |
name |
문자열 | 예 | 새로운 파이프라인의 이름 |
pipeline_id |
정수 | 예 | 파이프라인의 ID |
샘플 요청:
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" --data "name=Some new pipeline name" "https://gitlab.example.com/api/v4/projects/1/pipelines/46/metadata"
샘플 응답:
{
"id": 46,
"iid": 11,
"project_id": 1,
"status": "running",
"ref": "main",
"sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
"before_sha": "a91957a858320c0e17f3a0eca7cfacbff50ea29a",
"tag": false,
"yaml_errors": null,
"user": {
"name": "Administrator",
"username": "root",
"id": 1,
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"web_url": "http://localhost:3000/root"
},
"created_at": "2016-08-11T11:28:34.085Z",
"updated_at": "2016-08-11T11:32:35.169Z",
"started_at": null,
"finished_at": "2016-08-11T11:32:35.145Z",
"committed_at": null,
"duration": null,
"queued_duration": 0.010,
"coverage": null,
"web_url": "https://example.com/foo/bar/pipelines/46",
"name": "Some new pipeline name"
}