I wanted to exclude some of the files while pushing files to the GC storage. I created .gcloudignore
in a root of my bucket. I enabled the .gcloudignore
through the command: gcloud config set gcloudignore/enabled true
.
Here is my .gcloudignore
file:
.gcloudignore
profiles/
.gitignore
.gitlab-ci.yml
.pre-commit-config.yaml
Dockerfile
README.md
profiles.yml
Now I am trying to check how it works. In GC CLI I use this command:
gsutil -m rsync -r ./ gs://my_awesome_bucket/dags/dbt/gcloudignore_test
But all the files (including files from .gcloudignore
) pushed to the bucket. What could be the reason?
And if use this command with the flag -x
(-x
stands for exclude):
gsutil -m rsync -r -x '(profiles/.*|.git/.*|.gitignore|.gitlab-ci.yml|.pre-commit-config.yaml|Dockerfile|README.md|profiles.yml)' ./ gs://$GCS_AIRFLOW_PATH/dbt
the command works properly: files listed after -x
have not been pushed.
Might be somebody could advise me how to check resulst of .gcloudignore
file?
I agree with @somethingsomething as based on this documentation, gsutil commands are not listed here. Although it was not mentioned that gsutil is not allowed nor does it work to ignore files included in the .gcloudignore
file, it seems like .gcloudignore
only works when deploying an app or function.
I tried replicating your issue and I got the same results as yours. The files included in .gcloudignore
files are still pushed to the bucket using gsutil rsync
command. Upon adding the -x
command, the files are also not pushed to the bucket.
On the other hand, I also tried deploying a function using gcloud functions deploy
. It worked well and ignored the files I included in the .gcloudignore
file.