본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

파이프라인 스케줄 API

원문 보기 위키 갱신

파이프라인 스케줄 API 엔드포인트를 사용하면 파이프라인의 예약 빌드를 관리할 수 있어요. 파이프라인 스케줄은 야간 빌드나 시간별 통합 테스트처럼 지정한 간격으로 빌드를 자동 생성해 줘요.

출처: 문서

본문

파이프라인 스케줄 데이터 모델

id 파이프라인 스케줄의 UUID예요.
graphql_id 파이프라인 스케줄의 GraphQL ID예요.
url 파이프라인 스케줄의 표준 API URL이에요.
label 파이프라인 스케줄을 설명하는 라벨이에요.
cronline 빌드를 트리거하는 데 사용하는 간격이에요. 미리 정의된 간격(예: @hourly 또는 @daily) 또는 crontab 시간 문법 문자열이에요.
message 파이프라인 스케줄이 만든 빌드에 사용되는 메시지예요.
commit 파이프라인 스케줄이 만든 빌드에 사용되는 커밋이에요. 기본값은 HEAD예요.
branch 파이프라인 스케줄이 만든 빌드에 사용되는 브랜치예요. 기본값은 파이프라인의 기본 브랜치예요.
env 파이프라인 스케줄이 만든 빌드에 설정할 환경 변수의 JSON 객체예요.
enabled 파이프라인 스케줄이 활성화되어 있는지 여부예요.
next_build_at 다음 빌드가 생성될 시점이에요.
failed_message 가장 최근에 빌드 생성을 실패한 시도의 실패 메시지예요. 가장 최근 시도가 성공했다면 null이에요.
failed_at 가장 최근에 빌드 생성을 실패한 시도가 발생한 시점이에요. 가장 최근 시도가 성공했다면 null이에요.
created_at 파이프라인 스케줄이 생성된 시점이에요.
created_by 파이프라인 스케줄을 만든 사용자예요.
pipeline 상위 파이프라인에 대한 참조로, id, slug, API url을 포함해요.

파이프라인 스케줄 목록 조회

가장 최근에 생성된 순서대로 파이프라인의 스케줄 페이지별 목록을 반환해요.

요청 예시:

curl -H "Authorization: Bearer ***" \
  -X GET "https://api.buildkite.com/v2/organizations/{org.slug}/pipelines/{pipeline.slug}/schedules"

응답 예시:

[
  {
    "id": "b3a1e9f2-7c4d-4f1a-9e6c-2d8a5f7b1c3d",
    "graphql_id": "UGlwZWxpbmVTY2hlZHVsZS0tLWIzYTFlOWYyLTdjNGQtNGYxYS05ZTZjLTJkOGE1ZjdiMWMzZA==",
    "url": "https://api.buildkite.com/v2/organizations/acme-inc/pipelines/my-pipeline/schedules/b3a1e9f2-7c4d-4f1a-9e6c-2d8a5f7b1c3d",
    "label": "Nightly build",
    "cronline": "@daily",
    "message": "Nightly scheduled build",
    "commit": "HEAD",
    "branch": "main",
    "env": {
      "DEPLOY_ENV": "staging"
    },
    "enabled": true,
    "next_build_at": "2024-01-02T00:00:00.000Z",
    "failed_message": null,
    "failed_at": null,
    "created_at": "2024-01-01T12:00:00.000Z",
    "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"
    },
    "pipeline": {
      "id": "9d1d1e9c-5e8f-4f9a-9b0c-1a2b3c4d5e6f",
      "slug": "my-pipeline",
      "url": "https://api.buildkite.com/v2/organizations/acme-inc/pipelines/my-pipeline"
    }
  }
]

필요한 범위(scope): read_pipelines

성공 응답: 200 OK

파이프라인 스케줄 조회

단일 파이프라인 스케줄의 세부 정보를 반환해요.

요청 예시:

