Webhooks

本文主要介绍 Webhooks 事件,允许开发人员通过订阅应用事件(新建应用、环境部署完成、变更发布、研发流程运行成功等)来对接三方平台,如三方项目管理平台、自有CMDB平台、三方部署运维平台等。

1. Webhooks 配置

1.1 新建 Webhook

应用交付AppStack提供了全局 Webhooks 和应用内 Webhooks,全局 Webhooks 对企业下所有应用生效,应用内 Webhooks 仅对当前应用生效。

  • 操作入口:全局 Webhooks,进入 AppStack 首页 -> 全局设置 -> Webhooks,单击新建Webhook;应用内 Webhooks,进入目标应用 -> 设置 -> Webhooks,点击新建 Webhook

  • 填写 Webhook 参数:

    • URL:必填,Webhook触发地址,以传输协议 http 或 https 开头。

    • Secret Token:非必填,在请求的 X-AppStack-Token HTTP头中发送,用于接收方验证请求合法性。

    • 描述:非必填,通常描述 Webhook 用途。

    • 触发事件:单击勾选需要订阅的事件,详见 Webhooks 事件列表。

image

1.2 测试 Webhook

配置 Webhook 后可对 Webhook 的可用性进行验证,单击 测试Webhook 将自动以新建应用 Mock 示例进行调用触发目标事件,以测试 URL 连通性。

image

image

1.3 触发历史

进入 Webhooks 列表,支持查看 Webhook 触发历史,查看触发时间耗时、以及触发具体的 RequestResponse,用于触发历史追溯和问题排查。

image

2. Webhooks 事件列表

2.1 应用

2.1.1 新建应用

Headers

{
    "X-AppStack-Event": "App",
    "X-AppStack-Action": "Create",
    "X-AppStack-Token": "your-secret-token",
    "X-AppStack-App": "myapp-demo"
}

Body

{
    "id": "07ebabc883e14ec78612656bbef61925",
    "user": {
        "id": "646dabc05ccc4ad1bc2a9e2f",
        "name": null,
        "email": null,
        "userName": null,
        "staffId": null
    },
    "orgId": "60d54f3daccf2bbd6659f3ad",
    "time": "2024-07-29T06:46:26.157+00:00",
    "objectKind": "App",
    "objectAttributes": {
        "name": "myapp-demo",
        "description": "这是一个测试应用",
        "status": null,
        "labelList": [],
        "favoured": false,
        "groupName": null,
        "creatorId": "646dabc05ccc4ad1bc2a9e2f",
        "gmtCreate": 1722235582307,
        "type": "APP",
        "id": "myapp-demo"
    }
}

2.1.2 删除应用

Headers

{
    "X-AppStack-Event": "App",
    "X-AppStack-Action": "Delete",
    "X-AppStack-Token": "your-secret-token",
    "X-AppStack-App": "myapp-demo"
}

Body

{
    "id": "ecd0f8a7b6a6473bbbc3e5212ec33929",
    "user": {
        "id": "646dabc05ccc4ad1bc2a9e2f",
        "name": null,
        "email": null,
        "userName": null,
        "staffId": null
    },
    "orgId": "60d54f3daccf2bbd6659f3ad",
    "time": "2024-07-29T06:50:25.480+00:00",
    "objectKind": "App",
    "objectAttributes": {
        "name": "myapp-demo",
        "description": "这是一个测试应用",
        "status": null,
        "labelList": [],
        "favoured": false,
        "groupName": null,
        "creatorId": "646dabc05ccc4ad1bc2a9e2f",
        "gmtCreate": 1722235582000,
        "type": "APP",
        "id": "myapp-demo"
    }
}

2.2 环境

2.2.1 新建环境

Headers

{
    "X-AppStack-Event": "Env",
    "X-AppStack-Action": "Create",
    "X-AppStack-Token": "your-secret-token",
    "X-AppStack-App": "myapp-demo"
}

Body

{
    "id": "ecfc8a274ff3479e9bfa07e421a06b9c",
    "user": {
        "id": "646dabc05ccc4ad1bc2a9e2f",
        "name": null,
        "email": null,
        "userName": null,
        "staffId": null
    },
    "orgId": "60d54f3daccf2bbd6659f3ad",
    "time": "2024-07-29T07:06:04.104+00:00",
    "objectKind": "Env",
    "objectAttributes": {
        "name": "test-env",
        "displayName": "测试环境",
        "appName": "myapp-demo",
        "status": "NEW",
        "description": "这是测试环境,用于日常测试验证",
        "creatorId": null,
        "gmtCreate": null,
        "lockBy": null,
        "resourcePoolName": "default",
        "deployGroupName": "demo-k8s-cluster",
        "orchestrationName": null,
        "profiles": [
            {
                "name": "test-vars",
                "displayName": "测试环境变量组",
                "type": "APP"
            }
        ],
        "spec": {
            "migrateState": null,
            "oamRebuildState": null,
            "withoutOam": "ON",
            "rolloutStrategy": null,
            "replicasManagement": "SYSTEM"
        },
        "labelList": [
            {
                "namespace": "default",
                "name": "envType",
                "value": "test",
                "displayName": "环境级别",
                "displayValue": "测试环境",
                "extraMap": {}
            }
        ],
        "id": "test-env"
    }
}

2.2.2 环境设置

Headers

{
    "X-AppStack-Event": "Env",
    "X-AppStack-Action": "Update",
    "X-AppStack-Token": "your-secret-token",
    "X-AppStack-App": "myapp-demo"
}

Body

{
    "id": "64f6e280c9814f668ca56f713b6af19d",
    "user": {
        "id": "646dabc05ccc4ad1bc2a9e2f",
        "name": null,
        "email": null,
        "userName": null,
        "staffId": null
    },
    "orgId": "60d54f3daccf2bbd6659f3ad",
    "time": "2024-07-29T07:07:42.536+00:00",
    "objectKind": "Env",
    "objectAttributes": {
        "name": "test-env",
        "displayName": "测试环境",
        "appName": "myapp-demo",
        "status": "NEW",
        "description": "这是测试环境,用于日常测试验证",
        "creatorId": "646dabc05ccc4ad1bc2a9e2f",
        "gmtCreate": 1722236764000,
        "lockBy": null,
        "resourcePoolName": "default",
        "deployGroupName": "demo-k8s-cluster",
        "orchestrationName": null,
        "profiles": [
            {
                "name": "test-vars",
                "displayName": "测试环境变量组",
                "type": "APP"
            }
        ],
        "spec": {
            "migrateState": null,
            "oamRebuildState": null,
            "withoutOam": "ON",
            "rolloutStrategy": [
                {
                    "locator": "*",
                    "batches": null,
                    "batchSteps": null,
                    "timeOutMS": 1200000,
                    "targetReplicas": null,
                    "batchMode": "ConfirmFirstBatch",
                    "deployType": "Rolling"
                }
            ],
            "replicasManagement": "USER"
        },
        "labelList": [
            {
                "namespace": "default",
                "name": "envType",
                "value": "test",
                "displayName": "环境级别",
                "displayValue": "测试环境",
                "extraMap": {}
            }
        ],
        "id": "test-env"
    }
}

2.2.3 删除环境

Headers

{
    "X-AppStack-Event": "Env",
    "X-AppStack-Action": "Delete",
    "X-AppStack-Token": "your-secret-token",
    "X-AppStack-App": "myapp-demo"
}

