To download an application's files, run the appcfg.sh
command with the
download_app
action.
appcfg.sh -A [YOUR_PROJECT_ID] -V [YOUR_VERSION_ID] download_app [OUTPUT_DIR]
where:
[YOUR_PROJECT_ID]
is your Cloud project ID.[YOUR_VERSION_ID]
is the version ID of your application that you want to download.[OUTPUT_DIR]
is the full directory path to where you want your files downloaded.
For more information about this command, see the appcfg.sh download_app
reference.
If the command is successful, you get output similar to the following:
Getting file list...
Fetching files...
Getting files...
[1/5] request.class
[2/5] login.class
[3/5] static/screen.css
[4/5] static/print.css
[5/5] images/bird.png
Troubleshooting
Command not found
If you installed the Google Cloud SDK and use the
gcloud
tool, theappcfg.sh
command is available from the[SDK_INSTALL_PATH]/google-cloud-sdk/platform/google_appengine/
directory.For example, to use the Google Cloud SDK, you run the
appcfg.sh
by specifying the directory path:[SDK_INSTALL_PATH]/google-cloud-sdk/platform/google_appengine/appcfg.sh -A [YOUR_PROJECT_ID] -V [YOUR_VERSION_ID] download_app [OUTPUT_DIR]
You do not have permission to download this app version
Only the authenticated user who deployed the version of the application as well as the users with the project Owner role have the privileges to download files. Other users who attempt to download the application will receive an error message similar to the following:
Fetching file list... Error 403: --- begin server output --- You do not have permission to download this app version. --- end server output ---
Preventing Source Code Downloads
Download access to any available source code can be restricted by using an Organization Policy.
The constraint for controlling code downloads is:
constraints/appengine.disableCodeDownload
The default value for the constraint is false, meaning that code downloads are enabled. You can enable this policy constraint on an organization, project and folder and are inherited by child resources. For example, a project inherits policy constraints set on its containing folder, and a folder inherits constraints set on an organization.
Permissions
You can set the appengine.disableCodeDownload
constraint if you
have been granted the orgpolicy.policyAdmin
role on the organization.
Setting the policy constraint on the organization level
You need your project's organization ID to set the constraints/appengine.disableCodeDownload
constraint.
Find your organization ID
Console
You can find the ID on the Google Cloud Console :
- Log in to the Google Cloud Console .
Click on the project selector.
Select an organization and look for the organization ID.
gcloud
Run the following gcloud
command and look for the ID:
gcloud organizations list
Example gcloud
output something like the following, where ID is the
project ID:
DISPLAY_NAME ID
example-organization 29252605212
Setting your policy constraint
Console
To set the organization policy, configure the constraint to disable source code download:
- Go to the Organization policies page in the Google Cloud Console.
- Click the Organization drop-down list at the top of the page and then select your organization.
- Click Disable Source Code Download.
- Click the Edit button.
- Under Applies to, select Customize.
- Under Enforcement, select On.
- Click Save. A notification will appear to confirm that the policy has been updated.
gcloud
Policies can be set using the gcloud
command-line tool.
To disable source code download, run the following command:
gcloud alpha resource-manager org-policies enable-enforce \ --organization 'ORGANIZATION_ID' \ appengine.disableCodeDownload
To disable the policy, the same command can be issued with the
disable-enforcecommand.
You can set the appengine.disableCodeDownload
constraint at the folder and
project level. To learn more about using constraints in organization policies,
see Using Constraints.