curl -H "Authorization: Bearer ***" \
  -X GET "https://api.buildkite.com/v2/organizations/{org.slug}/pipelines/{pipeline.slug}/schedules/{id}"

응답 예시:

{
  "id": "b3a1e9f2-7c4d-4f1a-9e6c-2d8a5f7b1c3d",
  "graphql_id": "UGlwZWxpbmVTY2hlZHVsZS0tLWIzYTFlOWYyLTdjNGQtNGYxYS05ZTZjLTJkOGE1ZjdiMWMzZA==",
  "url": "https://api.buildkite.com/v2/organizations/acme-inc/pipelines/my-pipeline/schedules/b3a1e9f2-7c4d-4f1a-9e6c-2d8a5f7b1c3d",
  "label": "Nightly build",
  "cronline": "@daily",
  "message": "Nightly scheduled build",
  "commit": "HEAD",
  "branch": "main",
  "env": {
    "DEPLOY_ENV": "staging"
  },
  "enabled": true,
  "next_build_at": "2024-01-02T00:00:00.000Z",
  "failed_message": null,
  "failed_at": null,
  "created_at": "2024-01-01T12:00:00.000Z",
  "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"
  },
  "pipeline": {
    "id": "9d1d1e9c-5e8f-4f9a-9b0c-1a2b3c4d5e6f",
    "slug": "my-pipeline",
    "url": "https://api.buildkite.com/v2/organizations/acme-inc/pipelines/my-pipeline"
  }
}

필요한 범위(scope): read_pipelines

성공 응답: 200 OK

파이프라인 스케줄 생성

새 파이프라인 스케줄을 생성해요.

요청 예시:

curl -H "Authorization: Bearer ***" \
  -X POST "https://api.buildkite.com/v2/organizations/{org.slug}/pipelines/{pipeline.slug}/schedules" \
  -H "Content-Type: application/json" \
  -d '{
    "label": "Nightly build",
    "cronline": "@daily",
    "message": "Nightly scheduled build",
    "commit": "HEAD",
    "branch": "main",
    "env": {
      "DEPLOY_ENV": "staging"
    },
    "enabled": true
  }'

응답 예시:

{
  "id": "b3a1e9f2-7c4d-4f1a-9e6c-2d8a5f7b1c3d",
  "graphql_id": "UGlwZWxpbmVTY2hlZHVsZS0tLWIzYTFlOWYyLTdjNGQtNGYxYS05ZTZjLTJkOGE1ZjdiMWMzZA==",
  "url": "https://api.buildkite.com/v2/organizations/acme-inc/pipelines/my-pipeline/schedules/b3a1e9f2-7c4d-4f1a-9e6c-2d8a5f7b1c3d",
  "label": "Nightly build",
  "cronline": "@daily",
  "message": "Nightly scheduled build",
  "commit": "HEAD",
  "branch": "main",
  "env": {
    "DEPLOY_ENV": "staging"
  },
  "enabled": true,
  "next_build_at": "2024-01-02T00:00:00.000Z",
  "failed_message": null,
  "failed_at": null,
  "created_at": "2024-01-01T12:00:00.000Z",
  "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"
  },
  "pipeline": {
    "id": "9d1d1e9c-5e8f-4f9a-9b0c-1a2b3c4d5e6f",
    "slug": "my-pipeline",
    "url": "https://api.buildkite.com/v2/organizations/acme-inc/pipelines/my-pipeline"
  }
}

필수 요청 본문 속성:

cronline 빌드를 트리거하는 데 사용하는 간격이에요. 미리 정의된 간격 또는 crontab 시간 문법 문자열이에요. 예시: "@daily"

선택 요청 본문 속성:

