首页 > 解决方案 > 如何使用 CLI 检索部署到 AppEngine 的所有 Git 提交 SHA-1 哈希?

问题描述

此处GCP 控制台的 AppEngine 部分中的“版本”页面显示了一个表格,其中包含git commit已为给定 AppEngine 服务部署的所有 SHA-1 哈希值。

如何使用gcloudCLI 显示此列表?

标签: google-app-enginegoogle-cloud-platformgcloud

解决方案


您可以使用CLI中的app组生成要查找的表。gcloud

这是一个带有一些格式和 asc 的示例表。排序:

gcloud app versions list \
--format="table[box](last_deployed_time.datetime:label=DEPLOYED, version.id:label=GIT_COMMIT_HASH)" \
--service=$GAE_SERVICE_NAME \
--sort-by=DEPLOYED

#=>

┌───────────────────────────┬──────────────────────────────────────────┐
│          DEPLOYED         │             GIT_COMMIT_HASH              │
├───────────────────────────┼──────────────────────────────────────────┤
│ 1970-01-01 00:00:00-00:00 │ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx │
│           . . .           │                  . . .                   │
│           . . .           │                  . . .                   │
│           . . .           │                  . . .                   │
│ 1970-01-01 00:00:01-00:00 │ yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy │
└───────────────────────────┴──────────────────────────────────────────┘

推荐阅读