Body

{
    "id": "f189080c26b94cdcbf069debdfeeff97",
    "user": {
        "id": "646dabc05ccc4ad1bc2a9e2f",
        "name": null,
        "email": null,
        "userName": null,
        "staffId": null
    },
    "orgId": "60d54f3daccf2bbd6659f3ad",
    "time": "2024-07-29T07:09:04.612+00:00",
    "objectKind": "Env",
    "objectAttributes": {
        "name": "test-env",
        "displayName": "测试环境",
        "appName": "myapp-demo",
        "status": "NEW",
        "description": "这是测试环境,用于日常测试验证",
        "creatorId": "646dabc05ccc4ad1bc2a9e2f",
        "gmtCreate": 1722236764000,
        "lockBy": null,
        "resourcePoolName": "default",
        "deployGroupName": "demo-k8s-cluster",
        "orchestrationName": null,
        "profiles": [
            {
                "name": "test-vars",
                "displayName": "测试环境变量组",
                "type": "APP"
            }
        ],
        "spec": {
            "migrateState": null,
            "oamRebuildState": null,
            "withoutOam": "ON",
            "rolloutStrategy": [
                {
                    "locator": "*",
                    "batches": null,
                    "batchSteps": null,
                    "timeOutMS": 1200000,
                    "targetReplicas": null,
                    "batchMode": "ConfirmFirstBatch",
                    "deployType": "Rolling"
                }
            ],
            "replicasManagement": "USER"
        },
        "labelList": [
            {
                "namespace": "default",
                "name": "envType",
                "value": "test",
                "displayName": "环境级别",
                "displayValue": "测试环境",
                "extraMap": {}
            }
        ],
        "id": "test-env"
    }
}

2.3 部署单

2.3.1 部署单状态更新

Headers

{
    "X-AppStack-Event": "ChangeOrder",
    "X-AppStack-Action": "StatusUpdate",
    "X-AppStack-Token": "your-secret-token",
    "X-AppStack-App": "myapp-demo"
}

Body

