Create Project
- Print
- PDF
Create Project
- Print
- PDF
Article summary
Did you find this summary helpful?
Thank you for your feedback
Summary
Create a SourceBuild project.
Request
API URL
POST {SOURCEBUILD_API_URL}/project
Request parameter
None
Request query
None
Request body
{
"name": "string",
"description": "string",
"source": {
"type": "string",
"config": {
"repository": "string",
"branch": "string"
}
},
"env": {
"compute": { "id": "number" },
"platform": {
"type": "string",
"config": "TEnvSourceBuild" | "TEnvContainerRegistry" | "TEnvPublicRegistry"
},
"docker": {
"use": "boolean",
"id": "number"
},
"timeout": "number",
"envVars": {
"key": "string",
"value": "string"
}
},
"cmd": {
"pre": ["string"],
"build": ["string"],
"post": ["string"],
"dockerbuild": {
"use": "boolean",
"dockerfile": "string",
"registry": "string",
"image": "string",
"tag": "string",
"latest": "boolean"
}
},
"artifact": {
"use": "boolean",
"path": ["string"],
"storage": {
"bucket": "string",
"path": "string",
"filename": "string"
},
"backup": "boolean",
},
"cache": {
"use": "boolean",
"registry": "string",
"image": "string",
"tag": "string",
"latest": "boolean"
},
"linked": {
"CloudLogAnalytics": "boolean",
"FileSafer": "boolean",
}
}
Item | Type | Type | Default | Description | Remarks |
---|---|---|---|---|---|
name | Y | string | Project name | ||
description | N | string | "" | Project description | |
source.type | Y | string | Source storage type | Only "SourceCommit" | |
source.config.repository | Y | string | Source storage repository name | Search with sourceCommitRepoisotryList API | |
source.config.branch | Y | string | Source storage repository branch name | Search with sourceCommitBranchList API | |
env.compute.id | Y | number | Computing type ID of the build environment | Search with buildEnvComputeList API | |
env.platform.type | Y | string | Image storage type in the build environment | "SourceBuild": Image managed in SourceBuild "ContainerRegistry": Image in Container Registry "PublicRegistry": Image in public registry | |
env.platform.config | Y | TEnvSourceBuild | TEnvContainerRegistry | TEnvPublicRegistry | Build preferences | If env.platform.type="SourceBuild", TEnvSourceBuild If env.platform.type="ContainerRegistry", TEnvContainerRegistry If env.platform.type="PublicRegistry", TEnvPublicRegistry Refer to TEnvPlatformConfig below | |
env.docker.use | Y | boolean | false | Inclusion (use) status of Docker engine in the build environment for Docker | |
env.docker.id | N (required if env.docker.use=true) | number | Docker engine version ID | Search with buildEnvDockerList API | |
env.timeout | N | number | 5 | Build run timeout | |
env.envVars | N | {"key": string, "value": string}[] | [] | Build environment variable | |
cmd.pre | N | string[] | [] | Command before build | |
cmd.build | N | string[] | [] | Command during build | |
cmd.post | N | string[] | [] | Command after build | |
cmd.dockerbuild.use | N | boolean | false | Use status of Docker image build settings | |
cmd.dockerbuild.dockerfile | N (required if cmd.dockerbuild.use=true) | string | Path including the dockerfile file name | Include dockerfile in the source storage assigned to source.config.repository, and enter the path from the top level of the source storage. | |
cmd.dockerbuild.registry | N (required if cmd.dockerbuild.use=true) | string | The registry name of Container Registry to store the image | ||
cmd.dockerbuild.image | N (required if cmd.dockerbuild.use=true) | string | Image name | ||
cmd.dockerbuild.tag | N (required if cmd.dockerbuild.use=true) | string | Tag name | ||
cmd.dockerbuild.latest | N | boolean | false | Save status of the latest tag | |
artifact.use | N | boolean | false | Save status of the build results | |
artifact.path | N (required if artifact.use=true) | string[] | Location of the build results | Enter the path from the top level of the source storage assigned to source.config.repository. Both file and directory paths can be used. | |
artifact.storage.bucket | N (required if artifact.use=true) | string | Bucket name of Object Storage to save the results | ||
artifact.storage.path | N (required if artifact.use=true) | string | The path within the Object Storage bucket to save the results | ||
artifact.storage.filename | N (required if artifact.use=true) | File name to save the results | The results are compressed and saved in ZIP format. If the extension is not .zip, .zip will be automatically included in the file name. | ||
artifact.backup | N | boolean | false | Backup status of the results | |
cache.use | N | boolean | false | Save status of the build environment after completing your build | Save the build environment into an image after completing the build This can be set as the image of your build environment for xxx build |
cache.registry | N (required if cache.use=true) | string | The registry name of Container Registry to store the image of the build environment after completing the build | ||
cache.image | N (required if cache.use=true) | string | Image name | ||
cache.tag | N (required if cache.use=true) | string | Tag name | ||
cache.latest | N | boolean | false | Save status of the latest tag | |
linked.CloudLogAnalytics | N | boolean | false | Save status of the build log in Cloud Log Analytics | |
linked.FileSafer | N | boolean | false | Test status of the build results with File Safer (file filter) |
TEnvPlatformConfig
TEnvSourceBuild
{
"os": {
"id": "number"
},
"runtime": {
"id": "number",
"version": {
"id": "number"
}
}
}
Item | Requirement status | Type | Description | Remarks |
---|---|---|---|---|
os.id | Y | number | Operating system ID | Search with buildEnvOSListAPI |
runtime.id | Y | number | Runtime ID | Search with buildEnvRunTimeList API |
runtime.version.id | Y | number | Runtime version ID | Search with buildEnvRunTimeVersionList API |
TEnvContainerRegistry
{
"registry": "string",
"image": "string",
"tag": "string"
}
Item | Requirement status | Type | Description | Remarks |
---|---|---|---|---|
registry | Y | string | Registry name | |
image | Y | string | Image name | |
tag | Y | string | Tag name |
TEnvPublicRegistry
{
"image": "string",
"tag": "string"
}
Item | Requirement status | Type | Description | Remarks |
---|---|---|---|---|
image | Y | string | Image name | |
tag | Y | string | Tag name |
Response
Response body
{
"id": "number",
"name": "string"
}
Item | Type | Description | Remarks |
---|---|---|---|
id | number | Project ID | |
name | string | Project name |
Was this article helpful?