Classic/VPC 환경에서 이용 가능합니다.
배포 시나리오를 생성합니다.
요청
요청 형식을 설명합니다. 요청 형식은 다음과 같습니다.
메서드 | URI |
---|---|
POST | /api/v1/project/{projectId}/stage/{stageId}/scenario |
요청 헤더
SourceDeploy API에서 공통으로 사용하는 헤더에 대한 정보는 SourceDeploy 요청 헤더를 참조해 주십시오.
요청 경로 파라미터
요청 경로 파라미터에 대한 설명은 다음과 같습니다.
필드 | 타입 | 필수 여부 | 설명 |
---|---|---|---|
projectId |
String | Required | 프로젝트 아이디
|
stageId |
String | Required | 배포 스테이지 아이디
|
요청 바디
요청 바디에 대한 설명은 다음과 같습니다.
필드 | 타입 | 필수 여부 | 설명 |
---|---|---|---|
name |
String | Required | 배포 시나리오 이름
|
description |
String | Optional | 배포 시나리오 설명 |
config |
Object | Required | 배포 타깃 설정
|
TScenarioServer
TScenarioServer
에 대한 설명은 다음과 같습니다.
필드 | 타입 | 필수 여부 | 설명 |
---|---|---|---|
strategy |
String | Required | 배포 전략
|
sequence |
Boolean | Optional | 순차 배포 여부
|
file |
Object | Required | 배포 파일 정보 |
file.type |
String | Required | 배포 파일 위치
|
file.ObjectStorage |
Object | Conditional | Object Storage 정보
|
file.ObjectStorage.bucket |
String | Conditional | 버킷 이름 |
file.ObjectStorage.object |
String | Conditional | 파일 이름 |
file.SourceBuild |
Object | Conditional | SourceBuild 정보
|
file.SourceBuild.id |
Number | Conditional | 빌드 프로젝트 아이디 |
rollback |
Boolean | Required | 배포 실패 시 롤백 사용 여부
|
cmd.pre |
Array | Optional | 배포 전 실행 명령어 목록 |
cmd.deploy |
Array | Optional | 파일 배포 경로 목록 |
cmd.post |
Array | Optional | 배포 후 실행 명령어 목록 |
pre
pre
에 대한 설명은 다음과 같습니다.
필드 | 타입 | 필수 여부 | 설명 |
---|---|---|---|
user |
String | Optional | 실행 계정 |
cmd |
String | Optional | 실행 명령 |
deploy
deploy
에 대한 설명은 다음과 같습니다.
필드 | 타입 | 필수 여부 | 설명 |
---|---|---|---|
sourcePath |
String | Optional | 소스 파일 경로 |
deployPath |
String | Optional | 배포 경로 |
post
post
에 대한 설명은 다음과 같습니다.
필드 | 타입 | 필수 여부 | 설명 |
---|---|---|---|
user |
String | Optional | 실행 계정 |
cmd |
String | Optional | 실행 명령 |
TScenarioAutoScalingGroup
TScenarioAutoScalingGroup
에 대한 설명은 다음과 같습니다.
필드 | 타입 | 필수 여부 | 설명 |
---|---|---|---|
strategy |
String | Required | 배포 전략
|
sequence |
Boolean | Optional | 순차 배포 여부
|
file |
Object | Required | 배포 파일 정보 |
file.type |
String | Required | 배포 파일 위치
|
file.ObjectStorage |
Object | Conditional | Object Storage 정보
|
file.ObjectStorage.bucket |
String | Conditional | 버킷 이름 |
file.ObjectStorage.object |
String | Conditional | 파일 이름 |
file.SourceBuild |
Object | Conditional | SourceBuild 정보
|
file.SourceBuild.id |
Number | Conditional | 빌드 프로젝트 아이디 |
rollback |
Boolean | Required | 배포 실패 시 롤백 사용 여부
|
cmd.pre |
Array | Optional | 배포 전 실행 명령어 목록 |
cmd.deploy |
Array | Optional | 파일 배포 경로 목록 |
cmd.post |
Array | Optional | 배포 후 실행 명령어 목록 |
loadBalancer |
Object | Conditional | 로드 밸런서 정보
|
loadBalancer.loadBalancerTargetGroupNo |
Number | Conditional | 로드 밸런서 Target Group 아이디 |
loadBalancer.deleteAsg |
Boolean | Conditional | 기존 Auto Scaling 그룹 삭제 여부
|
loadBalancer.deleteServer |
Boolean | Conditional | 기존 Auto Scaling 그룹 내 서버 반납 여부
|
pre
pre
에 대한 설명은 다음과 같습니다.
필드 | 타입 | 필수 여부 | 설명 |
---|---|---|---|
user |
String | Optional | 실행 계정 |
cmd |
String | Optional | 실행 명령 |
deploy
deploy
에 대한 설명은 다음과 같습니다.
필드 | 타입 | 필수 여부 | 설명 |
---|---|---|---|
sourcePath |
String | Optional | 소스 파일 경로 |
deployPath |
String | Optional | 배포 경로 |
post
post
에 대한 설명은 다음과 같습니다.
필드 | 타입 | 필수 여부 | 설명 |
---|---|---|---|
user |
String | Optional | 실행 계정 |
cmd |
String | Optional | 실행 명령 |
TScenarioKubernetesService
TScenarioKubernetesService
에 대한 설명은 다음과 같습니다.
필드 | 타입 | 필수 여부 | 설명 |
---|---|---|---|
strategy |
String | Required | 배포 전략
|
manifest |
Object | Required | 매니페스트 정보 |
manifest.type |
String | Required | 매니페스트 파일 저장소
|
manifest.repository |
String | Required | 리포지토리 이름 |
manifest.branch |
String | Required | 브랜치 이름 |
manifest.path |
Array | Required | 파일 위치 목록 |
canaryConfig |
Object | Conditional | Canary 분석 설정
|
canaryConfig.analysisType |
String | Conditional | Canary 분석 방법
|
canaryConfig.canaryCount |
Number | Conditional | Baseline, Canary Pod 수
|
canaryConfig.timeout |
Number | Conditional | 타임아웃(분)
|
canaryConfig.prometheus |
String | Conditional | Prometheus Url
|
canaryConfig.env |
Object | Conditional | 분석 환경 변수
|
canaryConfig.env.baseline |
String | Conditional | 분석 환경 변수: Baseline 이름
|
canaryConfig.env.canary |
String | Conditional | 분석 환경 변수: Canary 이름
|
canaryConfig.metrics |
Array | Conditional | Metric 설정 목록
|
canaryConfig.analysisConfig |
Object | Conditional | 분석 설정
|
canaryConfig.analysisConfig.duration |
Number | Conditional | 분석 시간(분)
|
canaryConfig.analysisConfig.delay |
Number | Conditional | 분석 지연 시간(분)
|
canaryConfig.analysisConfig.interval |
Number | Conditional | 분석 주기(분)
|
canaryConfig.analysisConfig.step |
Number | Conditional | Metric 수집 주기(초)
|
canaryConfig.passScore |
Number | Conditional | 분석 성공 점수
|
metrics
metrics
에 대한 설명은 다음과 같습니다.
필드 | 타입 | 필수 여부 | 설명 |
---|---|---|---|
name |
String | Conditional | Metric 이름
|
successCriteria |
String | Conditional | 성공 기준
|
queryType |
String | Conditional | 쿼리 타입
|
weight |
Number | Conditional | Metric 가중치
|
metric |
String | Conditional | Metric 값
|
filter |
String | Conditional | Filter 값
|
query |
String | Conditional | 쿼리
|
TScenarioObjectStorage
TScenarioObjectStorage
에 대한 설명은 다음과 같습니다.
필드 | 타입 | 필수 여부 | 설명 |
---|---|---|---|
file |
Object | Required | 배포 파일 정보 |
file.type |
String | Required | 배포 파일 위치
|
file.ObjectStorage |
Object | Conditional | Object Storage 정보
|
file.ObjectStorage.bucket |
String | Conditional | 버킷 이름 |
file.ObjectStorage.object |
String | Conditional | 파일 이름
|
file.SourceBuild |
Object | Conditional | SourceBuild 정보
|
file.SourceBuild.id |
Number | Conditional | 빌드 프로젝트 아이디 |
path |
Array | Optional | 파일 배포 경로 목록 |
path
path
에 대한 설명은 다음과 같습니다.
필드 | 타입 | 필수 여부 | 설명 |
---|---|---|---|
sourcePath |
String | Optional | 소스 파일 경로 |
deployPath |
String | Optional | 배포 경로 |
요청 예시
요청 예시는 다음과 같습니다.
curl --location --request POST 'https://vpcsourcedeploy.apigw.gov-ntruss.com/api/v1/project/2***/stage/3***/scenario' \
--header 'x-ncp-apigw-timestamp: {Timestamp}' \
--header 'x-ncp-iam-access-key: {Access Key}' \
--header 'x-ncp-apigw-signature-v2: {API Gateway Signature}' \
--header 'Content-Type: application/json' \
--data '{
"name": "testScenario2",
"description": "test Scenario 2",
"config": {
"strategy": "normal",
"sequence": true,
"file": {
"type": "ObjectStorage",
"ObjectStorage": {
"bucket": "devtool",
"object": "/result/build-sample.zip"
}
},
"rollback": true,
"cmd": {
"pre": [
{
"user": "root",
"cmd": "mv logs/app.log logs/app_$(date +%s).log"
}
],
"deploy": [
{
"sourcePath": "/main.py",
"deployPath": "/home/root/"
}
],
"post": [
{
"user": "root",
"cmd": "nohup python3 main.py > logs/app.log 2>&1 &"
}
]
}
}
}'
응답
응답 형식을 설명합니다.
응답 바디
응답 바디에 대한 설명은 다음과 같습니다.
필드 | 타입 | 필수 여부 | 설명 |
---|---|---|---|
result |
Object | - | 응답 결과 |
result.id |
Number | - | 배포 시나리오 아이디 |
result.name |
String | - | 배포 시나리오 이름 |
응답 상태 코드
SourceDeploy API에서 공통으로 사용하는 응답 상태 코드에 대한 정보는 SourceDeploy 응답 상태 코드를 참조해 주십시오.
응답 예시
응답 예시는 다음과 같습니다.
{
"result": {
"id": 2***,
"name": "testScenario2"
}
}