获取构建状态

更新时间:
复制 MD 格式

查询模版的镜像构建状态。构建状态变为 ready 后才能基于该模版创建实例。

前提

已完成 Endpoint 与鉴权配置,详见API 总览与认证。

接口

GET/templates/{templateCode}/builds/{buildID}/status

查询模版的镜像构建状态。兼容路由 GET /templates/{templateCode}/builds/{buildID}。buildID 来自创建/更新模版接口的响应。构建状态变为 ready 后才能基于该模版创建实例。

路径参数

templateCodestring必填

模版唯一 code(即 templateID)

buildIDstring必填

构建 ID,来自创建/更新模版接口的响应

响应字段

templateIDstring

模版 ID

buildIDstring

构建 ID

statusstring

构建状态,取值为 building、ready、error。最终为 ready;失败时为 error

logsarray<string>

构建日志

logEntriesarray<object>

结构化构建日志条目

reasonobject

构建失败原因;成功时省略。子字段 code(string,失败原因码,例如 InvalidArgument)、message(string,失败原因说明)

请求示例

curl -X GET "$BASE_URL/templates/your-template-id/builds/your-build-id/status" \
  -H "Authorization: Bearer $BAILIAN_API_KEY"

其中 BASE_URL 为 https://{workspace_id}.cn-beijing.maas.aliyuncs.com/api/v1/agentstudio/sandbox,BAILIAN_API_KEY 为阿里云百炼 API Key。

响应示例

构建失败时返回 reason 对象说明失败原因。

{
  "templateID": "your-template-id",
  "buildID": "your-build-id",
  "status": "ready",
  "logs": ["build started", "build finished"],
  "logEntries": []
}