label 파이프라인 스케줄을 설명하는 라벨이에요. 예시: "Nightly build"
message 파이프라인 스케줄이 만든 빌드에 사용되는 메시지예요. 예시: "Nightly scheduled build"
commit 파이프라인 스케줄이 만든 빌드에 사용되는 커밋이에요. 기본값: "HEAD"
branch 파이프라인 스케줄이 만든 빌드에 사용되는 브랜치예요. 기본값: 파이프라인의 기본 브랜치
env 파이프라인 스케줄이 만든 빌드에 설정할 환경 변수의 JSON 객체예요. 예시: { "DEPLOY_ENV": "staging" }
enabled 파이프라인 스케줄이 활성화되어 있는지 여부예요. 기본값: true

필요한 범위(scope): write_pipelines

성공 응답: 201 Created

오류 응답:

422 Unprocessable Entity { "message": "Validation failed: Reason for failure" }

파이프라인 스케줄 업데이트

파이프라인 스케줄을 업데이트해요.

요청 예시:

curl -H "Authorization: Bearer ***" \
  -X PUT "https://api.buildkite.com/v2/organizations/{org.slug}/pipelines/{pipeline.slug}/schedules/{id}" \
  -H "Content-Type: application/json" \
  -d '{
    "cronline": "@hourly",
    "enabled": false
  }'

응답 예시:

{
  "id": "b3a1e9f2-7c4d-4f1a-9e6c-2d8a5f7b1c3d",
  "graphql_id": "UGlwZWxpbmVTY2hlZHVsZS0tLWIzYTFlOWYyLTdjNGQtNGYxYS05ZTZjLTJkOGE1ZjdiMWMzZA==",
  "url": "https://api.buildkite.com/v2/organizations/acme-inc/pipelines/my-pipeline/schedules/b3a1e9f2-7c4d-4f1a-9e6c-2d8a5f7b1c3d",
  "label": "Nightly build",
  "cronline": "@hourly",
  "message": "Nightly scheduled build",
  "commit": "HEAD",
  "branch": "main",
  "env": {
    "DEPLOY_ENV": "staging"
  },
  "enabled": false,
  "next_build_at": null,
  "failed_message": null,
  "failed_at": null,
  "created_at": "2024-01-01T12:00:00.000Z",
  "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"
  },
  "pipeline": {
    "id": "9d1d1e9c-5e8f-4f9a-9b0c-1a2b3c4d5e6f",
    "slug": "my-pipeline",
    "url": "https://api.buildkite.com/v2/organizations/acme-inc/pipelines/my-pipeline"
  }
}

선택 요청 본문 속성:

label 파이프라인 스케줄을 설명하는 라벨이에요. 예시: "Nightly build"
cronline 빌드를 트리거하는 데 사용하는 간격이에요. 예시: "@hourly"
message 파이프라인 스케줄이 만든 빌드에 사용되는 메시지예요. 예시: "Nightly scheduled build"
commit 파이프라인 스케줄이 만든 빌드에 사용되는 커밋이에요. 예시: "HEAD"
branch 파이프라인 스케줄이 만든 빌드에 사용되는 브랜치예요. 예시: "main"
env 파이프라인 스케줄이 만든 빌드에 설정할 환경 변수의 JSON 객체예요. 예시: { "DEPLOY_ENV": "staging" }
enabled 파이프라인 스케줄이 활성화되어 있는지 여부예요. 이전에 실패했던 스케줄을 다시 활성화하면 그 failed_message와 failed_at 값이 초기화돼요. 예시: true

필요한 범위(scope): write_pipelines

성공 응답: 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}/pipelines/{pipeline.slug}/schedules/{id}"

필요한 범위(scope): write_pipelines

성공 응답: 204 No Content

더 알아보기 (Learn more)

이 문서에서는 파이프라인 스케줄 API를 통해 예약 빌드를 관리하는 방법을 살펴봤어요. 파이프라인 스케줄 모델, 목록 조회, 조회, 생성, 업데이트, 삭제 방법까지 익혔으니 이제 실제 빌드 파이프라인에 예약 빌드를 손쉽게 적용할 수 있을 거예요.