How do I retrieve my App Engine app's source code from the `gcloud` tool?

≡放荡痞女 提交于 2019-12-06 14:05:34

问题


I've migrated to a new system and lost my local copy of my App Engine app. Foolishly, I didn't use source control.

I know I've used the gcloud tool to retrieve the source code of my project in the past, but I don't seem to be able to find how to do it again. Everything I find points toward how to use appcfg.py, which didn't come with gcloud. I know I've used gcloud for this purpose before with no issues, though, so I'm perplexed as to how I can't find the command anymore.

Furthermore, this answer about using Cloud Build doesn't work for me - Cloud Build was not and is not enabled.


回答1:


In the past, one was able to download the source code for the deployed app using the command:

gcloud preview app modules download default --version app_version --output-dir=my_dir

(see this thread gcloud: how to download the app via cli).

However, the command gcloud preview app modules download has since been deprecated (as Zachary Newman relayed here - see also the Google Cloud SDK Release Notes for version 92.0.0 (2016-1-13) in the “Breaking Changes” section: “Removed deprecated gcloud preview app modules download command.”).

Currently, appcfg.py is the recommended way to go, and you can invoke that command either:

  • from the Cloud Shell, or,
  • directly from the installed Cloud SDK subfolder /google-cloud-sdk/platform/google_appengine/

This article shows in detail how to download the source code by using the appcfg.py command, and you can also enter appcfg.py download_app --help or check this answer for more details on how to retrieve the source code for specific services/modules and versions.

I would also add that you can see the deployed source code of your application in the Stackdriver Debugger panel of the Cloud Console.



来源:https://stackoverflow.com/questions/53817096/how-do-i-retrieve-my-app-engine-apps-source-code-from-the-gcloud-tool

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!