파이프라인 템플릿 API
파이프라인 템플릿 API 엔드포인트를 사용하면 관리자가 조직의 파이프라인 템플릿을 생성하고 관리할 수 있어요. 관리자가 아닌 사용자는 조직 관리자가 available로 표시한 파이프라인 템플릿만 읽거나 지정할 수 있어요.
출처: 문서
본문
파이프라인 템플릿 데이터 모델
uuid |
파이프라인 템플릿의 UUID예요. |
|---|---|
graphql_id |
파이프라인 템플릿의 GraphQL ID예요. |
name |
파이프라인 템플릿의 이름이에요. |
description |
파이프라인 템플릿의 설명이에요. |
configuration |
파이프라인 템플릿의 YAML 스텝 설정이에요. |
available |
true로 설정하면 관리자가 아닌 사용자도 파이프라인 템플릿을 파이프라인에 지정할 수 있어요. 기본값: false |
url |
파이프라인 템플릿의 표준 API URL이에요. |
web_url |
Buildkite에서의 파이프라인 템플릿 URL이에요. |
created_at |
파이프라인 템플릿이 생성된 시점이에요. |
created_by |
파이프라인 템플릿을 만든 사용자예요. |
updated_at |
파이프라인 템플릿이 업데이트된 시점이에요. |
updated_by |
파이프라인 템플릿을 가장 최근에 업데이트한 사용자예요. |
파이프라인 템플릿 목록 조회
조직의 파이프라인 템플릿 목록을 반환해요.
curl -H "Authorization: Bearer ***" \
-X GET "https://api.buildkite.com/v2/organizations/{org.slug}/pipeline-templates"
[
{
"uuid": "018a86cc-db73-7d15-8c68-5023cf8d64c3",
"graphql_id": "UGlwZWxpbmVUZW1wbGF0ZS0tLTAxOGE4NmNjLWRiNzMtN2QxNS04YzY4LTUwMjNjZjhkNjRjMw==",
"name": "Build template",
"description": "Shared build steps configuration",
"configuration": "steps:\n - label: \":hammer: Build\"\n command: \"scripts/build.sh\"",
"available": false,
"url": "http:///api.buildkite.com/v2/organizations/acme-inc/pipeline-templates/018a86cc-db73-7d15-8c68-5023cf8d64c3",
"web_url": "http://www.buildkite.com/organizations/acme-inc/pipeline-templates/018a86cc-db73-7d15-8c68-5023cf8d64c3",
"created_at": "2023-05-03T04:17:55.867Z",
"created_by": {
"id": "3d3c3bf0-7d58-4afe-8fe7-b3017d5504de",
"graphql_id": "VXNlci0tLTNkM2MzYmYwLTdkNTgtNGFmZS04ZmU3LWIzMDE3ZDU1MDRkZQo=",
"name": "Sam Kim",
"email": "sam@example.com",
"avatar_url": "https://www.gravatar.com/avatar/example",
"created_at": "2013-05-03T04:17:55.867Z"
},
"updated_at": "2023-06-12T04:17:55.867Z",
"updated_by": {
"id": "3d3c3bf0-7d58-4afe-8fe7-b3017d5504de",
"graphql_id": "VXNlci0tLTNkM2MzYmYwLTdkNTgtNGFmZS04ZmU3LWIzMDE3ZDU1MDRkZQo=",
"name": "Sam Kim",
"email": "sam@example.com",
"avatar_url": "https://www.gravatar.com/avatar/example",
"created_at": "2013-05-03T04:17:55.867Z"
}
}
]
필요한 범위(scope): read_pipeline_templates
성공 응답: 200 OK
파이프라인 템플릿 조회
curl -H "Authorization: Bearer ***" \
-X GET "https://api.buildkite.com/v2/organizations/{org.slug}/pipeline-templates/{uuid}"
{
"uuid": "018a86cc-db73-7d15-8c68-5023cf8d64c3",
"graphql_id": "UGlwZWxpbmVUZW1wbGF0ZS0tLTAxOGE4NmNjLWRiNzMtN2QxNS04YzY4LTUwMjNjZjhkNjRjMw==",
"name": "Build template",
"description": "Shared build steps configuration",
"configuration": "steps:\n - label: \":hammer: Build\"\n command: \"scripts/build.sh\"",
"available": false,
"url": "http:///api.buildkite.com/v2/organizations/acme-inc/pipeline-templates/018a86cc-db73-7d15-8c68-5023cf8d64c3",
"web_url": "http://www.buildkite.com/organizations/acme-inc/pipeline-templates/018a86cc-db73-7d15-8c68-5023cf8d64c3",
"created_at": "2023-05-03T04:17:55.867Z",
"created_by": {
"id": "3d3c3bf0-7d58-4afe-8fe7-b3017d5504de",
"graphql_id": "VXNlci0tLTNkM2MzYmYwLTdkNTgtNGFmZS04ZmU3LWIzMDE3ZDU1MDRkZQo=",
"name": "Sam Kim",
"email": "sam@example.com",
"avatar_url": "https://www.gravatar.com/avatar/example",
"created_at": "2023-08-29T10:10:03.000Z"
},
"updated_at": "2023-06-12T04:17:55.867Z",
"updated_by": {
"id": "3d3c3bf0-7d58-4afe-8fe7-b3017d5504de",
"graphql_id": "VXNlci0tLTNkM2MzYmYwLTdkNTgtNGFmZS04ZmU3LWIzMDE3ZDU1MDRkZQo=",
"name": "Sam Kim",
"email": "sam@example.com",
"avatar_url": "https://www.gravatar.com/avatar/example",
"created_at": "2013-05-03T04:17:55.867Z"
}
}
필요한 범위(scope): read_pipeline_templates
성공 응답: 200 OK
파이프라인 템플릿 생성
curl -H "Authorization: Bearer ***" \
-X POST "https://api.buildkite.com/v2/organizations/{org.slug}/pipeline-templates" \
-H "Content-Type: application/json" \
-d '{
"name": ":hammer: Build",
"description": "Shared build steps configuration",
"configuration": "steps:\n - label: \":hammer: Build\"\n command: \"scripts/build.sh\"",
"available": true
}'
{
"uuid": "018a86cc-db73-7d15-8c68-5023cf8d64c3",
"graphql_id": "UGlwZWxpbmVUZW1wbGF0ZS0tLTAxOGE4NmNjLWRiNzMtN2QxNS04YzY4LTUwMjNjZjhkNjRjMw==",
"name": "Build template",
"description": "Shared build steps configuration",
"configuration": "steps:\n - label: \":hammer: Build\"\n command: \"scripts/build.sh\"",
"available": true,
"url": "http:///api.buildkite.com/v2/organizations/acme-inc/pipeline-templates/018a86cc-db73-7d15-8c68-5023cf8d64c3",
"web_url": "http://www.buildkite.com/organizations/acme-inc/pipeline-templates/018a86cc-db73-7d15-8c68-5023cf8d64c3",
"created_at": "2023-05-03T04:17:55.867Z",
"created_by": {
"id": "3d3c3bf0-7d58-4afe-8fe7-b3017d5504de",
"graphql_id": "VXNlci0tLTNkM2MzYmYwLTdkNTgtNGFmZS04ZmU3LWIzMDE3ZDU1MDRkZQo=",
"name": "Sam Kim",
"email": "sam@example.com",
"avatar_url": "https://www.gravatar.com/avatar/example",
"created_at": "2023-08-29T10:10:03.000Z"
},
"updated_at": "2023-06-12T04:17:55.867Z",
"updated_by": {
"id": "3d3c3bf0-7d58-4afe-8fe7-b3017d5504de",
"graphql_id": "VXNlci0tLTNkM2MzYmYwLTdkNTgtNGFmZS04ZmU3LWIzMDE3ZDU1MDRkZQo=",
"name": "Sam Kim",
"email": "sam@example.com",
"avatar_url": "https://www.gravatar.com/avatar/example",
"created_at": "2013-05-03T04:17:55.867Z"
}
}
필수 요청 본문 속성:
name |
파이프라인 템플릿의 이름이에요. 예시: "Build template" |
|---|---|
configuration |
파이프라인 템플릿의 YAML 스텝 설정이에요. 예시: "steps:\n - command: "scripts/build.sh" |
선택 요청 본문 속성:
description |
파이프라인 템플릿의 설명이에요. 예시: "Shared build steps configuration" |
|---|---|
available |
true로 설정하면 관리자가 아닌 사용자도 파이프라인 템플릿을 파이프라인에 지정할 수 있어요. 예시: false |
필요한 범위(scope): write_pipeline_templates
성공 응답: 201 Created
오류 응답:
422 Unprocessable Entity |
{ "message": "Validation failed: Reason for failure" } |
|---|
파이프라인 템플릿 업데이트
curl -H "Authorization: Bearer ***" \
-X PATCH "https://api.buildkite.com/v2/organizations/{org.slug}/pipeline-templates/{uuid}" \
-H "Content-Type: application/json" \
-d '{ "available": true }'
{
"uuid": "018a86cc-db73-7d15-8c68-5023cf8d64c3",
"graphql_id": "UGlwZWxpbmVUZW1wbGF0ZS0tLTAxOGE4NmNjLWRiNzMtN2QxNS04YzY4LTUwMjNjZjhkNjRjMw==",
"name": "Build template",
"description": "Shared build steps configuration",
"configuration": "steps:\n - label: \":hammer: Build\"\n command: \"scripts/build.sh\"",
"available": true,
"url": "http:///api.buildkite.com/v2/organizations/acme-inc/pipeline-templates/018a86cc-db73-7d15-8c68-5023cf8d64c3",
"web_url": "http://www.buildkite.com/organizations/acme-inc/pipeline-templates/018a86cc-db73-7d15-8c68-5023cf8d64c3",
"created_at": "2023-05-03T04:17:55.867Z",
"created_by": {
"id": "3d3c3bf0-7d58-4afe-8fe7-b3017d5504de",
"graphql_id": "VXNlci0tLTNkM2MzYmYwLTdkNTgtNGFmZS04ZmU3LWIzMDE3ZDU1MDRkZQo=",
"name": "Sam Kim",
"email": "sam@example.com",
"avatar_url": "https://www.gravatar.com/avatar/example",
"created_at": "2023-08-29T10:10:03.000Z"
},
"updated_at": "2023-06-12T04:17:55.867Z",
"updated_by": {
"id": "3d3c3bf0-7d58-4afe-8fe7-b3017d5504de",
"graphql_id": "VXNlci0tLTNkM2MzYmYwLTdkNTgtNGFmZS04ZmU3LWIzMDE3ZDU1MDRkZQo=",
"name": "Sam Kim",
"email": "sam@example.com",
"avatar_url": "https://www.gravatar.com/avatar/example",
"created_at": "2013-05-03T04:17:55.867Z"
}
}
선택 요청 본문 속성:
name |
파이프라인 템플릿의 이름이에요. 예시: "Build template" |
|---|---|
description |
파이프라인 템플릿의 설명이에요. 예시: "Shared build steps configuration" |
configuration |
파이프라인 템플릿의 YAML 스텝 설정이에요. 예시: "steps:\n - command: "scripts/build.sh" |
available |
true로 설정하면 관리자가 아닌 사용자도 파이프라인 템플릿을 파이프라인에 지정할 수 있어요. 예시: false |
필요한 범위(scope): write_pipeline_templates
성공 응답: 200 OK
오류 응답:
422 Unprocessable Entity |
{ "message": "Validation failed: Reason for failure" } |
|---|
파이프라인 템플릿 삭제
📘 파이프라인 템플릿은 어떤 파이프라인에도 지정되어 있지 않을 때만 삭제할 수 있어요. 삭제하기 전에 모든 파이프라인에서 파이프라인 템플릿을 제거해야 해요.
curl -H "Authorization: Bearer ***" \
-X DELETE "https://api.buildkite.com/v2/organizations/{org.slug}/pipeline-templates/{uuid}"
필요한 범위(scope): write_pipeline_templates
성공 응답: 204 No Content
오류 응답:
422 Unprocessable Entity |
{ "message": "Reason the pipeline template couldn't be deleted" } |
|---|
더 알아보기 (Learn more)
이 문서에서는 파이프라인 템플릿 API를 통해 조직의 파이프라인 템플릿을 관리하는 방법을 살펴봤어요. 템플릿 데이터 모델부터 목록 조회, 조회, 생성, 업데이트, 삭제까지 익혔으니 이제 공통 빌드 스텝을 재사용 가능한 템플릿으로 손쉽게 관리할 수 있을 거예요.