{
    "id": "ca59d8f8f6224eb3b518af9c2145aca5",
    "user": {
        "id": "646dabc05ccc4ad1bc2a9e2f",
        "name": null,
        "email": null,
        "userName": null,
        "staffId": null
    },
    "orgId": "620321f073741507cb7d0cfd",
    "time": "2024-08-15T06:43:34.911+00:00",
    "objectKind": "ChangeOrder",
    "objectAttributes": {
        "name": "20240815144312-部署",
        "appName": "myapp-demo",
        "type": "Deploy",
        "startedAt": 1723704199000,
        "endedAt": null,
        "version": "20240815144312-310",
        "tag": "myapp-demo::20240815144315::626e429",
        "state": "FAILED",
        "overrideFinishState": null,
        "controlMode": "Auto",
        "description": null,
        "jobs": [
            {
                "sn": "1aa8d03f6b574681af203447812d1d61",
                "name": "20240815144312-部署",
                "envName": "test",
                "envDisplayName": null,
                "appName": "myapp-demo",
                "changeableEnvSn": "8480d937c656460fada9ca27f37f63a3",
                "engineType": "Ade2",
                "resourceType": "KUBERNETES",
                "changeOrderSn": "32468993abb14653ae9d86cf5d1cac98",
                "nextSn": null,
                "priority": 0,
                "profiles": [
                    {
                        "name": "test",
                        "displayName": "测试环境变量组",
                        "type": "APP"
                    }
                ],
                "startedAt": 1723704199000,
                "endedAt": 1723704215000,
                "state": "FAILED",
                "overrideFinishState": null,
                "controlMode": "Auto",
                "stages": [
                    {
                        "sn": "9436683c270d447ab22045de5642b027",
                        "jobSn": "1aa8d03f6b574681af203447812d1d61",
                        "engineType": "Ade2",
                        "resourceType": "KUBERNETES",
                        "priority": 1,
                        "startedAt": 1723704199000,
                        "endedAt": 1723704206000,
                        "state": "SUCCESS",
                        "overrideFinishState": null,
                        "controlMode": "Auto",
                        "name": "顺序1",
                        "tasks": [
                            {
                                "sn": "b8c82092f1a04d829154fde67bc4e0af",
                                "name": "myapp-demo-test",
                                "engineType": "Ade2",
                                "resourceType": "KUBERNETES",
                                "jobSn": "1aa8d03f6b574681af203447812d1d61",
                                "locator": "myapp-demo-test/default/core/v1/Service",
                                "stageSn": "9436683c270d447ab22045de5642b027",
                                "priority": 0,
                                "startedAt": 1723704199000,
                                "endedAt": 1723704202000,
                                "state": "SUCCESS",
                                "overrideFinishState": null,
                                "strategyContent": "{\"behavior\":\"Upsert\"}",
                                "contextContent": "{\"appName\":\"myapp-demo\",\"envName\":\"test\",\"name\":\"myapp-demo-test\",\"changeOrderVersion\":\"20240815144312-310\",\"artifacts\":{},\"version\":\"v1\",\"jobType\":\"Deploy\",\"group\":\"core\",\"namespace\":\"default\",\"deployGroupName\":\"c8c18031145b74e20811ae8bb59cea7fb\",\"planningStatus\":null,\"kind\":\"Service\",\"currentPassIndex\":null,\"extendParams\":{},\"initialRevisions\":null,\"locator\":\"myapp-demo-test/default/core/v1/Service\",\"apiVersion\":\"core/v1\"}",
                                "deliveries": "---\napiVersion: \"v1\"\nkind: \"Service\"\nmetadata:\n  name: \"myapp-demo-test\"\n  namespace: \"default\"\nspec:\n  selector:\n    run: \"myapp-demo-test\"\n  ports:\n  - protocol: \"TCP\"\n    port: 80\n    targetPort: 8080\n",
                                "spec": "---\napiVersion: \"v1\"\nkind: \"Service\"\nmetadata:\n  name: \"myapp-demo-test\"\n  namespace: \"default\"\n  labels:\n    devops.aliyun.com/app-name: \"myapp-demo\"\n    devops.aliyun.com/version: \"20240815144312-310\"\n    devops.aliyun.com/org-id: \"620321f073741507cb7d0cfd\"\n    devops.aliyun.com/env-name: \"test\"\nspec:\n  selector:\n    run: \"myapp-demo-test\"\n  ports:\n  - protocol: \"TCP\"\n    port: 80\n    targetPort: 8080\n",
                                "engineTaskKey": "77b1c704-70fd-445a-ae58-c2dc2bfc2147",
                                "engineTaskResultContent": "{\"typeKey\":\"Ade2@KUBERNETES\",\"deliverySn\":\"77b1c704-70fd-445a-ae58-c2dc2bfc2147\",\"state\":\"SUCCESSFUL\",\"userParam\":{\"X-Tenant-Id\":\"620321f073741507cb7d0cfd\",\"X-Operator-Id\":\"646dabc05ccc4ad1bc2a9e2f\",\"traceId\":\"1889cf906d064cb7861cefe989d5a5b5.794.17237041982184057\",\"typeKey\":\"Ade2@KUBERNETES\"},\"statistics\":null,\"podRevision\":null,\"serviceBrief\":{\"ports\":[\"TCP 80:8080\"],\"clusterIp\":\"172.16.192.188\"},\"purgeStatistics\":null,\"callbackParams\":{},\"taskErrorMessages\":{},\"snapshotType\":null,\"snapshotKey\":null,\"uid\":null,\"info\":null,\"resourceType\":\"KUBERNETES\",\"typeKey\":\"Ade2@KUBERNETES\",\"engineTaskKey\":\"77b1c704-70fd-445a-ae58-c2dc2bfc2147\",\"engineType\":\"Ade2\"}",
                                "orgId": "620321f073741507cb7d0cfd"
                            }
                        ]
                    },
                    {
                        "sn": "d7cce8a19c3f4343b9a56102e970063a",
                        "jobSn": "1aa8d03f6b574681af203447812d1d61",
                        "engineType": "Ade2",
                        "resourceType": "KUBERNETES",
                        "priority": 2,
                        "startedAt": 1723704206000,
                        "endedAt": 1723704215000,
                        "state": "FAILED",
                        "overrideFinishState": null,
                        "controlMode": "Auto",
                        "name": "顺序2",
                        "tasks": [
                            {
                                "sn": "c86e2410edae4b948e1f11b683954810",
                                "name": "myapp-demo-test",
                                "engineType": "Ade2",
                                "resourceType": "KUBERNETES",
                                "jobSn": "1aa8d03f6b574681af203447812d1d61",
                                "locator": "myapp-demo-test/default/apps/v1/Deployment",
                                "stageSn": "d7cce8a19c3f4343b9a56102e970063a",
                                "priority": 0,
                                "startedAt": 1723704206000,
                                "endedAt": 1723704208000,
                                "state": "FAILED",
                                "overrideFinishState": null,
                                "strategyContent": "{\"version\":\"v2\",\"behavior\":\"Upsert\",\"batches\":2,\"batchSteps\":[{\"type\":\"WEIGHT\",\"value\":\"20\"},{\"type\":\"WEIGHT\",\"value\":\"80\"}],\"quickRollback\":null,\"targetReplicas\":null,\"fromReplicas\":null,\"timeOutMS\":600000,\"batchMode\":\"Manual\",\"deployType\":\"Batch\",\"deleteDeployGroup\":false,\"restraint\":null,\"totalReplicas\":null}",
                                "contextContent": "{\"appName\":\"myapp-demo\",\"envName\":\"test\",\"name\":\"myapp-demo-test\",\"changeOrderVersion\":\"20240815144312-310\",\"artifacts\":{\"image.backend\":\"yunxiao-registry.cn-beijing.cr.aliyuncs.com/test/demo1:emoji-2024-06-18-15-22-45\"},\"version\":\"v1\",\"jobType\":\"Deploy\",\"group\":\"apps\",\"namespace\":\"default\",\"deployGroupName\":\"c8c18031145b74e20811ae8bb59cea7fb\",\"planningStatus\":null,\"kind\":\"Deployment\",\"currentPassIndex\":0,\"extendParams\":{},\"initialRevisions\":[\"20240815144312-310\",\"20240702150459-614\"],\"locator\":\"myapp-demo-test/default/apps/v1/Deployment\",\"apiVersion\":\"apps/v1\"}",
                                "deliveries": "---\napiVersion: \"apps/v1\"\nkind: \"Deployment\"\nmetadata:\n  name: \"myapp-demo-test\"\n  namespace: \"default\"\n  labels:\n    run: \"myapp-demo-test\"\nspec:\n  replicas: \"l\"\n  selector:\n    matchLabels:\n      run: \"myapp-demo-test\"\n  template:\n    metadata:\n      labels:\n        run: \"myapp-demo-test\"\n    spec:\n      containers:\n      - name: \"main\"\n        image: \"yunxiao-registry.cn-beijing.cr.aliyuncs.com/test/demo1:emoji-2024-06-18-15-22-45\"\n        ports:\n        - containerPort: 8080\n        resources:\n          limits:\n            cpu: 1\n            memory: \"1024Mi\"\n          requests:\n            cpu: 0.01\n            memory: \"32Mi\"\n",
                                "spec": "---\napiVersion: \"apps/v1\"\nkind: \"Deployment\"\nmetadata:\n  name: \"myapp-demo-test\"\n  namespace: \"default\"\n  labels:\n    run: \"myapp-demo-test\"\n    devops.aliyun.com/app-name: \"myapp-demo\"\n    devops.aliyun.com/env-name: \"test\"\n    devops.aliyun.com/version: \"20240815144312-310\"\n    devops.aliyun.com/org-id: \"620321f073741507cb7d0cfd\"\nspec:\n  replicas: \"l\"\n  selector:\n    matchLabels:\n      run: \"myapp-demo-test\"\n  template:\n    metadata:\n      labels:\n        run: \"myapp-demo-test\"\n        devops.aliyun.com/app-name: \"myapp-demo\"\n        devops.aliyun.com/env-name: \"test\"\n        devops.aliyun.com/version: \"20240815144312-310\"\n        devops.aliyun.com/org-id: \"620321f073741507cb7d0cfd\"\n    spec:\n      containers:\n      - name: \"main\"\n        image: \"yunxiao-registry.cn-beijing.cr.aliyuncs.com/test/demo1:emoji-2024-06-18-15-22-45\"\n        ports:\n        - containerPort: 8080\n        resources:\n          limits:\n            cpu: 1\n            memory: \"1024Mi\"\n          requests:\n            cpu: 0.01\n            memory: \"32Mi\"\n",
                                "engineTaskKey": "59bb15fb-3454-4d0b-8a15-41e943786ed7",
                                "engineTaskResultContent": "{\"typeKey\":\"Ade2@KUBERNETES\",\"deliverySn\":\"59bb15fb-3454-4d0b-8a15-41e943786ed7\",\"state\":\"FAILED\",\"userParam\":{\"X-Tenant-Id\":\"620321f073741507cb7d0cfd\",\"X-Operator-Id\":\"646dabc05ccc4ad1bc2a9e2f\",\"traceId\":\"1889cf906d064cb7861cefe989d5a5b5.794.17237041982184057\",\"typeKey\":\"Ade2@KUBERNETES\"},\"statistics\":{\"externalOrderId\":null,\"rolloutId\":null,\"strategy\":\"Batch\",\"currentPassIndex\":0,\"totalPasses\":2,\"passStatus\":\"FAILED\",\"overallStatus\":\"FAILED\",\"passStatistics\":null,\"overallStatistics\":null,\"batchStatisticList\":[{\"updatedReplicas\":20,\"desiredReplicas\":20},{\"updatedReplicas\":0,\"desiredReplicas\":100}],\"purgeStatistics\":null,\"lastPass\":false},\"podRevision\":{\"newRevisions\":[{\"name\":\"notExists-0\",\"status\":\"NotExists\",\"age\":\"2024-08-15T06:43:27Z\",\"deployGroupName\":null,\"namespace\":null,\"refWorkload\":null,\"revision\":\"20240815144312-310\"}],\"oldRevisions\":[{\"name\":\"myapp-demo-test-6655b7f48d-pmwbs\",\"status\":\"Running\",\"age\":\"2024-07-02T07:05:27Z\",\"deployGroupName\":null,\"namespace\":\"default\",\"refWorkload\":null,\"revision\":\"20240702150459-614\"},{\"name\":\"myapp-demo-test-6655b7f48d-hqqqc\",\"status\":\"Running\",\"age\":\"2024-07-02T07:05:59Z\",\"deployGroupName\":null,\"namespace\":\"default\",\"refWorkload\":null,\"revision\":\"20240702150459-614\"},{\"name\":\"myapp-demo-test-6655b7f48d-zhbj9\",\"status\":\"Running\",\"age\":\"2024-07-02T07:06:00Z\",\"deployGroupName\":null,\"namespace\":\"default\",\"refWorkload\":null,\"revision\":\"20240702150459-614\"}]},\"serviceBrief\":null,\"purgeStatistics\":null,\"callbackParams\":{},\"taskErrorMessages\":{\"Delivery[59bb15fb-3454-4d0b-8a15-41e943786ed7]\":\"Error occurs when preparing delivery[59bb15fb-3454-4d0b-8a15-41e943786ed7]: Cannot deserialize value of type `int` from String \\\"l\\\": not a valid `int` value\\n at [Source: (StringReader); line: 16, column: 13] (through reference chain: io.fabric8.kubernetes.api.model.apps.Deployment[\\\"spec\\\"]->io.fabric8.kubernetes.api.model.apps.DeploymentSpec[\\\"replicas\\\"])\"},\"snapshotType\":\"OSS\",\"snapshotKey\":\"620321f073741507cb7d0cfdc86e2410edae4b948e1f11b683954810\",\"uid\":null,\"info\":null,\"resourceType\":\"KUBERNETES\",\"typeKey\":\"Ade2@KUBERNETES\",\"engineTaskKey\":\"59bb15fb-3454-4d0b-8a15-41e943786ed7\",\"engineType\":\"Ade2\"}",
                                "orgId": "620321f073741507cb7d0cfd"
                            }
                        ]
                    }
                ],
                "type": "Deploy",
                "snapshot": {
                    "deployGroup": {
                        "name": "c8c18031145b74e20811ae8bb59cea7fb",
                        "displayName": "devops-pre-autotest-002",
                        "description": "",
                        "poolName": "default",
                        "appSelector": null,
                        "claimList": [
                            {
                                "sn": "1b516ad73f7947339d56d33656a6b95c",
                                "type": "ACK",
                                "instanceName": "c8c18031145b74e20811ae8bb59cea7fb",
                                "specMap": {},
                                "itemSnList": [],
                                "refType": null,
                                "refId": null
                            }
                        ],
                        "creator": "646dabc05ccc4ad1bc2a9e2f"
                    }
                }
            }
        ],
        "sn": "32468993abb14653ae9d86cf5d1cac98",
        "creator": "646dabc05ccc4ad1bc2a9e2f",
        "gmtCreate": 1723704199000,
        "sourceType": "CUSTOMIZE",
        "sourceSn": "646dabc05ccc4ad1bc2a9e2f",
        "id": "32468993abb14653ae9d86cf5d1cac98"
    }
}

