Build
# Create Build from Template
Request
POST /openapi/build?source=template
1
Body Parameter Description
| Parameter Name | Description | Type | Required |
|---|---|---|---|
name | Build name | string | Yes |
project_key | Project key | string | Yes |
template_name | Build template name | string | Yes |
target_services | Service configuration | []TargetService | Yes |
TargetService Parameter Description
| Parameter Name | Description | Type | Required |
|---|---|---|---|
service_module | Service module name | string | Yes |
service_name | Service name | string | Yes |
repo_info | Repository info | []RepoInfo | Yes |
inputs | Variable info | []Input | Yes |
RepoInfo Parameter Description
| Parameter Name | Description | Type | Required |
|---|---|---|---|
codehost_name | Code source identifier | string | Yes |
repo_namespace | Repository namespace (organization/user) | string | Yes |
repo_name | Repository name | string | Yes |
branch | Branch info | string | Yes |
Input Parameter Description
| Parameter Name | Description | Type | Required |
|---|---|---|---|
key | Variable key | string | Yes |
value | Variable value | string | Yes |
Body Parameter Example
{
"name": "demo-build",
"project_key": "demo",
"template_name": "demo-template",
"target_services": [
{
"service_module": "aslan",
"service_name": "zadigx",
"repo_info": [
{
"codehost_name": "github-demo",
"repo_namespace": "kr-test-org",
"repo_name": "zadig",
"branch": "main"
}
],
"inputs": [
{
"key": "name",
"value": "admin"
},
{
"key": "password",
"value": "zadigx"
}
]
}
]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Return
{
"message": "success"
}
1
2
3
2
3
# Query Build List
Request
GET /openapi/build?projectKey=<project identifier>&pageNum=<current page number>&pageSize=<current page display count>
1
Query Parameter Description
| Parameter Name | Type | Description | Required | Default Value |
|---|---|---|---|---|
projectKey | string | Project identifier | Yes | None |
pageNum | int | Page parameter-current page number | No | 1 |
pageSize | int | Page parameter-current page display count | No | 20 |
Return Description
| Parameter Name | Type | Description |
|---|---|---|
total | int | Build module total number |
builds | []Build | Build module list |
Build Parameter Description
| Parameter Name | Type | Description |
|---|---|---|
name | string | Build name |
project_key | string | Project identifier |
source | string | Build method, there are two: zadig, jenkins |
update_by | string | Updater |
update_time | int | Update time |
target_services | []TargetService | Service component list |
TargetService Parameter Description
| Parameter Name | Type | Description |
|---|---|---|
service_name | string | Service name |
service_module | string | Service component name |
Normal Return
Details
{
"total": 2,
"builds": [
{
"name": "s-build",
"project_key": "lilian-test",
"source": "zadig",
"update_by": "admin",
"update_time": 1686192895,
"target_services": [
{
"service_name": "service1",
"service_module": "service1"
},
{
"service_name": "service2",
"service_module": "service2"
}
]
},
{
"name": "openapi-build",
"project_key": "lilian-test",
"source": "zadig",
"update_by": "admin",
"update_time": 1688040721,
"target_services": [
{
"service_name": "service1",
"service_module": "service1"
}
]
}
]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Get Build Details
Request
GET /openapi/build/:buildName/detail?projectKey=<project identifier>
1
Query Parameter Description
| Parameter Name | Type | Description | Required | Default Value |
|---|---|---|---|---|
projectKey | string | Project identifier | Yes | None |
serviceName | string | Service name | Yes | None |
serviceModule | string | Service component name | Yes | None |
Path Parameter Description
| Parameter Name | Type | Description | Required | Default Value |
|---|---|---|---|---|
buildName | string | Build name | Yes | None |
Return Description
Details
{
"project_key": "lilian-test", // Project identifier
"name": "openapi-build", // Build name
"source": "", // Build method, there are two: zadig,jenkins
"target_services": [ // Service list
{
"service_name": "service1", // Service name
"service_module": "service1" // Service component name
}
],
"template_name": "test", // Template name
"update_by": "admin", // Updater name
"update_time": 1690215924, // Update time, second level timestamp
"repos": [ // Repository information
{
"source": "gitee", // There are several types: github, gitlab, gerrit, codehub, gitee, gitee-enterprise, other
"repo_owner": "liyue326", // Organization name/user name
"repo_name": "hello", // Repository name
"remote_name": "origin", // Remote name
"branch": "master", // Branch name
"address":"https://gitlab.com", // Repository source
"checkout_path":"", // Clone directory name
"submodules":false, // Submodule
},
],
"build_env": { // Build environment
"basic_image_id": "63047770931401b9baa6e396", // Operating system image ID
"basic_image_label": "ubuntu 20.04", // Operating system image name
"installs": [ // Build dependent software package list
{
"name": "go",
"version": "1.13"
}
]
},
"advanced_settings": { // Advanced configuration
"cluster_name": "local-20220823144517", // Cluster name
"timeout": 60, // Build timeout time
"resource_spec": { // Cluster configuration item list
"cpu_limit": 1000,
"memory_limit": 512,
"gpu_limit": ""
},
"use_host_docker_daemon": false, // Whether to use host docker daemon
"cache_setting": { // Cache configuration
"enabled": false, // Whether to use custom workspace
"cache_dir": "" // Cache path under custom workspace
}
},
"build_script": "#!/bin/bash\nset -e", // Build script
"parameters": [ // Custom variable list
{
"key": "a",
"value": "1",
"type": "string",
"is_credential": false
}
]
"outputs": [ // Output variable list
{
"name": "IMAGE",
"description": ""
},
{
"name": "PKG_FILE",
"description": ""
},
{
"name": "xx",
"description": ""
}
],
"post_build": { // Add step
"docker_build": { // Image build configuration
"work_dir": "temp", // Build context directory
"docker_file": "temp", // Absolute path of Dockerfile
"build_args": "", // Build parameter
"source": "local", // Dockerfile source
"template_name": "" // template name (if dockerfile source is template)
},
"object_storage_upload": { // File storage
"enabled": true, // Whether to use workspace cache
"object_storage_id": "63422e0690069fe35f4e62bb", // sidebarMenu.objectStorage
"upload_detail": [ // Upload file configuration
{
"file_path": "test",
"abs_file_path": "",
"dest_path": "temp"
}
]
},
"file_archive": { // Binary package storage
"file_location": "temp" // Binary package storage path
},
"scripts": "#!/bin/bash\nset -e" // Shell script
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Delete Build
Request
DELETE /openapi/build?name=<build name>&projectKey=<project identifier>
1
Query Parameter Description
| Parameter Name | Description | Type | Required |
|---|---|---|---|
name | Build name | string | Yes |
projectKey | Project identifier | string | Yes |
Return Description
{
"message": "success"
}
1
2
3
2
3


