0

Is there any way to disable google cloud functions versioning?

I've for a long time tried to limit the number of versions kept in the cloud functions history, or if impossible, disable it completely...

This is something that at low level any infrastructure manager will let you do but google intentionally doesn't

Rafael Lima
  • 3,079
  • 3
  • 41
  • 105
  • 1
    Hi @Rafael Lima, There is no versioning scheme built into Cloud Functions. Are you referring to old container images built during past deployments? If so, please check if this thread answers your question https://stackoverflow.com/questions/63884429/how-to-delete-outdated-firebase-cloud-function-containers-from-gc-storage – Marc Anthony B Oct 13 '21 at 06:23
  • @MarcAnthonyB, it is that, and that is versioning and that is versioning as it keeps all the previous code and you can selective roll back each function to a previous version – Rafael Lima Oct 13 '21 at 12:39

1 Answers1

0

When using Firebase Cloud Function, There's a Lifecycle of a background function. As stated from the documentation:

  • When you update the function by deploying updated code, instances for older versions are cleaned up along with build artifacts in Cloud Storage and Container Registry, and replaced by new instances.

  • When you delete the function, all instances and zip archives are cleaned up, along with related build artifacts in Cloud Storage and Container Registry. The connection between the function and the event provider is removed.

There is no need to manually clean or remove the previous versions as Firebase deploy scripts are doing it automatically. Based on the Cloud Functions Execution Environment:

Cloud Functions run in a fully-managed, serverless environment where Google handles infrastructure, operating systems, and runtime environments completely on your behalf. Each Cloud Function runs in its own isolated secure execution context, scales automatically, and has a lifecycle independent from other functions.

These means that you should not remove build artifacts since cloud functions are scaling automatically and new instances are built from these artifacts.

Marc Anthony B
  • 3,635
  • 2
  • 4
  • 19
  • this is sooooooooo not true – Rafael Lima Oct 14 '21 at 13:16
  • @RafaelLima all of the information came from the official documentation so I'm not sure what you mean where it's not true. With regards to the first point, it applies on background functions, double check if your functions listens to HTTP requests. – Donnald Cucharo Oct 15 '21 at 01:20