2.4 应用编排

2.4.1 新建编排

Headers

{
    "X-AppStack-Event": "AppOrchestration",
    "X-AppStack-Action": "Create",
    "X-AppStack-Token": "your-secret-token",
    "X-AppStack-App": "myapp-demo"
}

Body

{
    "id": "c534abbceaad422fbb56ed7c53298675",
    "user": {
        "id": "646dabc05ccc4ad1bc2a9e2f",
        "name": null,
        "email": null,
        "userName": null,
        "staffId": null
    },
    "orgId": "60d54f3daccf2bbd6659f3ad",
    "time": "2024-07-29T07:10:27.934+00:00",
    "objectKind": "AppOrchestration",
    "objectAttributes": {
        "storageType": "BUILTIN",
        "app": {
            "name": "myapp-demo",
            "description": "这是一个测试应用",
            "status": null,
            "labelList": [],
            "favoured": false,
            "groupName": null,
            "creatorId": "646dabc05ccc4ad1bc2a9e2f",
            "gmtCreate": 1722236335000,
            "type": "APP"
        },
        "format": "MANIFEST",
        "suitableResourceTypes": [
            "KUBERNETES"
        ],
        "sn": "myapp-demo@KUBERNETES",
        "revision": {
            "sha": "73f3aa0a977946dbc79f948ba0933b1ab3962b2f",
            "message": "Initialize choreography",
            "author": "646dabc05ccc4ad1bc2a9e2f",
            "commitTime": 1722237027908
        },
        "name": "myapp-demo",
        "creatorId": "646dabc05ccc4ad1bc2a9e2f",
        "gmtCreate": 1722237027894,
        "modifierId": "646dabc05ccc4ad1bc2a9e2f",
        "gmtModified": 1722237027894,
        "description": null,
        "type": "AppBuiltInOrchestration",
        "labelPolicy": "NONE",
        "labelList": [],
        "syncSourceTemplate": null,
        "placeholderList": [
            {
                "name": "image.backend",
                "description": "后端服务镜像",
                "type": "string",
                "value": "NULL",
                "overridable": true,
                "rule": null,
                "valueSource": "CONSTANT",
                "predefined": true,
                "rsType": "KUBERNETES"
            },
            {
                "name": "envName",
                "description": "环境名",
                "type": "string",
                "value": "APPSTACK_ENV_NAME",
                "overridable": false,
                "rule": null,
                "valueSource": "VARIABLE",
                "predefined": true,
                "rsType": "KUBERNETES"
            },
            {
                "name": "namespace",
                "description": "命名空间",
                "type": "string",
                "value": "default",
                "overridable": true,
                "rule": null,
                "valueSource": "CONSTANT",
                "predefined": false,
                "rsType": "KUBERNETES"
            },
            {
                "name": "cpuLimit",
                "description": "CPU限制",
                "type": "string",
                "value": "1",
                "overridable": true,
                "rule": null,
                "valueSource": "CONSTANT",
                "predefined": false,
                "rsType": "KUBERNETES"
            },
            {
                "name": "memoryLimit",
                "description": "内存限制",
                "type": "string",
                "value": "1024Mi",
                "overridable": true,
                "rule": null,
                "valueSource": "CONSTANT",
                "predefined": false,
                "rsType": "KUBERNETES"
            },
            {
                "name": "cpuRequest",
                "description": "CPU请求",
                "type": "string",
                "value": "0.01",
                "overridable": true,
                "rule": null,
                "valueSource": "CONSTANT",
                "predefined": false,
                "rsType": "KUBERNETES"
            },
            {
                "name": "memoryRequest",
                "description": "内存请求",
                "type": "string",
                "value": "32Mi",
                "overridable": true,
                "rule": null,
                "valueSource": "CONSTANT",
                "predefined": false,
                "rsType": "KUBERNETES"
            }
        ],
        "componentList": [
            {
                "name": "demo-service",
                "kind": "Service",
                "description": "服务访问策略",
                "content": "---\napiVersion: v1\nkind: Service\nmetadata:\n  name: myapp-demo-{{ .AppStack.envName }}\n  # 命名空间配置:\n  # 建议每个环境使用不同的Kubernetes集群命名空间,以便达到环境隔离效果\n  # 部署时云效会将占位符{{ .Values.namespace }}替换成右侧设置的实际值\n  namespace: {{ .Values.namespace }}\nspec:\n  selector:\n    run: myapp-demo-{{ .AppStack.envName }}\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 8080",
                "priority": 1,
                "type": "KUBERNETES"
            },
            {
                "name": "demo-deployment",
                "kind": "Deployment",
                "description": "无状态应用",
                "content": "---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: myapp-demo-{{ .AppStack.envName }}\n  labels:\n    run: myapp-demo-{{ .AppStack.envName }}\n  # 命名空间配置:\n  # 建议每个环境使用不同的Kubernetes集群命名空间,以便达到环境隔离效果\n  # 部署时云效会将占位符{{ .Values.namespace }}替换成右侧设置的实际值\n  namespace: {{ .Values.namespace }}\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      run: myapp-demo-{{ .AppStack.envName }}\n  template:\n    metadata:\n      labels:\n        run: myapp-demo-{{ .AppStack.envName }}\n    spec:\n      containers:\n        - name: main\n          # 镜像配置:\n          # 部署时云效会将预置占位符{{ .AppStack.image.backend }}替换成实际部署时的镜像\n          # 支持在新建部署单时手动输入镜像地址,也支持接收流水线的上游构建产物\n          # 另外,在右侧镜像占位符处添加多个镜像,可以支持SideCar或InitContainer等多容器场景\n          image: {{ .AppStack.image.backend }}\n          # 端口配置:\n          ports:\n            - containerPort: 8080\n          # 资源规格配置:\n          # 当不同环境有不同的CPU或内存资源规格要求时,可以定义占位符搭配变量组使用\n          # 如,设置{{ .Values.cpuLimit }}占位符,部署时云效会将占位符{{ .Values.cpuLimit }}替换成右侧设置的实际值\n          resources:\n            limits:\n              cpu: {{ .Values.cpuLimit }}\n              memory: {{ .Values.memoryLimit }}\n            requests:\n              cpu: {{ .Values.cpuRequest }}\n              memory: {{ .Values.memoryRequest }}\n          # 生命周期配置:\n          #lifecycle:\n          #  preStop:\n          #    exec:\n          #      command: [ \"/bin/bash\", \"-c\", \"sleep 10\" ]\n          # 探活配置:\n          #livenessProbe:\n          #  initialDelaySeconds: 10\n          #  failureThreshold: 3\n          #  periodSeconds: 5\n          #  successThreshold: 1\n          #  timeoutSeconds: 2\n          #  httpGet:\n          #    scheme: HTTP\n          #    path: /health\n          #    port: 7002\n          # 就绪探测配置:\n          #readinessProbe:\n          #  initialDelaySeconds: 60\n          #  failureThreshold: 4\n          #  periodSeconds: 10\n          #  successThreshold: 1\n          #  timeoutSeconds: 3\n          #  httpGet:\n          #    scheme: HTTP\n          #    port: 7002\n          #    path: /health",
                "priority": 2,
                "type": "KUBERNETES"
            }
        ],
        "groupNameMap": {},
        "id": "myapp-demo@KUBERNETES"
    }
}

