简体   繁体   English

如何找到 gcloud 上部署的分支(git hash)?

[英]How do I find what branch (git hash) is deployed on gcloud?

I've been given a nodejs API server project that was deployed to gcloud, but I have no idea what "version" is deployed there.我得到了一个部署到 gcloud 的 nodejs API 服务器项目,但我不知道那里部署了什么“版本”。 That is to say I need to determine if a specific git branch has been deployed to a specific environment.也就是说我需要判断一个特定的git分支是否已经部署到了特定的环境中。

The version in package.json was not regularly updated. package.json中的版本没有定期更新。

I tried this:我试过这个:

$ gcloud app versions describe 20220324t175829 --service default --project myproject

I got the version by listing the versions on gcloud and using the last deployed.我通过列出 gcloud 上的版本并使用最后部署的版本来获得版本。 I see hashes for each file deployed, but those aren't git commit hashes as far as I can tell.我看到部署的每个文件的哈希值,但据我所知,这些不是 git commit 哈希值。

Is there a way to determine this?有没有办法确定这一点?

As @torek mentioned gcloud deployment need not be anything that was ever in a Git repository, and in general it will contain at least one thing that was never in Git.正如@torek 提到的那样,gcloud 部署不必是 Git 存储库中的任何东西,而且通常它至少会包含 Git 中从未有过的东西。 It therefore doesn't have a Git hash ID of its own.因此它没有自己的 Git 哈希 ID。 If the thing being deployed has a version-dump operation, use that;如果正在部署的东西有版本转储操作,请使用它; if that dumps a Git version, use that in turn to find the Git version.如果它转储了 Git 版本,则依次使用它来查找 Git 版本。 But otherwise there's no general solution.但除此之外,没有通用的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM