How to delete outdated Firebase Cloud function containers from GC Storage?

本秂侑毒 提交于 2020-12-18 09:14:59

问题


So recently Firebase started charging for Cloud Functions container storage: https://firebase.google.com/pricing

No free usage $0.026/GB

I have deployed 2 functions several times (no more than 10 times, can't remember exact count, but this is still pretty low, IMO). Now I am already billed a small amount (fractions of a cent for now). So seems that if I deploy the functions another few dozens of times, I'll get close to a dollar, because old (and unused) containers are not deleted from the storage bucket.

Is there a way to safely delete outdated, not used containers to free some space? Well, it may seem that a few cents are not worth the time, but still, that's not what a free tier should be like.


回答1:


I found the only robust solution to this ongoing issue (for now) is to periodically remove all of the artifact files (following Doug's instructions). As noted by others, removing some of the files can cause subsequent deploy errors (I experienced these).

You can do partial or full deploys as normal without any issues (it seems that the artifact files are only referenced during the build/deploy process).

Not ideal by a long shot, but at least reduces the storage usage to the minimum (until it starts accumulating again).

Edit: I am currently experimenting with the Lifecycle rules in the artifacts bucket. I have set it to delete any "Standard" files in the bucket. This should (in theory) regularly clean out the artifact bucket after a build, keeping the storage usage close to zero. I'm not sure how often the Lifecycle rules are executed. I will report back once I have some more info.




回答2:


  1. Go to the Cloud console
  2. Select "Cloud Storage -> Browser" from the products in the hamburger menu.
  3. You will see multiple storage buckets there. Simply dig in to the buckets that start with "artifacts" or end with "cloudbuild" and delete the old files (by date) that you don't want.


来源:https://stackoverflow.com/questions/63884429/how-to-delete-outdated-firebase-cloud-function-containers-from-gc-storage

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