2.4.2 编排更新

Headers

{
    "X-AppStack-Event": "AppOrchestration",
    "X-AppStack-Action": "Update",
    "X-AppStack-Token": "your-secret-token",
    "X-AppStack-App": "myapp-demo"
}

Body

{
    "id": "4bcd40b2c1044260b2bd946b2195981d",
    "user": {
        "id": "646dabc05ccc4ad1bc2a9e2f",
        "name": null,
        "email": null,
        "userName": null,
        "staffId": null
    },
    "orgId": "60d54f3daccf2bbd6659f3ad",
    "time": "2024-07-29T07:14:47.991+00:00",
    "objectKind": "AppOrchestration",
    "objectAttributes": {
        "storageType": "BUILTIN",
        "app": {
            "name": "myapp-demo",
            "description": "这是一个测试应用",
            "status": null,
            "labelList": [],
            "favoured": false,
            "groupName": null,
            "creatorId": "646dabc05ccc4ad1bc2a9e2f",
            "gmtCreate": 1722236335000,
            "type": "APP"
        },
        "format": "MANIFEST",
        "suitableResourceTypes": [
            "KUBERNETES"
        ],
        "sn": "myapp-demo@KUBERNETES",
        "revision": {
            "sha": "7277190c92046cb56d4ba5941cbce4b78c11337c",
            "message": "修改端口号为8081",
            "author": "646dabc05ccc4ad1bc2a9e2f",
            "commitTime": 1722237287949
        },
        "name": "myapp-demo",
        "creatorId": "646dabc05ccc4ad1bc2a9e2f",
        "gmtCreate": 1722237028000,
        "modifierId": null,
        "gmtModified": null,
        "description": null,
        "type": "AppBuiltInOrchestration",
        "labelPolicy": "FROM_LABEL_BINDING",
        "labelList": [
            {
                "namespace": "default",
                "name": "envType",
                "value": "dev",
                "displayName": "环境级别",
                "displayValue": "开发环境",
                "extraMap": {}
            },
            {
                "namespace": "default",
                "name": "envType",
                "value": "test",
                "displayName": "环境级别",
                "displayValue": "测试环境",
                "extraMap": {}
            },
            {
                "namespace": "default",
                "name": "envType",
                "value": "prepub",
                "displayName": "环境级别",
                "displayValue": "预发环境",
                "extraMap": {}
            },
            {
                "namespace": "default",
                "name": "envType",
                "value": "production",
                "displayName": "环境级别",
                "displayValue": "生产环境",
                "extraMap": {}
            }
        ],
        "syncSourceTemplate": null,
        "placeholderList": [
            {
                "name": "image.backend",
                "description": "后端服务镜像",
                "type": "string",
                "value": "NULL",
                "overridable": true,
                "rule": null,
                "valueSource": "CONSTANT",
                "predefined": true,
                "rsType": "KUBERNETES"
            },
            {
                "name": "envName",
                "description": "环境名",
                "type": "string",
                "value": "APPSTACK_ENV_NAME",
                "overridable": false,
                "rule": null,
                "valueSource": "VARIABLE",
                "predefined": true,
                "rsType": "KUBERNETES"
            },
            {
                "name": "namespace",
                "description": "命名空间",
                "type": "string",
                "value": "default",
                "overridable": true,
                "rule": null,
                "valueSource": "CONSTANT",
                "predefined": false,
                "rsType": "KUBERNETES"
            },
            {
                "name": "cpuLimit",
                "description": "CPU限制",
                "type": "string",
                "value": "1",
                "overridable": true,
                "rule": null,
                "valueSource": "CONSTANT",
                "predefined": false,
                "rsType": "KUBERNETES"
            },
            {
                "name": "memoryLimit",
                "description": "内存限制",
                "type": "string",
                "value": "1024Mi",
                "overridable": true,
                "rule": null,
                "valueSource": "CONSTANT",
                "predefined": false,
                "rsType": "KUBERNETES"
            },
            {
                "name": "cpuRequest",
                "description": "CPU请求",
                "type": "string",
                "value": "0.01",
                "overridable": true,
                "rule": null,
                "valueSource": "CONSTANT",
                "predefined": false,
                "rsType": "KUBERNETES"
            },
            {
                "name": "memoryRequest",
                "description": "内存请求",
                "type": "string",
                "value": "32Mi",
                "overridable": true,
                "rule": null,
                "valueSource": "CONSTANT",
                "predefined": false,
                "rsType": "KUBERNETES"
            }
        ],
        "componentList": [
            {
                "name": "demo-service",
                "kind": "Service",
                "description": "服务访问策略",
                "content": "---\napiVersion: v1\nkind: Service\nmetadata:\n  name: myapp-demo-{{ .AppStack.envName }}\n  # 命名空间配置:\n  # 建议每个环境使用不同的Kubernetes集群命名空间,以便达到环境隔离效果\n  # 部署时云效会将占位符{{ .Values.namespace }}替换成右侧设置的实际值\n  namespace: {{ .Values.namespace }}\nspec:\n  selector:\n    run: myapp-demo-{{ .AppStack.envName }}\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 8081",
                "priority": 1,
                "type": "KUBERNETES"
            },
            {
                "name": "demo-deployment",
                "kind": "Deployment",
                "description": "无状态应用",
                "content": "---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: myapp-demo-{{ .AppStack.envName }}\n  labels:\n    run: myapp-demo-{{ .AppStack.envName }}\n  # 命名空间配置:\n  # 建议每个环境使用不同的Kubernetes集群命名空间,以便达到环境隔离效果\n  # 部署时云效会将占位符{{ .Values.namespace }}替换成右侧设置的实际值\n  namespace: {{ .Values.namespace }}\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      run: myapp-demo-{{ .AppStack.envName }}\n  template:\n    metadata:\n      labels:\n        run: myapp-demo-{{ .AppStack.envName }}\n    spec:\n      containers:\n        - name: main\n          # 镜像配置:\n          # 部署时云效会将预置占位符{{ .AppStack.image.backend }}替换成实际部署时的镜像\n          # 支持在新建部署单时手动输入镜像地址,也支持接收流水线的上游构建产物\n          # 另外,在右侧镜像占位符处添加多个镜像,可以支持SideCar或InitContainer等多容器场景\n          image: {{ .AppStack.image.backend }}\n          # 端口配置:\n          ports:\n            - containerPort: 8080\n          # 资源规格配置:\n          # 当不同环境有不同的CPU或内存资源规格要求时,可以定义占位符搭配变量组使用\n          # 如,设置{{ .Values.cpuLimit }}占位符,部署时云效会将占位符{{ .Values.cpuLimit }}替换成右侧设置的实际值\n          resources:\n            limits:\n              cpu: {{ .Values.cpuLimit }}\n              memory: {{ .Values.memoryLimit }}\n            requests:\n              cpu: {{ .Values.cpuRequest }}\n              memory: {{ .Values.memoryRequest }}\n          # 生命周期配置:\n          #lifecycle:\n          #  preStop:\n          #    exec:\n          #      command: [ \"/bin/bash\", \"-c\", \"sleep 10\" ]\n          # 探活配置:\n          #livenessProbe:\n          #  initialDelaySeconds: 10\n          #  failureThreshold: 3\n          #  periodSeconds: 5\n          #  successThreshold: 1\n          #  timeoutSeconds: 2\n          #  httpGet:\n          #    scheme: HTTP\n          #    path: /health\n          #    port: 7002\n          # 就绪探测配置:\n          #readinessProbe:\n          #  initialDelaySeconds: 60\n          #  failureThreshold: 4\n          #  periodSeconds: 10\n          #  successThreshold: 1\n          #  timeoutSeconds: 3\n          #  httpGet:\n          #    scheme: HTTP\n          #    port: 7002\n          #    path: /health",
                "priority": 2,
                "type": "KUBERNETES"
            }
        ],
        "groupNameMap": {},
        "id": "myapp-demo@KUBERNETES"
    }
}

