When a cloud function is deployed I assume Google performs some equivalent of:
pip install -r requirements.txt
Let's say the requirements.txt
file contains:
google-cloud-pubsub
google-cloud-storage==1.26.0
Since the cloud storage version is specified, all existing and future scaled function instances will install that version.
A gcloud functions deploy ...
would install 1.26.0 storage libraries on all instances.
However, let's say there is an instance already running with google-cloud-pubsub
version 1.0.2 installed and the newest version is 1.3.0.
The pip command above would not load a newer version.
Instead there would be a Requirement already satisfied
response. The existing instance would stay on version 1.0.2 while any newly scaled instances would pull 1.3.0. There would be a mismatch of library versions across instances of the same cloud function.
- Am I understanding this process accurately? Does GCP do an equivalent of
pip install -r requirements.txt
? - Is there a way to force cloud functions to import the newest version of a library during deployment via requirements.txt or otherwise?