【发布时间】:2021-12-30 07:43:36
【问题描述】:
如何在 Cloud Build 中使用自定义构建器映像,该映像存储在 Artifact Registry(而不是 Container Registry)的存储库中?
我在 Cloud Build 中设置了一个管道,其中一些 python 代码使用官方 python 图像执行。由于我想缓存我的 python 依赖项,所以我想创建一个自定义 Cloud Builder,如官方文档 here 所示。
GCP 明确指示切换到 Artifact Registry,因为 Container Registry 将被前者取代。因此,我已将 docker 映像推送到 Artifact Registry。我还向我的 Cloud Builder 服务帐户授予了 Artifact Registry 的读取权限。
像这样在 Cloud Build 步骤中使用映像
steps:
- name: 'europe-west3-docker.pkg.dev/xxxx/yyyy:latest'
id: install_dependencies
entrypoint: pip
args: ["install", "-r", "requirements.txt", "--user"]
抛出以下错误
步骤#0 - “install_dependencies”:拉取镜像:europe-west3-docker.pkg.dev/xxxx/yyyy:latest 步骤 #0 - “install_dependencies”:来自守护进程的错误响应: europe-west3-docker.pkg.dev/xxxx/yyyy 的清单:未找到最新的:清单未知:未找到请求的实体。
“xxxx”是存储库名称,“yyyy”是我的镜像名称。标签“最新”存在。 我可以在本地拉取图像并访问存储库。
我找不到任何关于如何从 Artifact Registry 集成这些图像的文档。只有this official guide,其中的镜像是使用来自 Container Registry 的 Docker 镜像构建的——但这不应该是未来的证明。
【问题讨论】:
标签: google-cloud-platform google-cloud-build cloudbuild.yaml google-artifact-registry