2.4.3 删除编排

Headers

{
    "X-AppStack-Event": "AppOrchestration",
    "X-AppStack-Action": "Delete",
    "X-AppStack-Token": "your-secret-token",
    "X-AppStack-App": "myapp-demo"
}

Body

{
    "id": "0001408e7e4743748a891beb6d3d87ae",
    "user": {
        "id": "646dabc05ccc4ad1bc2a9e2f",
        "name": null,
        "email": null,
        "userName": null,
        "staffId": null
    },
    "orgId": "60d54f3daccf2bbd6659f3ad",
    "time": "2024-07-29T07:17:31.418+00:00",
    "objectKind": "AppOrchestration",
    "objectAttributes": {
        "storageType": "BUILTIN",
        "app": {
            "name": "myapp-demo",
            "description": "这是建立于2024年07月29日的应用",
            "status": null,
            "labelList": [],
            "favoured": false,
            "groupName": null,
            "creatorId": "646dabc05ccc4ad1bc2a9e2f",
            "gmtCreate": 1722236335000,
            "type": "APP"
        },
        "format": "MANIFEST",
        "suitableResourceTypes": [
            "KUBERNETES"
        ],
        "sn": "myapp-demo@KUBERNETES",
        "revision": {
            "sha": "7277190c92046cb56d4ba5941cbce4b78c11337c",
            "message": "修改端口号为8081",
            "author": "646dabc05ccc4ad1bc2a9e2f",
            "commitTime": 1722237287949
        },
        "name": "myapp-demo",
        "creatorId": "646dabc05ccc4ad1bc2a9e2f",
        "gmtCreate": 1722237288000,
        "modifierId": "646dabc05ccc4ad1bc2a9e2f",
        "gmtModified": 1722237288000,
        "description": null,
        "type": "AppBuiltInOrchestration",
        "labelPolicy": "FROM_LABEL_BINDING",
        "labelList": [
            {
                "namespace": "default",
                "name": "envType",
                "value": "dev",
                "displayName": "环境级别",
                "displayValue": "开发环境",
                "extraMap": {}
            },
            {
                "namespace": "default",
                "name": "envType",
                "value": "test",
                "displayName": "环境级别",
                "displayValue": "测试环境",
                "extraMap": {}
            },
            {
                "namespace": "default",
                "name": "envType",
                "value": "production",
                "displayName": "环境级别",
                "displayValue": "生产环境",
                "extraMap": {}
            },
            {
                "namespace": "default",
                "name": "envType",
                "value": "prepub",
                "displayName": "环境级别",
                "displayValue": "预发环境",
                "extraMap": {}
            }
        ],
        "syncSourceTemplate": null,
        "placeholderList": [
            {
                "name": "image.backend",
                "description": "后端服务镜像",
                "type": "string",
                "value": "NULL",
                "overridable": true,
                "rule": null,
                "valueSource": "CONSTANT",
                "predefined": true,
                "rsType": "KUBERNETES"
            },
            {
                "name": "envName",
                "description": "环境名",
                "type": "string",
                "value": "APPSTACK_ENV_NAME",
                "overridable": false,
                "rule": null,
                "valueSource": "VARIABLE",
                "predefined": true,
                "rsType": "KUBERNETES"
            },
            {
                "name": "namespace",
                "description": "命名空间",
                "type": "string",
                "value": "default",
                "overridable": true,
                "rule": null,
                "valueSource": "CONSTANT",
                "predefined": false,
                "rsType": "KUBERNETES"
            },
            {
                "name": "cpuLimit",
                "description": "CPU限制",
                "type": "string",
                "value": "1",
                "overridable": true,
                "rule": null,
                "valueSource": "CONSTANT",
                "predefined": false,
                "rsType": "KUBERNETES"
            },
            {
                "name": "memoryLimit",
                "description": "内存限制",
                "type": "string",
                "value": "1024Mi",
                "overridable": true,
                "rule": null,
                "valueSource": "CONSTANT",
                "predefined": false,
                "rsType": "KUBERNETES"
            },
            {
                "name": "cpuRequest",
                "description": "CPU请求",
                "type": "string",
                "value": "0.01",
                "overridable": true,
                "rule": null,
                "valueSource": "CONSTANT",
                "predefined": false,
                "rsType": "KUBERNETES"
            },
            {
                "name": "memoryRequest",
                "description": "内存请求",
                "type": "string",
                "value": "32Mi",
                "overridable": true,
                "rule": null,
                "valueSource": "CONSTANT",
                "predefined": false,
                "rsType": "KUBERNETES"
            }
        ],
        "componentList": [
            {
                "name": "demo-service",
                "kind": "Service",
                "description": "服务访问策略",
                "content": "---\napiVersion: v1\nkind: Service\nmetadata:\n  name: myapp-demo-{{ .AppStack.envName }}\n  # 命名空间配置:\n  # 建议每个环境使用不同的Kubernetes集群命名空间,以便达到环境隔离效果\n  # 部署时云效会将占位符{{ .Values.namespace }}替换成右侧设置的实际值\n  namespace: {{ .Values.namespace }}\nspec:\n  selector:\n    run: myapp-demo-{{ .AppStack.envName }}\n  ports:\n    - protocol: TCP\n      port: 80\n      targetPort: 8081",
                "priority": 1,
                "type": "KUBERNETES"
            },
            {
                "name": "demo-deployment",
                "kind": "Deployment",
                "description": "无状态应用",
                "content": "---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: myapp-demo-{{ .AppStack.envName }}\n  labels:\n    run: myapp-demo-{{ .AppStack.envName }}\n  # 命名空间配置:\n  # 建议每个环境使用不同的Kubernetes集群命名空间,以便达到环境隔离效果\n  # 部署时云效会将占位符{{ .Values.namespace }}替换成右侧设置的实际值\n  namespace: {{ .Values.namespace }}\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      run: myapp-demo-{{ .AppStack.envName }}\n  template:\n    metadata:\n      labels:\n        run: myapp-demo-{{ .AppStack.envName }}\n    spec:\n      containers:\n        - name: main\n          # 镜像配置:\n          # 部署时云效会将预置占位符{{ .AppStack.image.backend }}替换成实际部署时的镜像\n          # 支持在新建部署单时手动输入镜像地址,也支持接收流水线的上游构建产物\n          # 另外,在右侧镜像占位符处添加多个镜像,可以支持SideCar或InitContainer等多容器场景\n          image: {{ .AppStack.image.backend }}\n          # 端口配置:\n          ports:\n            - containerPort: 8080\n          # 资源规格配置:\n          # 当不同环境有不同的CPU或内存资源规格要求时,可以定义占位符搭配变量组使用\n          # 如,设置{{ .Values.cpuLimit }}占位符,部署时云效会将占位符{{ .Values.cpuLimit }}替换成右侧设置的实际值\n          resources:\n            limits:\n              cpu: {{ .Values.cpuLimit }}\n              memory: {{ .Values.memoryLimit }}\n            requests:\n              cpu: {{ .Values.cpuRequest }}\n              memory: {{ .Values.memoryRequest }}\n          # 生命周期配置:\n          #lifecycle:\n          #  preStop:\n          #    exec:\n          #      command: [ \"/bin/bash\", \"-c\", \"sleep 10\" ]\n          # 探活配置:\n          #livenessProbe:\n          #  initialDelaySeconds: 10\n          #  failureThreshold: 3\n          #  periodSeconds: 5\n          #  successThreshold: 1\n          #  timeoutSeconds: 2\n          #  httpGet:\n          #    scheme: HTTP\n          #    path: /health\n          #    port: 7002\n          # 就绪探测配置:\n          #readinessProbe:\n          #  initialDelaySeconds: 60\n          #  failureThreshold: 4\n          #  periodSeconds: 10\n          #  successThreshold: 1\n          #  timeoutSeconds: 3\n          #  httpGet:\n          #    scheme: HTTP\n          #    port: 7002\n          #    path: /health",
                "priority": 2,
                "type": "KUBERNETES"
            }
        ],
        "groupNameMap": {},
        "id": "myapp-demo@KUBERNETES"
    }
}

