Home > OS >  How to force update all files of the project in gcloud app engine
How to force update all files of the project in gcloud app engine

Time:10-13

I have deployed a project on gcloud app engine (standard) using the CLI command gcloud app deploy. On the first deployment, I put a .env file in the project which I want to delete. However, when I delete the .env file and push again, it says 0 files pushed onto the storage and the environment variables in the .env file still exist in the logs!

Is there any way to somehow refresh the deployment so I can get rid of the .env and the environment variables set by mistake?

CodePudding user response:

  1. When you deploy your app via gcloud app deploy, it copies your source code to a bucket. The default bucket is staging.<project_name>.appspot.com. (objects uploaded to the staging bucket have a default life span of 15 days i.e. they will get deleted 15 days from the last time the object was updated. You can change this value.)

  2. When you run the deploy command, gcloud only deploys files that have been 'updated'. I think it compares files in your local env with the files in this staging bucket (this seems to be why it's telling you 0 files were pushed).

  3. You could try clearing the staging bucket (deleting all the files in it) and then deploying your app again (it should then see the files as being new and should deploy them i.e. the files without the .env folder.

CodePudding user response:

I've managed to replicate your issue and it works on my end. I tried to deploy an app with .env file then tried to deploy for a second time without a ".env" file, but before doing so, I made sure to remove the file from the folder using this command.

rm -rf .env

Run this command to see if this completely removes the folder since this is a hidden file.

ls -a

You can also follow the steps below to make sure the file isn't part of the deployment:

  1. Go to App Engine services in the Google Cloud console.
  2. Scroll bar to the right then on the Diagnose tab you will see a dropdown menu "Tools". Once you click that there are three options, choose "Source".
  3. After you click the "Source" you will be directed to another page then you can check on that for the files that are being deployed.

Another workaround, if you want to specify which file is not included in the deployment you can use a .gcloudignore file.

  • Related