- List project jobs
- 파이프라인 작업 목록
- 파이프라인 트리거 작업 목록
- 작업 토큰의 작업 가져오기
- GitLab 에이전트를
CI_JOB_TOKEN
으로 가져오기 - 단일 작업 가져오기
- 로그 파일 가져오기
- 작업 취소하기
- 작업 다시 시도하기
- 작업 삭제
- 작업 실행
Jobs API
List project jobs
- GitLab 15.9에서 도입된 키셋 페이지네이션에 대한 지원이 있습니다. 도입됨.
프로젝트의 작업 목록을 가져옵니다. 작업은 ID의 내림차순으로 정렬됩니다.
기본적으로 이 요청은 20개의 결과를 한 번에 반환합니다. 왜냐하면 API 결과가 페이지네이션되어 있기 때문입니다.
GET /projects/:id/jobs
Attribute | Type | Required | Description |
---|---|---|---|
id |
integer/string | Yes | 프로젝트의 ID 또는 URL 인코딩된 경로. |
scope |
string or array of strings | No | 표시할 작업의 범위. 다음 중 하나 또는 배열: created , pending , running , failed , success , canceled , skipped , waiting_for_resource , 또는 manual . scope 가 제공되지 않으면 모든 작업이 반환됩니다. |
curl --globoff --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/jobs?scope[]=pending&scope[]=running"
응답 예시
[
{
"commit": {
"author_email": "admin@example.com",
"author_name": "Administrator",
"created_at": "2015-12-24T16:51:14.000+01:00",
"id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
"message": "CI 통합을 테스트합니다.",
"short_id": "0ff3ae19",
"title": "CI 통합을 테스트합니다."
},
"coverage": null,
"archived": false,
"allow_failure": false,
"created_at": "2015-12-24T15:51:21.802Z",
"started_at": "2015-12-24T17:54:27.722Z",
"finished_at": "2015-12-24T17:54:27.895Z",
"erased_at": null,
"duration": 0.173,
"queued_duration": 0.010,
"artifacts_file": {
"filename": "artifacts.zip",
"size": 1000
},
"artifacts": [
{"file_type": "archive", "size": 1000, "filename": "artifacts.zip", "file_format": "zip"},
{"file_type": "metadata", "size": 186, "filename": "metadata.gz", "file_format": "gzip"},
{"file_type": "trace", "size": 1500, "filename": "job.log", "file_format": "raw"},
{"file_type": "junit", "size": 750, "filename": "junit.xml.gz", "file_format": "gzip"}
],
"artifacts_expire_at": "2016-01-23T17:54:27.895Z",
"tag_list": [
"docker runner", "ubuntu18"
],
"id": 7,
"name": "teaspoon",
"pipeline": {
"id": 6,
"project_id": 1,
"ref": "main",
"sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
"status": "pending"
},
"ref": "main",
"runner": {
"id": 32,
"description": "",
"ip_address": null,
"active": true,
"paused": false,
"is_shared": true,
"runner_type": "instance_type",
"name": null,
"online": false,
"status": "offline"
},
"runner_manager": {
"id": 1,
"system_id": "s_89e5e9956577",
"version": "16.11.1",
"revision": "535ced5f",
"platform": "linux",
"architecture": "amd64",
"created_at": "2024-05-01T10:12:02.507Z",
"contacted_at": "2024-05-07T06:30:09.355Z",
"ip_address": "127.0.0.1",
"status": "offline"
},
"stage": "test",
"status": "failed",
"failure_reason": "script_failure",
"tag": false,
"web_url": "https://example.com/foo/bar/-/jobs/7",
"project": {
"ci_job_token_scope_enabled": false
},
"user": {
"id": 1,
"name": "Administrator",
"username": "root",
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"web_url": "http://gitlab.dev/root",
"created_at": "2015-12-21T13:14:24.077Z",
"bio": null,
"location": null,
"public_email": "",
"skype": "",
"linkedin": "",
"twitter": "",
"website_url": "",
"organization": ""
}
},
{
"commit": {
"author_email": "admin@example.com",
"author_name": "Administrator",
"created_at": "2015-12-24T16:51:14.000+01:00",
"id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
"message": "CI 통합을 테스트합니다.",
"short_id": "0ff3ae19",
"title": "CI 통합을 테스트합니다."
},
"coverage": null,
"archived": false,
"allow_failure": false,
"created_at": "2015-12-24T15:51:21.727Z",
"started_at": "2015-12-24T17:54:24.729Z",
"finished_at": "2015-12-24T17:54:24.921Z",
"erased_at": null,
"duration": 0.192,
"queued_duration": 0.023,
"artifacts_expire_at": "2016-01-23T17:54:24.921Z",
"tag_list": [
"docker runner", "win10-2004"
],
"id": 6,
"name": "rspec:other",
"pipeline": {
"id": 6,
"project_id": 1,
"ref": "main",
"sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
"status": "pending"
},
"ref": "main",
"artifacts": [],
"runner": null,
"runner_manager": null,
"stage": "test",
"status": "failed",
"failure_reason": "stuck_or_timeout_failure",
"tag": false,
"web_url": "https://example.com/foo/bar/-/jobs/6",
"project": {
"ci_job_token_scope_enabled": false
},
"user": {
"id": 1,
"name": "Administrator",
"username": "root",
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"web_url": "http://gitlab.dev/root",
"created_at": "2015-12-21T13:14:24.077Z",
"bio": null,
"location": null,
"public_email": "",
"skype": "",
"linkedin": "",
"twitter": "",
"website_url": "",
"organization": ""
}
}
]
파이프라인 작업 목록
파이프라인에 대한 작업 목록을 가져옵니다.
기본적으로 이 요청은 한 번에 20개의 결과를 반환합니다. API 결과는 페이지네이션됩니다.
이 엔드포인트는:
GET /projects/:id/pipelines/:pipeline_id/jobs
속성 | 타입 | 필수 | 설명 |
---|---|---|---|
id |
정수/문자열 | 예 | 프로젝트의 ID 또는 URL 인코딩된 경로입니다. |
pipeline_id |
정수 | 예 | 파이프라인의 ID입니다. CI 작업에서 미리 정의된 CI 변수 CI_PIPELINE_ID 를 통해서도 얻을 수 있습니다. |
include_retried |
불리언 | 아니오 | 응답에 재시도된 작업을 포함합니다. 기본값은 false 입니다. |
scope |
문자열 또는 문자열 배열 | 아니오 | 표시할 작업의 범위입니다. 다음 중 하나 또는 배열일 수 있습니다: created , pending , running , failed , success , canceled , skipped , waiting_for_resource , 또는 manual . scope 가 제공되지 않으면 모든 작업이 반환됩니다. |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/pipelines/6/jobs?scope[]=pending&scope[]=running"
응답 예시
[
{
"commit": {
"author_email": "admin@example.com",
"author_name": "Administrator",
"created_at": "2015-12-24T16:51:14.000+01:00",
"id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
"message": "CI 통합 테스트.",
"short_id": "0ff3ae19",
"title": "CI 통합 테스트."
},
"coverage": null,
"archived": false,
"allow_failure": false,
"created_at": "2015-12-24T15:51:21.727Z",
"started_at": "2015-12-24T17:54:24.729Z",
"finished_at": "2015-12-24T17:54:24.921Z",
"erased_at": null,
"duration": 0.192,
"queued_duration": 0.023,
"artifacts_expire_at": "2016-01-23T17:54:24.921Z",
"tag_list": [
"docker runner", "ubuntu18"
],
"id": 6,
"name": "rspec:other",
"pipeline": {
"id": 6,
"project_id": 1,
"ref": "main",
"sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
"status": "pending"
},
"ref": "main",
"artifacts": [],
"runner": {
"id": 32,
"description": "",
"ip_address": null,
"active": true,
"paused": false,
"is_shared": true,
"runner_type": "instance_type",
"name": null,
"online": false,
"status": "offline"
},
"runner_manager": {
"id": 1,
"system_id": "s_89e5e9956577",
"version": "16.11.1",
"revision": "535ced5f",
"platform": "linux",
"architecture": "amd64",
"created_at": "2024-05-01T10:12:02.507Z",
"contacted_at": "2024-05-07T06:30:09.355Z",
"ip_address": "127.0.0.1"
},
"stage": "test",
"status": "failed",
"failure_reason": "stuck_or_timeout_failure",
"tag": false,
"web_url": "https://example.com/foo/bar/-/jobs/6",
"project": {
"ci_job_token_scope_enabled": false
},
"user": {
"id": 1,
"name": "Administrator",
"username": "root",
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"web_url": "http://gitlab.dev/root",
"created_at": "2015-12-21T13:14:24.077Z",
"bio": null,
"location": null,
"public_email": "",
"skype": "",
"linkedin": "",
"twitter": "",
"website_url": "",
"organization": ""
}
},
{
"commit": {
"author_email": "admin@example.com",
"author_name": "Administrator",
"created_at": "2015-12-24T16:51:14.000+01:00",
"id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
"message": "CI 통합 테스트.",
"short_id": "0ff3ae19",
"title": "CI 통합 테스트."
},
"coverage": null,
"archived": false,
"allow_failure": false,
"created_at": "2015-12-24T15:51:21.802Z",
"started_at": "2015-12-24T17:54:27.722Z",
"finished_at": "2015-12-24T17:54:27.895Z",
"erased_at": null,
"duration": 0.173,
"queued_duration": 0.023,
"artifacts_file": {
"filename": "artifacts.zip",
"size": 1000
},
"artifacts": [
{"file_type": "archive", "size": 1000, "filename": "artifacts.zip", "file_format": "zip"},
{"file_type": "metadata", "size": 186, "filename": "metadata.gz", "file_format": "gzip"},
{"file_type": "trace", "size": 1500, "filename": "job.log", "file_format": "raw"},
{"file_type": "junit", "size": 750, "filename": "junit.xml.gz", "file_format": "gzip"}
],
"artifacts_expire_at": "2016-01-23T17:54:27.895Z",
"tag_list": [
"docker runner", "ubuntu18"
],
"id": 7,
"name": "teaspoon",
"pipeline": {
"id": 6,
"project_id": 1,
"ref": "main",
"sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
"status": "pending"
},
"ref": "main",
"runner": null,
"runner_manager": null,
"stage": "test",
"status": "failed",
"failure_reason": "script_failure",
"tag": false,
"web_url": "https://example.com/foo/bar/-/jobs/7",
"project": {
"ci_job_token_scope_enabled": false
},
"user": {
"id": 1,
"name": "Administrator",
"username": "root",
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"web_url": "http://gitlab.dev/root",
"created_at": "2015-12-21T13:14:24.077Z",
"bio": null,
"location": null,
"public_email": "",
"skype": "",
"linkedin": "",
"twitter": "",
"website_url": "",
"organization": ""
}
}
]
파이프라인 트리거 작업 목록
파이프라인에 대한 트리거 작업 목록을 가져옵니다.
GET /projects/:id/pipelines/:pipeline_id/bridges
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id |
정수/문자열 | 예 | 프로젝트의 ID 또는 URL-인코딩된 경로. |
pipeline_id |
정수 | 예 | 파이프라인의 ID입니다. |
scope |
문자열 또는 문자열 배열 | 아니오 | 표시할 작업의 범위입니다. 다음 중 하나 또는 배열이어야 합니다: created , pending , running , failed , success , canceled , skipped , waiting_for_resource , 또는 manual . scope 가 제공되지 않으면 모든 작업이 반환됩니다. |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/pipelines/6/bridges?scope[]=pending&scope[]=running"
응답 예시
[
{
"commit": {
"author_email": "admin@example.com",
"author_name": "Administrator",
"created_at": "2015-12-24T16:51:14.000+01:00",
"id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
"message": "CI 통합 테스트.",
"short_id": "0ff3ae19",
"title": "CI 통합 테스트."
},
"coverage": null,
"archived": false,
"allow_failure": false,
"created_at": "2015-12-24T15:51:21.802Z",
"started_at": "2015-12-24T17:54:27.722Z",
"finished_at": "2015-12-24T17:58:27.895Z",
"erased_at": null,
"duration": 240,
"queued_duration": 0.123,
"id": 7,
"name": "teaspoon",
"pipeline": {
"id": 6,
"project_id": 1,
"ref": "main",
"sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
"status": "pending",
"created_at": "2015-12-24T15:50:16.123Z",
"updated_at": "2015-12-24T18:00:44.432Z",
"web_url": "https://example.com/foo/bar/pipelines/6"
},
"ref": "main",
"stage": "test",
"status": "pending",
"tag": false,
"web_url": "https://example.com/foo/bar/-/jobs/7",
"project": {
"ci_job_token_scope_enabled": false
},
"user": {
"id": 1,
"name": "Administrator",
"username": "root",
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"web_url": "http://gitlab.dev/root",
"created_at": "2015-12-21T13:14:24.077Z",
"bio": null,
"location": null,
"public_email": "",
"skype": "",
"linkedin": "",
"twitter": "",
"website_url": "",
"organization": ""
},
"downstream_pipeline": {
"id": 5,
"sha": "f62a4b2fb89754372a346f24659212eb8da13601",
"ref": "main",
"status": "pending",
"created_at": "2015-12-24T17:54:27.722Z",
"updated_at": "2015-12-24T17:58:27.896Z",
"web_url": "https://example.com/diaspora/diaspora-client/pipelines/5"
}
}
]
작업 토큰의 작업 가져오기
작업 토큰을 생성한 작업을 가져옵니다.
GET /job
예시 (다음의 CI/CD 작업의 script
섹션의 일부로 실행해야 합니다):
curl --header "Authorization: Bearer $CI_JOB_TOKEN" "${CI_API_V4_URL}/job"
curl --header "JOB-TOKEN: $CI_JOB_TOKEN" "${CI_API_V4_URL}/job"
curl "${CI_API_V4_URL}/job?job_token=$CI_JOB_TOKEN"
응답 예시
{
"commit": {
"author_email": "admin@example.com",
"author_name": "Administrator",
"created_at": "2015-12-24T16:51:14.000+01:00",
"id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
"message": "CI 통합 테스트.",
"short_id": "0ff3ae19",
"title": "CI 통합 테스트."
},
"coverage": null,
"archived": false,
"allow_failure": false,
"created_at": "2015-12-24T15:51:21.880Z",
"started_at": "2015-12-24T17:54:30.733Z",
"finished_at": "2015-12-24T17:54:31.198Z",
"erased_at": null,
"duration": 0.465,
"queued_duration": 0.123,
"artifacts_expire_at": "2016-01-23T17:54:31.198Z",
"id": 8,
"name": "rubocop",
"pipeline": {
"id": 6,
"project_id": 1,
"ref": "main",
"sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
"status": "pending"
},
"ref": "main",
"artifacts": [],
"runner": null,
"runner_manager": null,
"stage": "test",
"status": "failed",
"failure_reason": "script_failure",
"tag": false,
"web_url": "https://example.com/foo/bar/-/jobs/8",
"project": {
"ci_job_token_scope_enabled": false
},
"user": {
"id": 1,
"name": "Administrator",
"username": "root",
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"web_url": "http://gitlab.dev/root",
"created_at": "2015-12-21T13:14:24.077Z",
"bio": null,
"location": null,
"public_email": "",
"skype": "",
"linkedin": "",
"twitter": "",
"website_url": "",
"organization": ""
}
}
GitLab 에이전트를 CI_JOB_TOKEN
으로 가져오기
CI_JOB_TOKEN
을 생성한 작업과 허용된
agents 목록을 가져옵니다.
GET /job/allowed_agents
지원되는 속성:
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
CI_JOB_TOKEN |
string | 예 | GitLab에서 제공하는 CI_JOB_TOKEN 변수와 연관된 토큰 값입니다. |
예시 요청:
curl --header "JOB-TOKEN: <CI_JOB_TOKEN>" "https://gitlab.example.com/api/v4/job/allowed_agents"
curl "https://gitlab.example.com/api/v4/job/allowed_agents?job_token=<CI_JOB_TOKEN>"
예시 응답:
{
"allowed_agents": [
{
"id": 1,
"config_project": {
"id": 1,
"description": null,
"name": "project1",
"name_with_namespace": "John Doe2 / project1",
"path": "project1",
"path_with_namespace": "namespace1/project1",
"created_at": "2022-11-16T14:51:50.579Z"
}
}
],
"job": {
"id": 1
},
"pipeline": {
"id": 2
},
"project": {
"id": 1,
"groups": [
{
"id": 1
},
{
"id": 2
},
{
"id": 3
}
]
},
"user": {
"id": 2,
"name": "John Doe3",
"username": "user2",
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/10fc7f102b",
"web_url": "http://localhost/user2"
}
}
단일 작업 가져오기
프로젝트의 단일 작업을 가져옵니다.
GET /projects/:id/jobs/:job_id
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id |
integer/string | 예 | 프로젝트의 ID 또는 URL 인코딩된 경로입니다. |
job_id |
integer | 예 | 작업의 ID입니다. |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/jobs/8"
응답 예시:
{
"commit": {
"author_email": "admin@example.com",
"author_name": "Administrator",
"created_at": "2015-12-24T16:51:14.000+01:00",
"id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
"message": "Test the CI integration.",
"short_id": "0ff3ae19",
"title": "Test the CI integration."
},
"coverage": null,
"archived": false,
"allow_failure": false,
"created_at": "2015-12-24T15:51:21.880Z",
"started_at": "2015-12-24T17:54:30.733Z",
"finished_at": "2015-12-24T17:54:31.198Z",
"erased_at": null,
"duration": 0.465,
"queued_duration": 0.010,
"artifacts_expire_at": "2016-01-23T17:54:31.198Z",
"tag_list": [
"docker runner", "macos-10.15"
],
"id": 8,
"name": "rubocop",
"pipeline": {
"id": 6,
"project_id": 1,
"ref": "main",
"sha": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
"status": "pending"
},
"ref": "main",
"artifacts": [],
"runner": null,
"runner_manager": null,
"stage": "test",
"status": "failed",
"tag": false,
"web_url": "https://example.com/foo/bar/-/jobs/8",
"project": {
"ci_job_token_scope_enabled": false
},
"user": {
"id": 1,
"name": "Administrator",
"username": "root",
"state": "active",
"avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
"web_url": "http://gitlab.dev/root",
"created_at": "2015-12-21T13:14:24.077Z",
"bio": null,
"location": null,
"public_email": "",
"skype": "",
"linkedin": "",
"twitter": "",
"website_url": "",
"organization": ""
}
}
로그 파일 가져오기
특정 프로젝트의 작업 로그(추적)를 가져옵니다:
GET /projects/:id/jobs/:job_id/trace
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id |
integer/string | 예 | 프로젝트의 ID 또는 URL-인코딩된 경로. |
job_id |
integer | 예 | 작업의 ID입니다. |
curl --location --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/jobs/8/trace"
가능한 응답 상태 코드:
상태 | 설명 |
---|---|
200 | 로그 파일을 제공합니다. |
404 | 작업을 찾을 수 없거나 로그 파일이 없습니다. |
작업 취소하기
프로젝트의 단일 작업을 취소합니다.
POST /projects/:id/jobs/:job_id/cancel
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id |
integer/string | 예 | 프로젝트의 ID 또는 URL-인코딩된 경로. |
job_id |
integer | 예 | 작업의 ID입니다. |
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/jobs/1/cancel"
응답 예시
{
"commit": {
"author_email": "admin@example.com",
"author_name": "Administrator",
"created_at": "2015-12-24T16:51:14.000+01:00",
"id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
"message": "Test the CI integration.",
"short_id": "0ff3ae19",
"title": "Test the CI integration."
},
"coverage": null,
"archived": false,
"allow_failure": false,
"created_at": "2016-01-11T10:13:33.506Z",
"started_at": "2016-01-11T10:14:09.526Z",
"finished_at": null,
"erased_at": null,
"duration": 8,
"queued_duration": 0.010,
"id": 1,
"name": "rubocop",
"ref": "main",
"artifacts": [],
"runner": null,
"runner_manager": null,
"stage": "test",
"status": "canceled",
"tag": false,
"web_url": "https://example.com/foo/bar/-/jobs/1",
"project": {
"ci_job_token_scope_enabled": false
},
"user": null
}
작업 다시 시도하기
프로젝트의 단일 작업을 다시 시도합니다.
POST /projects/:id/jobs/:job_id/retry
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id |
integer/string | 예 | 프로젝트의 ID 또는 URL-인코딩된 경로. |
job_id |
integer | 예 | 작업의 ID입니다. |
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/jobs/1/retry"
응답 예시
{
"commit": {
"author_email": "admin@example.com",
"author_name": "Administrator",
"created_at": "2015-12-24T16:51:14.000+01:00",
"id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
"message": "Test the CI integration.",
"short_id": "0ff3ae19",
"title": "Test the CI integration."
},
"coverage": null,
"archived": false,
"allow_failure": false,
"created_at": "2016-01-11T10:13:33.506Z",
"started_at": null,
"finished_at": null,
"erased_at": null,
"duration": null,
"queued_duration": 0.010,
"id": 1,
"name": "rubocop",
"ref": "main",
"artifacts": [],
"runner": null,
"runner_manager": null,
"stage": "test",
"status": "pending",
"tag": false,
"web_url": "https://example.com/foo/bar/-/jobs/1",
"project": {
"ci_job_token_scope_enabled": false
},
"user": null
}
참고: GitLab 17.0 이전에는 이 엔드포인트가 트리거 작업을 지원하지 않습니다.
작업 삭제
프로젝트의 단일 작업 삭제 (작업 아티팩트 및 작업 로그 제거)
POST /projects/:id/jobs/:job_id/erase
매개변수
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id |
정수/문자열 | 예 | 프로젝트의 ID 또는 URL 인코딩된 경로. |
job_id |
정수 | 예 | 작업의 ID. |
요청 예시
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/jobs/1/erase"
응답 예시
{
"commit": {
"author_email": "admin@example.com",
"author_name": "Administrator",
"created_at": "2015-12-24T16:51:14.000+01:00",
"id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
"message": "CI 통합 테스트.",
"short_id": "0ff3ae19",
"title": "CI 통합 테스트."
},
"coverage": null,
"archived": false,
"allow_failure": false,
"download_url": null,
"id": 1,
"name": "rubocop",
"ref": "main",
"artifacts": [],
"runner": null,
"runner_manager": null,
"stage": "test",
"created_at": "2016-01-11T10:13:33.506Z",
"started_at": "2016-01-11T10:13:33.506Z",
"finished_at": "2016-01-11T10:15:10.506Z",
"erased_at": "2016-01-11T11:30:19.914Z",
"duration": 97.0,
"queued_duration": 0.010,
"status": "failed",
"tag": false,
"web_url": "https://example.com/foo/bar/-/jobs/1",
"project": {
"ci_job_token_scope_enabled": false
},
"user": null
}
참고: API를 통해 보관된 작업을 삭제할 수는 없지만 특정 날짜 이전에 완료된 작업의 작업 아티팩트 및 로그를 삭제할 수 있습니다.
작업 실행
수동 상태의 작업에 대해 작업을 시작하기 위한 동작을 트리거합니다.
POST /projects/:id/jobs/:job_id/play
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
id |
정수/문자열 | 예 | 프로젝트의 ID 또는 URL 인코딩된 경로. |
job_id |
정수 | 예 | 작업의 ID. |
job_variables_attributes |
해시 배열 | 아니오 | 작업에 사용할 수 있는 사용자 정의 변수를 포함하는 배열. |
요청 예시:
curl --request POST "https://gitlab.example.com/api/v4/projects/1/jobs/1/play" \
--header "Content-Type: application/json" \
--header "PRIVATE-TOKEN: <your_access_token>" \
--data @variables.json
@variables.json
의 구조는 다음과 같습니다:
{
"job_variables_attributes": [
{
"key": "TEST_VAR_1",
"value": "test1"
},
{
"key": "TEST_VAR_2",
"value": "test2"
}
]
}
응답 예시:
{
"commit": {
"author_email": "admin@example.com",
"author_name": "Administrator",
"created_at": "2015-12-24T16:51:14.000+01:00",
"id": "0ff3ae198f8601a285adcf5c0fff204ee6fba5fd",
"message": "CI 통합 테스트.",
"short_id": "0ff3ae19",
"title": "CI 통합 테스트."
},
"coverage": null,
"archived": false,
"allow_failure": false,
"created_at": "2016-01-11T10:13:33.506Z",
"started_at": null,
"finished_at": null,
"erased_at": null,
"duration": null,
"queued_duration": 0.010,
"id": 1,
"name": "rubocop",
"ref": "main",
"artifacts": [],
"runner": null,
"runner_manager": null,
"stage": "test",
"status": "pending",
"tag": false,
"web_url": "https://example.com/foo/bar/-/jobs/1",
"project": {
"ci_job_token_scope_enabled": false
},
"user": null
}