2.5 变量组

2.5.1 新建变量组

Headers

{
    "X-AppStack-Event": "VariableGroup",
    "X-AppStack-Action": "Create",
    "X-AppStack-Token": "your-secret-token",
    "X-AppStack-App": "myapp-demo"
}

Body

{
    "id": "2704eec852c6496293fbbd57a3756769",
    "user": {
        "id": "646dabc05ccc4ad1bc2a9e2f",
        "name": null,
        "email": null,
        "userName": null,
        "staffId": null
    },
    "orgId": "60d54f3daccf2bbd6659f3ad",
    "time": "2024-07-29T07:00:28.327+00:00",
    "objectKind": "VariableGroup",
    "objectAttributes": {
        "name": "test-vars",
        "displayName": "测试环境变量组",
        "vars": [],
        "id": "test-vars"
    }
}

2.5.2 变量组更新

Headers

{
    "X-AppStack-Event": "VariableGroup",
    "X-AppStack-Action": "Update",
    "X-AppStack-Token": "your-secret-token",
    "X-AppStack-App": "myapp-demo"
}

Body

{
    "id": "a8488254b29d4b8e97c2f8b45b84f14b",
    "user": {
        "id": "646dabc05ccc4ad1bc2a9e2f",
        "name": null,
        "email": null,
        "userName": null,
        "staffId": null
    },
    "orgId": "60d54f3daccf2bbd6659f3ad",
    "time": "2024-07-29T07:02:23.656+00:00",
    "objectKind": "VariableGroup",
    "objectAttributes": {
        "name": "test-vars",
        "displayName": "测试环境变量组",
        "vars": [
            {
                "key": "key1",
                "value": "value1",
                "description": "这是变量1"
            },
            {
                "key": "key2",
                "value": "value2",
                "description": "这是变量2"
            }
        ],
        "id": "test-vars"
    }
}

2.5.3 删除变量组

Headers

{
    "X-AppStack-Event": "VariableGroup",
    "X-AppStack-Action": "Delete",
    "X-AppStack-Token": "your-secret-token",
    "X-AppStack-App": "myapp-demo"
}

Body

{
    "id": "34483737e03746d6a0e60f5b767a9f24",
    "user": {
        "id": "646dabc05ccc4ad1bc2a9e2f",
        "name": null,
        "email": null,
        "userName": null,
        "staffId": null
    },
    "orgId": "60d54f3daccf2bbd6659f3ad",
    "time": "2024-07-29T07:03:40.665+00:00",
    "objectKind": "VariableGroup",
    "objectAttributes": {
        "name": "test-vars",
        "displayName": "测试环境变量组",
        "vars": [
            {
                "key": "key1",
                "value": "value1",
                "description": "这是变量1"
            },
            {
                "key": "key2",
                "value": "value2",
                "description": "这是变量2"
            }
        ],
        "id": "test-vars"
    }
}

2.6 变更

2.6.1 新建变更

Headers

{
    "X-AppStack-Event": "ChangeRequest",
    "X-AppStack-Action": "Create",
    "X-AppStack-Token": "your-secret-token",
    "X-AppStack-App": "myapp-demo"
}

