Zadig 文档
Zadig
教程
博客
论坛
关于
中文英文
Zadig
教程
博客
论坛
关于
Zadig v4.0
Loading...
     编辑文档
     反馈问题
     社区讨论

    本页导航

    Build

    # Create Build from Template

    Request

    POST /openapi/build?source=template
    
    1

    Body Parameter Description

    Parameter NameDescriptionTypeRequired
    nameBuild namestringYes
    project_keyProject keystringYes
    template_nameBuild template namestringYes
    target_servicesService configuration[]TargetServiceYes

    TargetService Parameter Description

    Parameter NameDescriptionTypeRequired
    service_moduleService module namestringYes
    service_nameService namestringYes
    repo_infoRepository info[]RepoInfoYes
    inputsVariable info[]InputYes

    RepoInfo Parameter Description

    Parameter NameDescriptionTypeRequired
    codehost_nameCode source identifierstringYes
    repo_namespaceRepository namespace (organization/user)stringYes
    repo_nameRepository namestringYes
    branchBranch infostringYes

    Input Parameter Description

    Parameter NameDescriptionTypeRequired
    keyVariable keystringYes
    valueVariable valuestringYes

    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

    Return

    {
      "message": "success"
    }
    
    1
    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 NameTypeDescriptionRequiredDefault Value
    projectKeystringProject identifierYesNone
    pageNumintPage parameter-current page numberNo1
    pageSizeintPage parameter-current page display countNo20

    Return Description

    Parameter NameTypeDescription
    totalintBuild module total number
    builds[]BuildBuild module list

    Build Parameter Description

    Parameter NameTypeDescription
    namestringBuild name
    project_keystringProject identifier
    sourcestringBuild method, there are two: zadig, jenkins
    update_bystringUpdater
    update_timeintUpdate time
    target_services[]TargetServiceService component list

    TargetService Parameter Description

    Parameter NameTypeDescription
    service_namestringService name
    service_modulestringService 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

    # Get Build Details

    Request

    GET /openapi/build/:buildName/detail?projectKey=<project identifier>
    
    1

    Query Parameter Description

    Parameter NameTypeDescriptionRequiredDefault Value
    projectKeystringProject identifierYesNone
    serviceNamestringService nameYesNone
    serviceModulestringService component nameYesNone

    Path Parameter Description

    Parameter NameTypeDescriptionRequiredDefault Value
    buildNamestringBuild nameYesNone

    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

    # Delete Build

    Request

    DELETE /openapi/build?name=<build name>&projectKey=<project identifier>
    
    1

    Query Parameter Description

    Parameter NameDescriptionTypeRequired
    nameBuild namestringYes
    projectKeyProject identifierstringYes

    Return Description

    {
      "message": "success"
    }
    
    1
    2
    3

    ← ServiceTest→

    资源
    教程
    论坛
    博客
    公司
    关于
    客户故事
    加入我们
    联系我们
    微信扫一扫
    hello@koderover.com

    © 2026 筑栈(上海)信息技术有限公司 沪 ICP 备 19000177 号 - 1

    •  跟随系统
    •  浅色模式
    •  深色模式
    •  阅读模式