빌드 생성
빌드 생성 (Build Create)
지정한 브랜치의 최신 커밋으로 빌드를 생성하는 Drone REST API 엔드포인트예요. 결과로 만들어지는 빌드의 이벤트 유형은 custom이 된다는 점에 유의하세요.
출처: Drone CI Docs
본문
기본 브랜치의 최신 커밋으로 빌드를 생성합니다:
POST /api/repos/{namespace}/{name}/builds
지정한 브랜치의 최신 커밋으로 빌드를 생성합니다:
POST /api/repos/{namespace}/{name}/builds?branch={branch}
지정한 브랜치와 커밋 sha로 빌드를 생성합니다:
POST /api/repos/{namespace}/{name}/builds?branch={branch}&commit={commit}
사용자 정의 파라미터로 빌드를 생성할 수도 있어요. 이 파라미터들은 파이프라인 스텝에서 환경 변수로 사용할 수 있습니다.
POST /api/repos/{namespace}/{name}/builds?branch={branch}&{key=value}
응답 바디 예시:
{
"id": 100207,
"repo_id": 296163,
"number": 42,
"status": "pending",
"event": "custom",
"action": "sync",
"link": "https://github.com/octoat/hello-world/compare/e3320539a4c0...9fc1ad6ebf12",
"message": "updated README",
"before": "e3320539a4c03ccfda992641646deb67d8bf98f3",
"after": "9fc1ad6ebf12462f3f9773003e26b4c6f54a772e",
"ref": "refs/heads/master",
"source_repo": "spaceghost/hello-world",
"source": "develop",
"target": "master",
"author_login": "octocat",
"author_name": "The Octocat",
"author_email": "octocat@github.com",
"author_avatar": "http://www.gravatar.com/avatar/7194e8d48fa1d2b689f99443b767316c",
"sender": "bradrydzewski",
"started": 0,
"finished": 0,
"created": 1564085874,
"updated": 1564085874,
"version": 1,
"stages": [
{
"id": 199937,
"repo_id": 296163,
"build_id": 100207,
"number": 1,
"name": "default",
"kind": "pipeline",
"type": "docker",
"status": "pending",
"errignore": false,
"exit_code": 0,
"machine": "15e89c0f84f1",
"os": "linux",
"arch": "amd64",
"started": 0,
"stopped": 0,
"created": 1564085874,
"updated": 1564086343,
"version": 1,
"on_success": true,
"on_failure": false
}
]
}
파이프라인 설정 (Pipeline Configuration)
API로 빌드를 트리거하면 결과 빌드의 이벤트 유형은 custom으로 만들어져요. 이벤트 유형 기반으로 조건부 파이프라인이나 조건부 스텝을 정의했다면 그에 맞게 갱신이 필요할 수 있습니다.
custom 이벤트 유형을 포함하는 파이프라인 조건 예시:
trigger:
event:
- push
- pull_request
- custom
더 알아보기 (Learn more)
- 빌드 시작 (Build Start) — 특정 커밋으로 빌드 재시작하기
- 트리거(Triggers) 문서 — 이벤트 기반 파이프라인 조건