Body

{
    "id": "8379c68b025c4dd0bf04dc8279bdad3e",
    "user": {
        "id": "646dabc05ccc4ad1bc2a9e2f",
        "name": null,
        "email": null,
        "userName": null,
        "staffId": null
    },
    "orgId": "630de053ca912501d6c92e10",
    "time": "2024-07-29T11:58:33.961+00:00",
    "objectKind": "ChangeRequest",
    "objectAttributes": {
        "sn": "c7ae55830f9043cd971f872282bdbc2e",
        "appName": "myapp-demo",
        "state": "DEVELOPING",
        "name": "日常变更001",
        "type": "APP",
        "appCodeRepoSn": "0f90e45370474414bd63bf2a9908042d",
        "appCodeRepo": {
            "sn": "0f90e45370474414bd63bf2a9908042d",
            "appName": "myapp-demo",
            "name": "myapp-demo",
            "repoUrl": "https://codeup.aliyun.com/630de053ca912501d6c92e10/myapp-demo.git",
            "identifier": "myapp_demo",
            "repoContext": {
                "repoUrl": "https://codeup.aliyun.com/630de053ca912501d6c92e10/myapp-demo.git",
                "projectId": "4536398",
                "defaultBranch": "master",
                "repoType": "CODEUP"
            },
            "connectionConfig": {
                "connectionId": "641004",
                "connectionType": "FLOW"
            }
        },
        "branch": "feature/20240729_001",
        "ownerId": "646dabc05ccc4ad1bc2a9e2f",
        "originBranch": "master",
        "originBranchRevision": "2d26ea0ada1317ce95ef0c5307c4bc234621e94e",
        "creatorId": "646dabc05ccc4ad1bc2a9e2f",
        "gmtCreate": 1722254314000,
        "gmtModified": 1722254314000,
        "extInfo": {
            "repoUrl": "https://codeup.aliyun.com/630de053ca912501d6c92e10/myapp-demo.git",
            "repoType": "CODEUP",
            "appCodeRepo": {
                "sn": "0f90e45370474414bd63bf2a9908042d",
                "appName": "myapp-demo",
                "name": "myapp-demo",
                "repoUrl": "https://codeup.aliyun.com/630de053ca912501d6c92e10/myapp-demo.git",
                "identifier": "myapp_demo",
                "repoContext": {
                    "repoUrl": "https://codeup.aliyun.com/630de053ca912501d6c92e10/myapp-demo.git",
                    "projectId": "4536398",
                    "defaultBranch": "master",
                    "repoType": "CODEUP"
                },
                "connectionConfig": {
                    "connectionId": "641004",
                    "connectionType": "FLOW"
                }
            },
            "autoDeleteBranchWhenEnd": false
        },
        "id": "c7ae55830f9043cd971f872282bdbc2e"
    }
}

2.6.2 变更状态更新

Headers

{
    "X-AppStack-Event": "ChangeRequest",
    "X-AppStack-Action": "StatusUpdate",
    "X-AppStack-Token": "your-secret-token",
    "X-AppStack-App": "myapp-demo"
}

Body

{
    "id": "db926f9a92d64884b50401f7a19f8aa4",
    "user": {
        "id": "646dabc05ccc4ad1bc2a9e2f",
        "name": null,
        "email": null,
        "userName": null,
        "staffId": null
    },
    "orgId": "630de053ca912501d6c92e10",
    "time": "2024-07-29T12:00:53.660+00:00",
    "objectKind": "ChangeRequest",
    "objectAttributes": {
        "sn": "c7ae55830f9043cd971f872282bdbc2e",
        "appName": "myapp-demo",
        "state": "INTEGRATING",
        "name": "日常变更001",
        "type": "APP",
        "appCodeRepoSn": "0f90e45370474414bd63bf2a9908042d",
        "appCodeRepo": {
            "sn": "0f90e45370474414bd63bf2a9908042d",
            "appName": "myapp-demo",
            "name": "myapp-demo",
            "repoUrl": "https://codeup.aliyun.com/630de053ca912501d6c92e10/myapp-demo.git",
            "identifier": "myapp_demo",
            "repoContext": {
                "repoUrl": "https://codeup.aliyun.com/630de053ca912501d6c92e10/myapp-demo.git",
                "projectId": "4536398",
                "defaultBranch": "master",
                "repoType": "CODEUP"
            },
            "connectionConfig": {
                "connectionId": "641004",
                "connectionType": "FLOW"
            }
        },
        "branch": "feature/20240729_001",
        "ownerId": "646dabc05ccc4ad1bc2a9e2f",
        "originBranch": "master",
        "originBranchRevision": "2d26ea0ada1317ce95ef0c5307c4bc234621e94e",
        "creatorId": "646dabc05ccc4ad1bc2a9e2f",
        "gmtCreate": 1722254314000,
        "gmtModified": 1722254454000,
        "extInfo": {
            "repoUrl": "https://codeup.aliyun.com/630de053ca912501d6c92e10/myapp-demo.git",
            "repoType": "CODEUP",
            "appCodeRepo": {
                "sn": "0f90e45370474414bd63bf2a9908042d",
                "appName": "myapp-demo",
                "name": "myapp-demo",
                "repoUrl": "https://codeup.aliyun.com/630de053ca912501d6c92e10/myapp-demo.git",
                "identifier": "myapp_demo",
                "repoContext": {
                    "repoUrl": "https://codeup.aliyun.com/630de053ca912501d6c92e10/myapp-demo.git",
                    "projectId": "4536398",
                    "defaultBranch": "master",
                    "repoType": "CODEUP"
                },
                "connectionConfig": {
                    "connectionId": "641004",
                    "connectionType": "FLOW"
                }
            },
            "autoDeleteBranchWhenEnd": false
        },
        "id": "c7ae55830f9043cd971f872282bdbc2e"
    }
}

2.7 研发阶段

2.7.1 研发流程阶段运行状态更新

Headers

{
    "X-AppStack-Event": "ReleaseStageExecution",
    "X-AppStack-Action": "StatusUpdate",
    "X-AppStack-Token": "your-secret-token",
    "X-AppStack-App": "myapp-demo"
}

Body

{
    "id": "3c532fe73219406ca883a503a20e290d",
    "user": {
        "id": "646dabc05ccc4ad1bc2a9e2f",
        "name": null,
        "email": null,
        "userName": null,
        "staffId": null
    },
    "orgId": "630de053ca912501d6c92e10",
    "time": "2024-07-29T12:13:36.704+00:00",
    "objectKind": "ReleaseStageExecution",
    "objectAttributes": {
        "sn": "a2bcdeda7d3e4075bf42bca731e02998",
        "releaseStageSn": "b1af381ea4f24a8e88b6963dbc6c2799",
        "engineType": "FlowV1",
        "engineInstanceId": "3367719:2",
        "state": "RUNNING",
        "context": {
            "version": "v1",
            "releaseStageLabels": [
                {
                    "namespace": "default",
                    "name": "envType",
                    "value": "test",
                    "displayName": "环境级别",
                    "displayValue": "测试环境",
                    "extraMap": {}
                }
            ],
            "triggerMode": "MANUAL",
            "startTime": null,
            "endTime": null
        },
        "id": "a2bcdeda7d3e4075bf42bca731e02998"
    }
}