【发布时间】:2018-05-08 20:32:14
【问题描述】:
我正在使用 Container Builder 来处理巨大的 JSON 文件并对其进行转换。如here 所述,很有可能以非标准方式使用它。
是否可以触发容器构建器构建并通过云函数将参数传递给它?这将允许对 GCS 中新上传的文件进行操作,并通过容器构建器自动处理它们。
目前我正在尝试使用 REST API 来触发它(我是 Node.js 的新手),但我的 URL 上出现了 404。我正在一个具有完整 API 访问权限的 Cloud Shell 实例上进行开发。
我试图通过PUT 请求和包含成功运行cloudbuild.yaml 的JSON 等效项的JSON 正文触发的URL 是:https://cloudbuild.googleapis.com/v1/projects/[PROJECT_ID]/builds
我正在使用 Node.js 的请求库:
request({ url: "https://cloudbuild.googleapis.com/v1/projects/[PROJECT_ID]/builds",
method: 'PUT',
json: {"steps":[{"name":"gcr.io/cloud-builders/gsutil",(...),
function(error, response, body){
console.log(error)
console.log(response)
console.log(body)
})
【问题讨论】:
标签: google-cloud-functions google-container-builder