google-cloud-platform - Gcloud 的功能从 shell 到 cloudbuild.yaml 不同
问题描述
我一直在尝试列出 gcloud 上的所有 API 网关配置,但发生了一些错误。
当我在用户登录的情况下在终端上运行以下命令时,它就像一个魅力。
gcloud api-gateway api-configs list --api=$API --project=$PROJECT_ID --format="table(name)"
但是当我从这个 cloudbuild.yaml 中运行相同的命令时
steps:
- name: "gcr.io/google.com/cloudsdktool/cloud-sdk"
entrypoint: "bash"
args:
- "-c"
- |
gcloud api-gateway api-configs list --api=logistics-homolog --project=$PROJECT_ID \
--filter=serviceConfigId:logistics-mobile-places-* --format="table(name)"
它给了我以下错误:
ERROR: (gcloud.api-gateway.api-configs.list) PERMISSION_DENIED: Permission 'apigateway.apiconfigs.list' denied on 'projects/$PROJECT_ID/locations/global/apis/logistics-homolog/configs'
它出什么问题了?!
解决方案
您没有包含足够的信息,但很可能您没有gcloud
在容器中进行身份验证。
查看镜像的 repo 文档,了解如何对容器镜像进行身份验证;
推荐阅读
- ios - 将 JSON 数据与单元格一起使用
- graphql - 使用 apollo graphql 客户端记录请求时间的正确方法是什么?
- reactjs - 在由上下文 API 管理的状态旁边维护类中的状态是否有意义?
- json - 尽管有足够的内存用于执行和缓存,为什么 spark 无法读取大型 JSON 文本文件?
- unreal-engine4 - 演员有标签为我的比较返回假
- python - python类中的方法重命名有什么作用?
- javascript - “无法读取未定义的属性'sendMessage'”在一个调用中被抛出,但在另一个调用中没有抛出(而且它们几乎彼此相邻)
- python - 在 tensorflow 中使用 import_meta_graph 时使用动态 input_map
- r - 条形图可视化的重复代码
- c# - 为什么 Visual Studio Code 没有针对 Unity 关键字(例如 transform 或 Vector3)的智能感知?