Workflow
This article mainly introduces how to use OpenAPI to operate Zadig's workflow.
# Workflow
# Get a Workflow List
Request
GET /openapi/workflows?projectKey=<project identifier>&viewName=<view name>
Query
| Parameter Name | Required | Description | Is it Required | Default Value |
|---|---|---|---|---|
projectKey | string | Project identifier | Yes | None |
viewName | string | Workflow view name | No | None |
Return Description
| Parameter Name | Required | Description |
|---|---|---|
workflows | []workflow | Workflow list |
workflow
| Parameter Name | Required | Description |
|---|---|---|
workflow_key | string | Workflow Identifier |
workflow_name | string | Workflow Name |
update_by | string | Updater |
update_time | int | Update Time |
type | string | custom |
Return successfully
Details
{
"workflows": [
{
"workflow_key": "just-deploy",
"workflow_name": "just-deploy",
"update_by": "admin",
"update_time": 1686217885,
"type": "custom"
},
{
"workflow_key": "xiaxianfuwu",
"workflow_name": "offline service",
"update_by": "admin",
"update_time": 1686193453,
"type": "custom"
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Get Workflow Details
Request
GET /openapi/workflows/custom/:workflowKey/detail?projectKey=<project identifier>
Query
| Parameter Name | Required | Description | Is it Required | Default Value |
|---|---|---|---|---|
projectKey | string | Project identifier | Yes | None |
Path parameter description
| Parameter Name | Required | Description | Is it Required | Default Value |
|---|---|---|---|---|
workflowKey | string | Workflow Identifier | Yes | None |
Return successfully
Details
{
"workflow_key": "build-deploy", // workflow identifier
"workflow_name": "build-deploy", // workflow name
"project_key": "lilian-test", // project identifier
"description": "", // workflow description
"created_by": "admin", // creator
"create_time": 1686192946, // creation time
"updated_by": "", // updater
"update_time": 1690180684, // update time
"params": [ // workflow parameter list
{
"name": "code",
"description": "",
"type": "repo",
"value": "",
"repo": {
"source": "gitee",
"repo_owner": "liyue326",
"repo_namespace": "liyue326",
"repo_name": "picture",
"remote_name": "origin",
"branch": "master",
"hidden": false,
"is_primary": false,
"codehost_id": 4,
"oauth_token": "",
"address": "",
"source_from": "",
"param_name": "",
"job_name": "",
"service_name": "",
"service_module": "",
"repo_index": 0,
"submission_id": ""
},
"default": "",
"is_credential": false
},
{
"name": "name",
"description": "",
"type": "string",
"value": "build",
"repo": null,
"default": "",
"is_credential": false
}
],
"stages": [ // workflow stage list
{
"name": "build", // stage name
"parallel": true, // whether to run concurrently
"approval": { // approval information
"enabled": false,
"type": "native",
"description": "",
"native_approval": {
"Timeout": 5,
"approve_users": [],
"NeededApprovers": 0
},
"dingtalk_approval": {
"Timeout": 5
}
},
"jobs": [ // workflow job list
{
"name": "build", // job name
"type": "zadig-build", // job type
"skipped": false, // skipped
"spec": { // job detail
"docker_registry_id": "630c7ad700430c131062e245",
"service_and_builds": [
{
"build_name": "openapi-build",
"image": "",
"image_name": "service1",
"key_vals": [],
"repos": [],
"service_module": "service1",
"service_name": "service1",
"share_storage_info": null
}
]
},
"run_policy": "",
"service_modules": []
}
]
},
{
"name": "deploy",
"parallel": true,
"approval": {
"enabled": false,
"type": "native",
"description": "",
"native_approval": {
"Timeout": 5,
"approve_users": [],
"NeededApprovers": 0
},
"dingtalk_approval": {
"Timeout": 5
}
},
"jobs": [
{
"name": "deploy",
"type": "zadig-deploy",
"skipped": false,
"spec": {
"deploy_contents": [
"image",
"vars"
],
"deploy_type": "",
"env": "dev",
"job_name": "build",
"origin_job_name": "",
"production": false,
"service_and_images": [],
"services": [
{
"key_vals": [],
"latest_key_vals": [],
"latest_variable_kvs": [],
"service_name": "service2",
"updatable": false,
"update_config": false,
"variable_configs": [],
"variable_kvs": [],
"variable_yaml": ""
},
{
"key_vals": [],
"latest_key_vals": [],
"latest_variable_kvs": [],
"service_name": "service1",
"updatable": true,
"update_config": false,
"variable_configs": [
{
"use_global_variable": false,
"variable_key": "cpuLimit"
},
{
"use_global_variable": false,
"variable_key": "memoryLimit"
},
{
"use_global_variable": false,
"variable_key": "port"
}
],
"variable_kvs": [],
"variable_yaml": ""
}
],
"skip_check_run_status": false,
"source": "fromjob"
},
"run_policy": "",
"service_modules": []
},
{
"name": "default",
"type": "plugin",
"skipped": false,
"spec": {
"plugin": {
"args": [
"echo $(inputs.CONTENT)"
],
"category": "",
"cmds": [
"/bin/sh",
"-c"
],
"description": "hello world",
"envs": [
{
"name": "CONTENT",
"value": "$(inputs.CONTENT)"
}
],
"image": "alpine/curl:3.14",
"inputs": [
{
"default": "hello world",
"description": "content to print",
"is_credential": false,
"name": "CONTENT",
"repo": null,
"type": "string",
"value": "hello world"
}
],
"is_offical": false,
"name": "hello-world",
"outputs": [],
"repo_url": "",
"version": "v0.0.1"
},
"properties": {
"build_os": "",
"cache": {
"medium_type": "",
"nfs_properties": {
"provision_type": "",
"pvc": "",
"storage_class": "",
"storage_size_in_gib": 0,
"subpath": ""
},
"object_properties": {
"id": ""
}
},
"cache_dir_type": "",
"cache_enable": false,
"cache_user_dir": "",
"cluster_id": "",
"custom_envs": [],
"envs": [],
"image_from": "",
"image_id": "",
"log_file_name": "",
"namespace": "",
"params": [],
"registries": [],
"res_req": "low",
"res_req_spec": {
"cpu_limit": 1000,
"gpu_limit": "",
"memory_limit": 512
},
"retry": 0,
"share_storage_details": [],
"timeout": 60
}
},
"run_policy": "",
"service_modules": []
}
]
}
],
"notify_ctls": [ // Notification Configuration List
{
"enabled": true,
"webhook_type": "wechat",
"weChat_webHook": "xxx",
"notify_type": [
"created",
"failed"
]
}
],
"share_storages": [], // Shared Volume
"concurrency_limit": 1 // Concurrent Execution Quantity
}
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# Get a Workflow Task List
Request
GET /openapi/workflows/custom/:workflowKey/tasks?projectKey=<project identifier>
query Parameter description
| Parameter Name | Required | Description | Is it Required | Default Value |
|---|---|---|---|---|
projectKey | string | Project identifier | Yes | None |
pageNum | int | Pagination - Current page count | No | 1 |
pageSize | int | Pagination - Single page display entry | No | 50 |
Path parameter description
| Parameter Name | Required | Description | Is it Required | Default Value |
|---|---|---|---|---|
workflowKey | string | Workflow Identifier | Yes | None |
Return Description
| Parameter Name | Required | Description |
|---|---|---|
total | int | Total workflow tasks |
workflow_tasks | []workflow_task | Workflow task list |
workflow_task
| Parameter Name | Required | Description |
|---|---|---|
workflow_key | string | Workflow Identifier |
workflow_name | string | Workflow Name |
project_key | string | Project identifier |
task_id | int | Workflow task ID |
task_creator | string | Workflow Task Executor |
create_time | int | Workflow task creation time |
start_time | int | Workflow task start time |
end_time | int | Workflow task end time |
status | string | Task status includes: created (created), running (running), passed (passed), failed (failed), timeout (timeout), cancelled (cancel) |
Return normally
{
"total": 15,
"workflow_tasks": [
{
"workflow_key": "build-deploy",
"workflow_name": "build-deploy",
"project_key": "lilian-test",
"task_id": 15,
"create_time": 1688543613,
"task_creator": "webhook",
"start_time": 1688543615,
"end_time": 1688543636,
"status": "passed"
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Exception return
{
"code": 400,
"description": "workflow name is required",
"extra": {},
"message": "Bad Request",
"type": "error"
}
2
3
4
5
6
7
# Get Workflow Task Details
GET /openapi/workflows/custom/task?taskId=<workflow task ID>&workflowKey=<workflow identifier>
Query
| Parameter Name | Required | Description | Default Value | Is it Required |
|---|---|---|---|---|
taskId | int | Workflow Task ID | None | Yes |
workflowKey | string | Workflow Identifier | None | Yes |
Return normally
Details
{
"task_id": 24, # Workflow task ID
"workflow_key": "build-images", # Workflow identifier
"params": [ # Workflow variables
{
"name": "USERNAME",
"description": "",
"type": "string",
"value": "zadig",
"default": "",
"is_credential": false
}
],
"status": "running", # Workflow task status
"task_creator": "admin", # Workflow task trigger
"create_time": 1664161285, # Workflow task creation time, Unix timestamp format
"start_time": 1664161286, # Workflow task start execution time, Unix timestamp format
"end_time": 1664172997, # Workflow task execution end time, Unix timestamp format
"stages": [ # Workflow task includes all stage details
{
"name": "build", # Stage name
"status": "passed", # Stage status
"start_time": 1664161286, # Stage execution start time, Unix timestamp format
"end_time": 1664172974, # Stage execution end time, Unix timestamp format
"jobs": [ # Stage includes all task details
{
"name": "a-myapp-1-build-myapps",
"type": "zadig-build", # Built-in build task
"status": "passed", # Task status
"start_time": 1664172967, # Task execution start time, Unix timestamp format
"end_time": 1664172974, # Task execution end time, Unix timestamp format
"spec": { # Build task execution detailed information (including code information, image information, service information, service component information, build variable information)
"repos": [ # Code information
{
"source": "gitee",
"repo_owner": "kr-test-dev",
"repo_namespace": "kr-test-dev",
"repo_name": "zadig",
"remote_name": "origin",
"branch": "main",
"commit_id": "a13120997b95d8b63f2b5b29c700f89d38a5de54",
"commit_message": "update pkg/microservice/warpdrive/config/const.go.\n\nSigned-off-by: grandy <10196377+grandy@user.noreply.gitee.com>",
"address": "https://gitee.com",
"author_name": "grandy"
}
],
"image": "koderover.tencentcloudcr.com/koderover-demo/myapp-1:20220926141606-26-main", # Image information
"service_name": "a", # Service name
"service_module": "myapp-1", # Service component name
"envs": [ # Build variable information
{
"key": "username",
"value": "admin",
"type": "string",
"is_credential": false
},
{
"key": "password",
"value": "zadig",
"type": "string",
"is_credential": true
},
{
"key": "version",
"value": "1",
"type": "string",
"is_credential": false
}
]
}
}
]
},
{
"name": "Deploy",
"status": "passed",
"start_time": 1664172974,
"end_time": 1664172990,
"approval": { # Approval information
"enabled": true, # Need approval
"approve_users": [ # Approval user list
{
"user_name": "admin",
"reject_or_approve": "approve",
"comment": "LGTM",
"operation_time": 1664172985
}
],
"timeout": 120, # Approval timeout, unit: minute
"needed_approvers": 1, # Number of approvals required
"description": "Need approval to deploy", # Approval description
"reject_or_approve": "approve" # approve: pass; reject: reject
},
"jobs": [
{
"name": "a-myapp-1-deploy-myapps",
"type": "zadig-deploy", # Built-in deployment task
"status": "passed",
"start_time": 1664172986,
"end_time": 1664172990,
"spec": { # Deployment task detailed information
"env": "dev",
"skip_check_run_status": false, # Whether to close service status detection
"service_and_images": [ # Deployment service, service component, image information
{
"service_name": "a",
"service_module": "myapp-1",
"image": "koderover.tencentcloudcr.com/koderover-demo/myapp-1:20220926141606-26-main"
}
]
}
}
]
},
{
"name": "General task",
"status": "passed",
"start_time": 1664172990,
"end_time": 1664172993,
"jobs": [
{
"name": "echo-hello",
"type": "freestyle", # General task
"status": "passed",
"start_time": 1664172990,
"end_time": 1664172993,
"spec": { # General task execution detailed information
"repos": [
{
"source": "gitee",
"repo_owner": "kr-test-dev",
"repo_namespace": "kr-test-dev",
"repo_name": "demo-test",
"remote_name": "origin",
"branch": "master",
"commit_id": "2000aba9195bfce73b0a676e48c0ebfe2f59a4a9",
"commit_message": "update org-debug.txt.\n\nSigned-off-by: grandy <10196377+grandy@user.noreply.gitee.com>",
"address": "https://gitee.com",
"author_name": "grandy"
}
],
"image": "",
"service_name": "",
"service_module": "",
"envs": [
{
"key": "myName",
"value": "zadig",
"type": "string",
"is_credential": false
}
]
}
}
]
},
{
"name": "Custom task",
"status": "passed",
"start_time": 1664172993,
"end_time": 1664172997,
"jobs": [
{
"name": "say-hi",
"type": "plugin", # Custom
"status": "passed",
"start_time": 1664172993,
"end_time": 1664172997,
"error": "",
"spec": {
"name": "Output Hello greeting information",
"is_offical": false,
"description": "Greet specified user",
"repo_url": "",
"version": "v0.0.1",
"image": "koderover.tencentcloudcr.com/koderover-public/greeting-bot:20220923-amd64",
"args": [],
"cmds": [],
"envs": [
{
"name": "WHO_AM_I",
"value": "Zadig"
},
{
"name": "WEATHER_STATUS",
"value": "sunny"
}
],
"inputs": [
{
"name": "who_am_i",
"description": "who am i",
"type": "string",
"value": "zadig",
"default": "zadig",
"is_credential": false
},
{
"name": "weather_status",
"description": "what's the weather like today",
"type": "choice",
"value": "sunny",
"choice_否": [
"sunny",
"cloudy",
"rainy"
],
"default": "sunny",
"is_credential": false
}
],
"outputs": []
}
}
]
}
],
"project_key": "simple-service-demo", # Project identifier
}
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
Exception return
# The specified workflow task does not exist
{
"code": 500,
"description": "mongo: no documents in result",
"message": "Internal Error: "
}
2
3
4
5
6
# Execute the Workflow
Request
POST /openapi/workflows/custom/task
Tapd Task
{
"job_name": "tapd", # Tapd task name
"job_type": "tapd", # Tapd task type, specify tapd
"parameters": {
"project_id": "43976133", # Tapd project id
"project_name": "Welcome to TAPD DEMO", # Tapd project name
"status": "open", # Optional values: done, open, or custom values
"iteration_ids": ["1143976133001000001", "1143976133001000002"], # Tapd iteration ids
}
}
2
3
4
5
6
7
8
9
10
body Parameter sample
Details
{
"project_key": "helm", // Project identifier
"workflow_key": "test-openapi", // Workflow identifier
"parameters": [ // Global variables
{
"name": "test",
"type": "string",
"value": "zadig"
},
{
"name": "abc",
"type": "choice",
"value": "123"
},
{
"name": "repo1",
"type: "repo",
"repo": {
"codehost_name": "gitlab",
"repo_namespace": "kr-poc",
"repo_name": "num_test",
"branch": "master",
"prs": [
1
]
}
}
],
"inputs": [
{
"job_name": "build-myapps",
"job_type": "zadig-build",
"parameters": {
"registry": "https://koderover.******.com/test",
"service_list": [
{
"service_module": "aslan",
"service_name": "zadig",
"repo_info": [{
"codehost_name": "koderover",
"repo_namespace": "koderover",
"repo_name": "zadig",
"branch": "main"
}]
inputs: [{
"key": "username",
"value": "admin"
},
{
"key": "password",
"value": "Zadig"
}]
}
]
}
},
{
"job_name": "deploy-myapps",
"job_type": "zadig-deploy",
"parameters": {
"env_name": "dev",
"service_list": [
{
"service_name": "zadig",
"service_module": "aslan",
"image_name": "koderover.******.com/test/aslan:main",
"value_merge_strategy": "override"
},
{
"service_name": "zadig",
"service_module": "zadig-portal",
"image_name": "koderover.******.com/test/zadig-portal:main",
"value_merge_strategy": "reuse-values"
}
]
}
},
{
"job_name": "jira-issue-update",
"job_type": "freestyle",
"parameters": {
"kv": [
{
"key": "IssueID",
"value": "ZAD-10126"
},
{
"key": "FromStatus",
"value": "Testing"
},
{
"key": "TargetStatus",
"value": "ToBeReleased"
}
]
}
},
{
"job_name": "deploy-my-app",
"job_type": "custom-deploy",
"parameters": {
"target_list": [
{
"workload_type": "Deployment",
"workload_name": "service2",
"container_name": "service2",
"image_name": "koderover.***.com/test/service2:0505"
}
]
}
},
{
"job_name": "sql",
"job_type": "sql",
"parameters": {
"database_name": "mysql",
"sql": "show databases;"
}
}
],
"notify_inputs": [
{
"id": 1,
"type": "feishu_person",
"lark_person_notification_config": {
"users": [
{
"id": "35g99291",
"id_type": "user_id"
}
]
}
}
]
}
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
body Parameter description
| Parameter Name | Required | Description | Default Value | Is it Required |
|---|---|---|---|---|
project_key | string | Project identifier | None | Yes |
workflow_key | string | Workflow Identifier | None | Yes |
parameters | []Parameter | Global Variables | None | No |
inputs | []Input | Specific parameters for the execution workflow | None | Yes |
notify_inputs | []NotifyInputs | Notification parameters | None | No |
Parameter
| Parameter Name | Required | Description | Default Value | Is it Required |
|---|---|---|---|---|
name | string | Variable Name | None | Yes |
type | string | Type, support string/text/choice/repo | None | Yes |
value | string | Variable value, which is used when type string/text/choice | None | Yes |
repo | Repo | The variable value of type repo, which field is used only if type repo | None | No |
Repo
| Parameter Name | Required | Description | Default Value | Is it Required |
|---|---|---|---|---|
codehost_name | string | Code source identification | None | Yes |
repo_namespace | string | namespace of repo | None | Yes |
repo_name | string | The name of the repo | None | Yes |
branch | string | Branch name | None | Yes |
prs | []int | pr number | None | No |
Input Parameter description
The following will introduce the trigger parameters of built-in build tasks, deployment tasks, Kubernetes deployment tasks, and general tasks separately.
Build tasks
{
"job_name": "build-myapps", # Build task name
"job_type": "zadig-build", # Build task type, specified as zadig-build
"parameters": {
"registry": "https://koderover.******.com/test", # Image repository information
"service_list": [ # Service information to be built
{
"service_module": "aslan", # Service component name
"service_name": "zadig", # Service name
"repo_info": [{ # Code repository information for building the service component
"codehost_name": "koderover", # Code source identifier
"repo_namespace": "koderover", # Code repository organization name/username
"repo_name": "zadig", # Code repository name
"branch": "main", # Code repository branch
"enable_commit": true, # Whether to enable the use of commit id to build
"commit_id": "e1f10409e99c3f13b0777d2cd8b1a42750b093e1" # The commit id used to build, only takes effect when enable_commit is true
}]
inputs: [{ # Build variable information, if set to a fixed value or global variable, no need to specify
"key": "username",
"value": "admin"
},
{
"key": "password",
"value": "Zadig"
}]
},
{
"service_module": "zadig-portal",
"service_name": "zadig",
"repo_info": [{
"codehost_name": "koderover",
"repo_namespace": "koderover",
"repo_name": "zadig-portal",
"branch": "main"
}]
}
]
}
}
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
Deploy tasks
{
"job_name": "deploy-myapps", # Deployment task name
"job_type": "zadig-deploy", # Deployment task type, specified as zadig-deploy
"parameters": { # Deployment parameters
"env_name": "dev", # Deployment environment information, if set to a fixed value or global variable, no need to configure this field
"service_list": [ # Deployment service information, if set to other task output, no need to configure this field
{
"service_name": "zadig", # Deployment service name
"service_module": "aslan", # Deployment service component name
"image_name": "koderover.***.com/test/aslan:main", # Deployment service component image
"value_merge_strategy": "reuse-values" # Deployment service values merge strategy (for helm chart service only). The values can be reuse-values or override
},
{
"service_name": "zadig",
"service_module": "zadig-portal",
"image_name": "koderover.***.com/test/zadig-portal:main",
"value_merge_strategy": "override"
}
]
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Kubernetes Deploy tasks
{
"job_name": "deploy-my-app", # Kubernetes deployment task name
"job_type": "custom-deploy", # Kubernetes deployment task type, specified as custom-deploy
"parameters": {
"target_list": [ # Deployment container information, if set to a fixed value, no need to specify
{
"workload_type": "Deployment", # Deployment container application type, supports Deployment and StatefulSet
"workload_name": "service2", # Deployment container application name
"container_name": "service2", # Deployment container application container name
"image_name": "koderover.***.com/test/service2:0505" # Deployment container image information
}
]
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
General Tasks
{
"job_name": "jira-issue-update", # General task name
"job_type": "freestyle", # General task type, specified as freestyle
"parameters": { # Parameters and values in general tasks, if set to a fixed value or global variable, no need to specify
// Multi-service parameters, used when execution method is multi-service execution
"services": [
{
"service_name": "service1",
"service_module": "service1",
"inputs": [
{
"key": "test",
"value": "abc1"
}
],
"repo_info": [
{
"codehost_name": "gitlab",
"repo_namespace": "kr-poc",
"repo_name": "multi-service-demo",
"branch": "main"
}
]
}
],
// Single-service parameters, used when execution method is single-service execution
"kv": [
{
"key": "IssueID",
"value": "ZAD-10126"
},
{
"key": "FromStatus",
"value": "Testing"
},
{
"key": "TargetStatus",
"value": "ToBeReleased"
}
],
"repo_info": [ # Code repository information in general tasks
{
"codehost_name": "koderover", # Code source identifier
"repo_namespace": "koderover", # Code repository organization name/username
"repo_name": "zadig", # Code repository name
"branch": "task-mgr" # Code repository branch
}
]
}
}
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
Test tasks
{
"job_name": "test-myapps", # Test task name
"job_type": "zadig-test", # Build task type, specified as zadig-test
"parameters": {
// Multi-service parameters, used when execution method is multi-service execution
"service_list": [
{
"service_name": "service1",
"service_module": "service1",
"inputs": [
{
"key": "test",
"value": "abc1"
}
],
"repo_info": [
{
"codehost_name": "gitlab",
"repo_namespace": "kr-poc",
"repo_name": "multi-service-demo",
"branch": "main"
}
]
}
],
// Single-service parameters, used when execution method is single-service execution
"testing_list": [ # Test task information
{
"testing_name": "unit-test", # Test task name
"repo_info": [{ # Test task code repository information
"codehost_name": "koderover", # Code source identifier
"repo_namespace": "koderover", # Code repository organization name/username
"repo_name": "zadig", # Code repository name
"branch": "main" # Code repository branch
}]
inputs: [{ # Test variable information, if set to a fixed value or global variable, no need to specify
"key": "username",
"value": "admin"
},
{
"key": "password",
"value": "Zadig"
}]
},
{
"testing_name": "integration-test",
"repo_info": [{
"codehost_name": "koderover",
"repo_namespace": "koderover",
"repo_name": "zadig-portal",
"branch": "main"
}]
}
]
}
}
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
Code scanning task
{
"job_name": "scan-myapps", # Code scanning task name
"job_type": "zadig-scanning", # Build task type, specified as zadig-scanning
"parameters": {
// Multi-service parameters, used when execution method is multi-service execution
"service_list": [
{
"service_name": "service1",
"service_module": "service1",
"inputs": [
{
"key": "test",
"value": "abc1"
}
],
"repo_info": [
{
"codehost_name": "gitlab",
"repo_namespace": "kr-poc",
"repo_name": "multi-service-demo",
"branch": "main"
}
]
}
],
// Single-service parameters, used when execution method is single-service execution
"scanning_list": [ # Code scanning task information
{
"scanning_name": "scan", # Code scanning task name
"repo_info": [{ # Code scanning task code repository information
"codehost_name": "koderover", # Code source identifier
"repo_namespace": "koderover", # Code repository organization name/username
"repo_name": "zadig", # Code repository name
"branch": "main" # Code repository branch
}]
},
{
"scanning_name": "scan-1",
"repo_info": [{
"codehost_name": "koderover",
"repo_namespace": "koderover",
"repo_name": "zadig-portal",
"branch": "main"
}]
}
]
}
}
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
SQL Task
{
"job_name": "sql", # SQL task name
"job_type": "sql", # SQL task type, specified as sql
"parameters": {
"database_name": "mysql", # Database name
"sql": "show databases;" # SQL statement
}
}
2
3
4
5
6
7
8
Tapd Job
{
"job_name": "tapd", # Tapd job name
"job_type": "tapd", # Tapd job type, set to tapd
"parameters": {
"project_id": "43976133", # Tapd project id
"project_name": "Welcome to TAPD DEMO", # Tapd project name
"status": "open", # Optional values: done, open, or custom
"iterations": [
{
"iteration_id": "1143976133001000001", # Tapd iteration id
"iteration_name": "Current Iteration Example", # Tapd iteration name
"start_date": "2025-08-04", # Tapd iteration start time
"end_date": "2025-09-03" # Tapd iteration end time
}
]
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Approval Job
{
"job_name": "approval", # Approval job name
"job_type": "approval", # Approval job type, set to approval
"parameters": {} # Approval job does not support parameters, uses workflow configuration by default
}
2
3
4
5
Custom tasks
{
"job_name": "plugin-task", # Custom task name
"job_type": "plugin", # Custom task type, specified as plugin
"parameters": { # Custom task variables
"kv": [
{
"key": "CONTENT",
"value": "hello world"
}
]
}
}
2
3
4
5
6
7
8
9
10
11
12
Notify Input Parameter Description
The following sections describe the trigger parameters for Feishu group notifications (custom bot), Feishu group notifications (self-built app), Feishu member notifications, DingTalk, WeChat Work, Teams, and email notifications.
Feishu Group Notification (Custom Bot)
{
"id": 1, // The nth notification in the workflow configuration, starting from 0
"type": "feishu",
"lark_hook_notification_config": {
"at_users": ["35xxxx91"], // Feishu user ID, id_type is user_id
"is_at_all": false
}
}
2
3
4
5
6
7
8
Feishu Group Notification (Self-built App)
{
"id": 1, // The nth notification in the workflow configuration, starting from 0
"type": "feishu_app",
"lark_group_notification_config": {
"chat_id": "oc_0c7db78d0fxxxxxxd81cc5692aa3",
"at_users": [
{
"id": "35xxxx91",
"id_type": "user_id" # Supports user_id and open_id types
}
]
}
}
2
3
4
5
6
7
8
9
10
11
12
13
Feishu Member Notification
{
"id": 1, // The nth notification in the workflow configuration, starting from 0
"type": "feishu_person",
"lark_person_notification_config": {
"users": [
{
"id": "35xxxx91",
"id_type": "user_id" # Supports user_id and open_id types
}
]
}
}
2
3
4
5
6
7
8
9
10
11
12
WeChat Work Notification
{
"id": 1, // The nth notification in the workflow configuration, starting from 0
"type": "wechat",
"wechat_notification_config": {
"at_users": ["35xxxx91"], // WeChat Work user ID
"is_at_all": false
}
}
2
3
4
5
6
7
8
DingTalk Notification
{
"id": 1, // The nth notification in the workflow configuration, starting from 0
"type": "dingding",
"dingding_notification_config": {
"at_mobiles": ["13800138000", "13800138001"],
"is_at_all": false
}
}
2
3
4
5
6
7
8
MSTeams Notification Configuration
{
"id": 1, // The nth notification in the workflow configuration, starting from 0
"type": "msteams",
"msteams_notification_config": {
"at_emails": ["test@example.com", "test2@example.com"],
}
}
2
3
4
5
6
7
Email Notification
{
"id": 1, // The nth notification in the workflow configuration, starting from 0
"type": "mail",
"mail_notification_config": {
"user_ids": ["1234567890", "0987654321"] // Zadig user ID
}
}
2
3
4
5
6
7
Return normally
{
"project_name": "simple-service-demo", # Project identifier
"workflow_name": "openapi-test", # Workflow name
"task_id": 20 # Workflow task execution sequence ID
}
2
3
4
5
# Cancel Workflow Tasks
Request
DELETE /openapi/workflows/custom/task?taskId=<taskId>&workflowKey=<workflow identifier>
Query
| Parameter Name | Required | Description | Default Value | Is it Required |
|---|---|---|---|---|
taskId | int | Workflow Task ID | None | Yes |
workflowKey | string | Workflow Identifier | None | Yes |
Return normally
{
"message": "success"
}
2
3
Exception return
# The specified workflow task has been successfully run
{
"code": 6163,
"description": "task: build-images:20 is passed, cannot cancel",
"extra": {},
"message": "Cancel workflow task failed",
"type": "error"
}
# The specified workflow or task does not exist
{
"code": 6163,
"description": "mongo: no documents in result",
"extra": {},
"message": "Cancel workflow task failed",
"type": "error"
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Retry the Workflow Task
Request
POST /openapi/workflows/custom/:workflowKey/task/:taskID?projectKey=<project identifier>
query Parameter description
| Parameter Name | Required | Description | Is it Required | Default Value |
|---|---|---|---|---|
projectKey | string | Project identifier | Yes | None |
Path parameter description
| Parameter Name | Required | Description | Is it Required | Default Value |
|---|---|---|---|---|
workflowKey | string | Workflow Identifier | Yes | None |
taskID | int | Workflow task ID | Yes | None |
Return normally
{
"message": "success"
}
2
3
Exception return
{
"code": 6161,
"description": "mongo: no documents in result",
"extra": {},
"message": "Get workflow task failed",
"type": "error"
}
2
3
4
5
6
7
# Approval Workflow
Tip
Applicable to Zadig approval.
Request
POST /openapi/workflows/custom/task/approve
body Parameter description
| Parameter Name | Required | Description | Default Value | Is it Required |
|---|---|---|---|---|
task_id | int | Workflow Task ID | None | Yes |
workflow_key | string | Workflow Identifier | None | Yes |
stage_name | string | The name of the stage for which the workflow is approved | None | Yes |
approve | bool | Whether the approval is approved | false | No |
comment | string | Approval information | None | No |
body Parameter example
{
"task_id": 2,
"workflow_key": "infra-dev-workflow",
"stage_name": "deploy",
"approve": true,
"comment": "LGTM"
}
2
3
4
5
6
7
Return normally
{
"message": "success"
}
2
3
Exception return
# The stage specified by the parameter does not need approval
{
"code": 6169,
"description": "workflow build-images ID 23 stage deploy-myapps do not need approve",
"extra": {},
"message": "Approve workflow task failed",
"type": "error"
}
2
3
4
5
6
7
8
9
# Create a Workflow
Request
POST /api/aslan/workflow/v4
body Parameter description
Tip
The parameters of this interface are relatively complex and it is more laborious to assemble it yourself. It is recommended to create a workflow in the page first -> Click YAML -> on the configuration page to copy YAML content and use the online conversion tool(opens new window) to quickly obtain parameters.

| Parameter Name | Required | Description | Default Value | Is it Required |
|---|---|---|---|---|
name | string | Workflow Identifier | None | Yes |
display_name | string | Workflow Name | None | Yes |
project | string | Project identifier | None | Yes |
description | string | Workflow description information | None | No |
concurrency_limit | int | Workflow task concurrency number, -1 means unlimited, 0 means unexecutable | 0 | Yes |
stages | []Stage | Phase configuration | None | No |
Stage Parameter description
| Parameter Name | Description | Required | Required |
|---|---|---|---|
name | Stage name | string | Yes |
parallel | Whether to enable concurrent execution | bool | Yes |
jobs | Task Configuration | []interface{} | Yes |
body Parameter example
The following body The example contains Build -> Deploy -> Test -> Image Distribution five stages:
Details
{
"name": "workflow-demo",
"display_name": "workflow-demo",
"project": "demo",
"description": "workflow-demo description",
"concurrency_limit": 5,
"stages": [
{
"name": "Build",
"parallel": true,
"jobs": [
{
"name": "build",
"type": "zadig-build",
"run_policy": "",
"spec": {
"docker_registry_id": "62c**********",
"service_and_builds": [
{
"service_name": "service1",
"service_module": "service1",
"image_name": "nginx",
"value": "service1/service1",
"build_name": "build-demo"
}
]
}
}
]
},
{
"name": "Deploy",
"parallel": true,
"approval": {
"enabled": true,
"type": "native",
"native_approval": {
"approve_users": [
{
"user_name": "admin",
"user_id": "9792310b-**********"
},
{
"user_name": "sre-admin",
"user_id": "9837370s-**********"
}
],
"timeout": 5,
"needed_approvers": 1
}
},
"jobs": [
{
"name": "deploy",
"type": "zadig-deploy",
"spec": {
"env": "dev",
"production": false,
"deploy_contents": [
"image"
],
"skip_check_run_status": false,
"source": "fromjob",
"job_name": "build",
"service_and_images": [
{
"service_name": "service1",
"service_module": "service1",
"value": "service1/service1"
}
]
}
}
]
},
{
"name": "Test",
"parallel": true,
"jobs": [
{
"name": "test",
"type": "zadig-test",
"spec": {
"test_type": "service_test",
"source": "fromjob",
"job_name": "build",
"service_and_tests": [
{
"service_name": "service1",
"service_module": "service1",
"name": "smoke-test",
"project_name": "voting-app"
}
]
}
}
]
},
{
"name": "Distribute",
"parallel": true,
"jobs": [
{
"name": "common",
"type": "freestyle",
"run_policy": "",
"spec": {
"properties": {
"timeout": 60,
"res_req": "low",
"res_req_spec": {
"cpu_limit": 1000,
"memory_limit": 512
},
"cluster_id": "",
"build_os": "focal",
"image_id": "630xxxxxxxxxxxx",
"image_from": "koderover",
"envs": [
{
"key": "key1",
"value": "val1",
"type": "string",
"is_credential": false
}
],
"cache_enable": true,
"cache_dir_type": "workspace",
"cache_user_dir": ""
},
"steps": [
{
"name": "tools",
"type": "tools",
"spec": {
"installs": [
{
"name": "go",
"version": "1.19.3",
"id": "go1.19.3"
}
]
}
},
{
"name": "git",
"type": "git",
"spec": {
"repos": [
{
"codehost_id": 23,
"repo_owner": "owner1",
"repo_name": "hello",
"source": "GitHub",
"branch": "main",
"checkout_path": "",
"remote_name": "origin",
"submodules": false,
"hidden": false,
"repo_namespace": "owner1"
}
]
}
},
{
"name": "shell",
"type": "shell",
"spec": {
"script": "#!/bin/bash\nset -e\necho hello"
}
}
]
}
}
]
},
{
"name": "Image Distribution",
"parallel": true,
"jobs": [
{
"name": "image-release",
"type": "zadig-distribute-image",
"run_policy": "",
"isCreate": true,
"spec": {
"source": "fromjob",
"job_name": "build",
"source_registry_id": "",
"target_registry_id": "630xxxxxxxxxxxx",
"targets": [
{
"service_name": "n-1",
"service_module": "nginx-latest",
"image_name": "nginx",
"value": "n-1/nginx-latest"
}
],
"timeout": 10,
"cluster_id": "",
"params": []
}
}
]
}
]
}
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# Update Workflow
Request
PUT /api/aslan/workflow/v4/:name?projectName=<project_name>
query Parameter description
| Parameter Name | Required | Description | Is it Required | Default Value |
|---|---|---|---|---|
projectName | string | Project identifier | Yes | None |
Path parameter description
| Parameter Name | Required | Description | Is it Required | Default Value |
|---|---|---|---|---|
name | string | Workflow Name | Yes | None |
body Parameter description
Reference Create Workflow Parameters
# Delete Workflow
Request
DELETE /openapi/workflows/custom?workflowKey=<workflow identifier>&projectKey=<project identifier>
query Parameter description
| Parameter Name | Required | Description | Default Value | Is it Required |
|---|---|---|---|---|
workflowKey | string | Workflow Identifier | None | Yes |
projectKey | string | Project identifier | None | Yes |
Return normally
{
"message": "success"
}
2
3
# Workflow View
# Get a Workflow View List
Request
GET /openapi/workflows/view?projectKey=<project identifier>
query Parameter description
| Parameter Name | Required | Description | Is it Required | Default Value |
|---|---|---|---|---|
projectKey | string | Project identifier | Yes | None |
Return Description
| Parameter Name | Description | Required |
|---|---|---|
name | View name | string |
project_key | Project identifier | string |
update_time | Update Time | int |
update_by | Updater | string |
workflows | Workflow list | []workflow |
workflow
| Parameter Name | Description | Required |
|---|---|---|
workflow_key | Workflow Identifier | string |
workflow_type | custom | string |
Return normally
Details
[
{
"name": "test-view",
"project_key": "lilian-test",
"workflows": [
{
"workflow_key": "xiaxianfuwu",
"workflow_type": "custom",
}
],
"update_time": 1689329334,
"update_by": "admin"
}
]
2
3
4
5
6
7
8
9
10
11
12
13
14
# Create a Workflow View
Request
POST /openapi/workflows/view
body Parameter description
| Parameter Name | Description | Required | Required |
|---|---|---|---|
project_key | Project identifier | string | Yes |
name | Workflow view name | string | Yes |
workflow_list | Workflow list | []Workflow | Yes |
Workflow Parameter description
| Parameter Name | Description | Required | Required |
|---|---|---|---|
workflow_key | Workflow Identifier | string | Yes |
workflow_type | custom | string | Yes |
body Parameter example
Details
{
"project_key": "demo",
"name": "view-demo",
"workflow_list": [
{
"workflow_key": "dev",
"workflow_type": "custom"
},
{
"workflow_key": "nacos-config-update",
"workflow_type": "custom"
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
Return normally
{
"message": "success"
}
2
3
# Edit Workflow View
Request
PUT /openapi/workflows/view/:viewName?projectKey=<project identifier>
query Parameter description
| Parameter Name | Required | Description | Is it Required | Default Value |
|---|---|---|---|---|
projectKey | string | Project identifier | Yes | None |
Path parameter description
| Parameter Name | Required | Description | Is it Required | Default Value |
|---|---|---|---|---|
viewName | string | View name | Yes | None |
body Parameter description
| Parameter Name | Description | Required | Required | Default Value |
|---|---|---|---|---|
workflow_list | Workflow list | []Workflow | Yes | None |
workflow
| Parameter Name | Description | Required | Required | Default Value |
|---|---|---|---|---|
workflow_key | Workflow Identifier | string | Yes | None |
workflow_type | custom | string | Yes | None |
enabled | true : Add workflow to viewfalse : Remove the workflow from the view | bool | Yes | None |
body Parameter example
Details
{
"workflow_list":[
{
"workflow_key":"build-deploy",
"workflow_type":"custom",
"enabled":true
}
]
}
2
3
4
5
6
7
8
9
Return normally
{
"message": "success"
}
2
3
# Delete the Workflow View
Request
DELETE /openapi/workflows/view/:viewName?projectKey=<project identifier>
query Parameter description
| Parameter Name | Required | Description | Is it Required | Default Value |
|---|---|---|---|---|
projectKey | string | Project identifier | Yes | None |
Path parameter description
| Parameter Name | Required | Description | Is it Required | Default Value |
|---|---|---|---|---|
viewName | string | View name | Yes | None |
Return normally
{
"message": "success"
}
2
3
Exception return
{
"code": 6894,
"description": "find workflow view error: mongo: no documents in result",
"extra": {},
"message": "delete workflow view error: mongo: no documents in result",
"type": "error"
}
2
3
4
5
6
7
# Workflow Pre-Approval
# Create a Pre-Approval Form
Request
POST /openapi/ticket/approval
Body Parameter description
| Parameter Name | Required | Description | Is it Required | Default Value |
|---|---|---|---|---|
project_key | string | Project identifier | Yes | None |
approval_id | string | Third-party system approval form number | Yes | None |
status | int | Approval form status: 0- The approval form is invalid 1- form takes effect | Yes | None |
envs | string | Optional environment restrictions, empty is unlimited | No | None |
services | []ServiceInfo | Optional service restrictions, empty is unlimited | No | None |
users | []User | User restrictions can be executed, empty is unlimited | No | None |
execution_window_start | int | The executable time window start time, empty is unlimited | No | None |
execution_window_end | int | Executable time window end time, empty is unlimited | No | None |
ServiceInfo Structure
| Parameter Name | Required | Description | Is it Required | Default Value |
|---|---|---|---|---|
| service_name | string | Service name | Yes | None |
| service_module | string | Service Components | Yes | None |
User Structure
| Parameter Name | Required | Description | Is it Required | Default Value |
|---|---|---|---|---|
| name | string | User name, used for the approval form display | Yes | None |
| string | Email address, used to connect to user systems in Zadig systems | Yes | None |
Return normally
{
"code": 1,
"message": "success"
}
2
3
4
Error return
{
"code": 500,
"description": "...",
"message": "Internal Error"
}
2
3
4
5
# Workflow Logs
# View Real-time Workflow Task Logs
When workflow tasks are executing, real-time logs can be viewed through this API.
Request
GET /openapi/logs/sse/v4/workflow/<workflow_id>/<workflow_task_id>/<workflow_job_task_id>/<tail_lines>
Response Example
Details
This API returns SSE stream data in the following format:
"log message line 1"
"log message line 2"
...
2
3
# View Complete Workflow Task Logs
After workflow tasks complete execution, complete logs can be viewed through this API.
Request
GET /openapi/logs/log/v4/workflow/<workflow_id>/<workflow_task_id>/<workflow_job_task_id>
Response Example
Details
"log message line 1"
"log message line 2"
...
2
3


