【发布时间】:2020-03-17 01:14:39
【问题描述】:
我有一个在 Google App Engine 上运行的项目,为了部署它,我有一个连接到 GitHub webhook 的 GCloud 构建。每当我推送到我的主分支时,它都会部署。
虽然我最近一直遇到这个错误,但实际上我大部分时间都在使用它。只有一小段时间成功运作,我不知道为什么。导致失败的提交与任何 Google Cloud 配置无关。对于每个失败的构建,该错误都会显示:
invalid build: invalid image name "gcr.io/sam-api-267023/https://sam-api-267023.appspot.com/:a83bcce15e7329d9925cda40a17a9f588afe478f": could not parse reference: gcr.io/sam-api-267023/https://sam-api-267023.appspot.com/:a83bcce15e7329d9925cda40a17a9f588afe478f
我尝试重新格式化我的 .yaml 文件以匹配 Google Cloud 的建议,但它不起作用。我已经看到 yaml 使用在线 yaml 验证器是有效的。
这里是我的 cloudbuild.yaml 文件的来源:
步骤:
- name: "gcr.io/cloud-builders/docker"
args:
[
"build",
"-t",
"gcr.io/$PROJECT_ID/https://sam-api-267023.appspot.com/:$COMMIT_SHA",
".",
]
- name: "gcr.io/cloud-builders/docker"
args:
[
"push",
"gcr.io/$PROJECT_ID/https://sam-api-267023.appspot.com/:$COMMIT_SHA",
]
- name: "gcr.io/cloud-builders/gcloud"
args:
[
"run",
"deploy",
"https://sam-api-267023.appspot.com/",
"--image",
"gcr.io/$PROJECT_ID/https://sam-api-267023.appspot.com/:$COMMIT_SHA",
"--region",
"us-east4",
"--platform",
"managed",
]
images: ["gcr.io/$PROJECT_ID/https://sam-api-267023.appspot.com/:$COMMIT_SHA"]
【问题讨论】:
-
Docker 镜像名称不正确。它的格式不正确。
gcr.io/$PROJECT_ID/imagename:tag图像名称没有https://...的东西。 -
您所面临的错误有一些可能的原因。例如,它可以是用于定位您的图像的路径,或者即使您提供了所需的身份验证,也可以是构建在 Google 方面正确执行的路径。考虑到这一点,我建议您查看以下文章,您可以在其中找到更多信息和类似案例,这可能会帮助您解决所面临的错误。 - Google cloud build fails when using image from the marketplace - [无效的基础镜像名称“gcr.io/goog
标签: node.js google-app-engine google-cloud-platform google-cloud-build