Create scenario
- Print
- PDF
Create scenario
- Print
- PDF
Article summary
Did you find this summary helpful?
Thank you for your feedback
Overview
Create a scenario of the SourceDeploy project.
Requests
API URL
POST {SOURCEDEPLOY_API_URL}/project/{projectId}/stage/{stageId}/scenario
Request parameters
Item | Type | Description | Note |
---|---|---|---|
projectId | string | Project ID | View projectList |
stageId | string | stage ID | View stageList |
Request queries
None
Request bodies
{
"name": "string",
"description": "string",
"config": "TScenarioServer" | "TScenarioAutoScalingGroup" | "TSecnarioKubernetesService" | "TSecnarioObjectStorage"
}
Item | Type | Required | Description | Note |
---|---|---|---|---|
name | string | Y | Scenario name | |
description | string | N | Scenario description | |
Config | TScenarioServer | TScenarioAutoScalingGroup| TSecnarioKubernetesService|TSecnarioObjectStorage | Y | Scenario settings | View stage type with stageDetail API When stage type="Server," TScenarioServer When stage type="AutoScalingGroup," TScenarioAutoScalingGroup When stage type="KubernetesService," TScenarioKubernetesService When stage type="ObjectStorage," TScenarioObjectStorage |
TScenarioServer
{
"strategy": "string",
"sequence": "boolean",
"file": {
"type": "string",
"ObjectStorage": {
"bucket": "string",
"object": "string"
},
"SourceBuild": {
"id": "number"
}
},
"rollback": "boolean",
"cmd": {
"pre": [
{
"user": "string",
"cmd": "string"
}
],
"deploy": [
{
"sourcePath": "string",
"deployPath": "string"
}
],
"post": [
{
"user": "string",
"cmd": "string"
}
]
},
}
Item | Type | Required | Default | Description | Note |
---|---|---|---|---|---|
strategy | string | Y | Deployment strategy | "normal" | |
sequence | boolean | N | true | Consecutive deployment status | When false is entered, deployed simultaneously |
file.type | string | Y | Deployment file type | "ObjectStorage" | "SourceBuild" | "later" | |
file.ObjectStorage.bucket | string | N (When file.type=ObjectStorage, required) | ObjectStorage bucket name | View with objectStorageBucketList API | |
file.ObjectStorage.object | string | N (When file.type=ObjectStorage, required) | ObjectStorage object location | View with objectstorageobjectlist API | |
file.SourceBuild.id | number | N (When file.type=SourceBuild, required) | SourceBuild id | View with sourceBuildList API | |
rollback | boolean | Y | Roll back if deployment fails | ||
cmd.pre.user | string | N | Run before deployment>Account | ||
cmd.pre.cmd | string | N | Run before deployment>Command | ||
cmd.deploy.sourcePath | string | N | File deployment>Source file path | ||
cmd.deploy.deployPath | string | N | File deployment>Deployment path | ||
cmd.post.user | string | N | Run after deployment>Account | ||
cmd.post.cmd | string | N | Run after deployment>Command |
TScenarioAutoScalingGroup
{
"strategy": "string",
"sequence": "boolean",
"file": {
"type": "string",
"ObjectStorage": {
"bucket": "string",
"object": "string"
},
"SourceBuild": {
"id": "number"
}
},
"rollback": "boolean",
"cmd": {
"pre": [
{
"user": "string",
"cmd": "string"
}
],
"deploy": [
{
"sourcePath": "string",
"deployPath": "string"
}
],
"post": [
{
"user": "string",
"cmd": "string"
}
]
},
"loadBalancer": {
"loadBalancerTargetGroupNo": "number",
"deleteAsg": "boolean",
"deleteServer": "boolean"
}
}
Item | Type | Required | Default | Description | Note |
---|---|---|---|---|---|
strategy | string | Y | Deployment strategy | "normal" | "blueGreen" | |
sequence | boolean | N | true | Consecutive deployment status | When false is entered, deployed simultaneously |
file.type | string | Y | Deployment file type | "ObjectStorage" | "SourceBuild" | "later" | |
file.ObjectStorage.bucket | string | N (When file.type=ObjectStorage, required) | ObjectStorage bucket name | View with objectStorageBucketList API | |
file.ObjectStorage.object | string | N (When file.type=ObjectStorage, required) | ObjectStorage object location | View with objectstorageobjectlist API | |
file.SourceBuild.id | number | N (When file.type=SourceBuild, required) | SourceBuild id | View with sourceBuildList API | |
rollback | boolean | Y | Roll back if deployment fails | ||
cmd.pre.user | string | N | Run before deployment>Account | ||
cmd.pre.cmd | string | N | Run before deployment>Command | ||
cmd.deploy.sourcePath | string | N | File deployment>Source file path | ||
cmd.deploy.deployPath | string | N | File deployment>Deployment path | ||
cmd.post.user | string | N | Run after deployment>Account | ||
cmd.post.cmd | string | N | Run after deployment>Command | ||
loadBalancer.loadBalancerTargetGroupNo | number | N (When strategy=blueGreen, required) | Load Balancer target group number | View with targetGroupList API | |
loadBalancer.deleteAsg | boolean | N (When strategy=blueGreen, optional) | false | Existing Auto Scaling Group deletion status | |
loadBalancer.deleteServer | boolean | N (When strategy=blueGreen, required) | Deletion status of server in the existing Auto Scaling Group | When loadBalancer.deleteAsg value is true, only true can be entered |
TSecnarioKubernetesService
{
{
"manifest": {
"type": "string",
"repository": "string",
"branch": "string",
"path": ["string"]
},
"strategy": "string",
"canaryConfig": {
"canaryCount": "number",
"analysisType": "string",
"timeout": "number",
"prometheus": "string",
"env": {
"baseline": "string",
"canary": "string"
},
"metrics": [
{
"name": "string",
"successCriteria": "string",
"queryType": "string",
"weight": "number",
"metric": "string",
"filter": "string",
"query": "string"
}
],
"analysisConfig": {
"duration": "number",
"delay": "number",
"interval": "number",
"step": "number"
},
"passScore": "number"
}
}
Item | Type | Required | Description | Note |
---|---|---|---|---|
strategy | string | Y | Deployment strategy | "rolling" | "blueGreen" | "canary" |
manifest.type | string | Y | Manifest file repository | "SourceCommit" |
manifest.repository | string | Y | Repository | View with sourceCommitRepositoryList API |
manifest.branch | string | Y | Repository branch | View with sourceCommitBranchList API |
manifest.path | string[] | Y | File location | |
canaryConfig.analysisType | string | N (When strategy=canary, required) | Canary analysis method | "manual" | "auto" |
canaryConfig.timeout | number | N (strategy=canary & When canaryConfig.analysisType=manual, required) | Maximum time of deployment/cancellation | |
canaryConfig.canaryCount | number | N (When canaryConfig.analysisType=auto, required) | Number of baselines and canary pods | |
canaryConfig.prometheus | string | N (When strategy=canary & canaryConfig.analysisType=auto, required) | Prometheus Url | |
canaryConfig.env.baseline | string | N (When strategy=canary & canaryConfig.analysisType=auto, required) | Analysis environment variable > baseline | |
canaryConfig.env.canary | string | N (When strategy=canary & canaryConfig.analysisType=auto, required) | Analysis environment variable > canary | |
canaryConfig.metrics.name | string | N (When strategy=canary & canaryConfig.analysisType=auto, required) | Metric name | |
canaryConfig.metrics.successCriteria | string | N (When strategy=canary & canaryConfig.analysisType=auto, required) | Succeeded criteria | "base" | "canary" |
canaryConfig.metrics.queryType | string | N (When strategy=canary & canaryConfig.analysisType=auto, required) | Query type | "default" | "promQL" |
canaryConfig.metrics.weight | number | N (When strategy=canary & canaryConfig.analysisType=auto, required) | Weight | |
canaryConfig.metrics.metric | string | N (When strategy=canary & canaryConfig.analysisType=auto & canaryConfig.metrics.queryType="default," required) | Metric | |
canaryConfig.metrics.filter | string | N (When strategy=canary & canaryConfig.analysisType=auto & canaryConfig.metrics.queryType="default," required) | Filter | |
canaryConfig.metrics.query | string | N (When strategy=canary & canaryConfig.analysisType=auto & canaryConfig.metrics.queryType="promQL," required) | Query | |
canaryConfig.analysisConfig.duration | number | N (When strategy=canary & canaryConfig.analysisType=auto, required) | Analysis time | |
canaryConfig.analysisConfig.delay | number | N (When strategy=canary & canaryConfig.analysisType=auto, required) | Analysis delay time | |
canaryConfig.analysisConfig.interval | number | N (When strategy=canary & canaryConfig.analysisType=auto, required) | Analysis cycle | |
canaryConfig.analysisConfig.step | number | N (When strategy=canary & canaryConfig.analysisType=auto, required) | Metric collection cycle | |
canaryConfig.passScore | number | N (When strategy=canary & canaryConfig.analysisType=auto, required) | Analysis success score |
TSecnarioObjectStorage
{
"file": {
"type": "string",
"ObjectStorage": {
"bucket": "string",
"object": "string"
},
"SourceBuild": {
"id": "number"
}
},
"path": [
{
"sourcePath": "string",
"deployPath": "string"
}
]
}
Item | Type | Required | Description | Note |
---|---|---|---|---|
file.type | string | Y | Deployment file type | "ObjectStorage" | "SourceBuild" | "later" |
file.ObjectStorage.bucket | string | N (When file.type=ObjectStorage, required) | ObjectStorage bucket name | View with objectStorageBucketList API |
file.ObjectStorage.object | string | N (When file.type=ObjectStorage, required) | ObjectStorage object location | View with objectstorageobjectlist API |
file.SourceBuild.id | number | N (When file.type=SourceBuild, required) | SourceBuild id | View with sourceBuildList API |
path.sourcePath | string | N | Source file path | |
path.deployPath | string | N | Deployment path |
Responses
Response bodies
{
"id": "number",
"name": "string"
}
Item | Type | Description | Note |
---|---|---|---|
id | number | Scenario ID | |
name | string | Scenario name |
Was this article helpful?