Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gcloudignore file is not respected during deployment to App Engine

gcloud app deploy keeps uploading all files in source directory, although I have explicitly excluded them using a .gcloudignore file. For example, the virtual environment folder env is uploaded, which is causing an error because the deployment contains more then 10,000 files then.

I am working under Windows 10 with Python 3.7 and gcloud SDK version 251.0.0. I tried both the beta and the normal version of gcloud app deploy.

The .gcloudignore file contains just the following:

  .gcloudignore
  # If you would like to upload your .git directory, .gitignore file or
  # files from your .gitignore file, remove the corresponding line below:
  .git
  .gitignore
  #!include:.gitignore

I can see in the outputs with --verbosity=info flag that it recognized the .gcloudignore file, but then it uploads the env folder to Cloud Storage. I would expect this folder to be skipped. Git works as expected.

like image 999
Henning Lebbäus Avatar asked Jun 26 '19 07:06

Henning Lebbäus


2 Answers

You can "include" everything ignored by your .gitignore file in your .gcloudignore file by adding the following line:

#!include:.gitignore

If your .gitignore file is already ignoring the env directory, this will cause gcloud to ignore it as well (and every other file that git is ignoring).

like image 126
Dustin Ingram Avatar answered Oct 26 '22 00:10

Dustin Ingram


Your .gcloudignore file contains two leading spaces on each line which are not allowed.

These spaces are copied from the documentation so many people will be facing this issue. See the documentation here (but do not blindly copy from their until they fixed it)

like image 30
ThdK Avatar answered Oct 26 '22 00:10

ThdK