检索旧版本的Google Cloud函数源

检索旧版本的Google Cloud函数源

问题描述:

我不小心丢失了最新的云功能源文件,然后使用旧版本再次部署了云功能.

I accidentally lost my up to date source file of a cloud function and then deployed again the cloud function with an old version of it.

每次部署云功能时,我都会在控制台上看到部署的版本ID.

Each time I deploy a cloud function I see on the console the version id of the deploy.

我可以做些什么来回滚到源文件的先前版本吗?

Is there something I can do to roll back to the previous version of the source file?

我终于知道了:

每次部署到云功能时,都会得到如下所示的输出行:

Each time you make a deploy to a cloud function you get an output line like this:

sourceArchiveUrl:gs://my-store-bucket/us-central1-function_name-xxoxtdxvxaxx.zip

sourceArchiveUrl: gs://my-store-bucket/us-central1-function_name-xxoxtdxvxaxx.zip

我进入了Google Cloud Platform开发者控制台->云功能-> function_name->源标签

I entered my Google Cloud Platform Developer Console -> Cloud Functions -> function_name -> Source tab

几乎在底部显示: 来源位置

and there almost at the bottom it says: Source location

my-store-bucket/us-central1-function_name-xxoxtdxvxaxx.zip

my-store-bucket/us-central1-function_name-xxoxtdxvxaxx.zip

与CLI中显示的相同,但没有gs:// 该链接将我引导至以下位置: https://storage.cloud.google.com/my- store-bucket/us-central1-function_name- ........

the same as it was shown in the CLI, but without gs:// that link lead me to the following: https://storage.cloud.google.com/my-store-bucket/us-central1-function_name-........

我从链接中删除了之后的所有内容

I removed from the link everything that came after

https://storage.cloud.google.com/my-store-bucket

这使我得到了一个庞大的文件列表,每个文件代表我每次进行部署时在我所需要的所有云功能的映像!

and that lead me to a huge list of files that each one of them represented a an image of all my cloud functions at the time point of each time i have made a deploy, exactly what i needed!

剩下要做的就是找到我误部署之前的最后一个文件

The only thing left to do was to locate the file with the last date before my mistaken deploy