As a team when working on applications that harness the power of firebase functions (serverless), folks often ask each other questions like:
- Is the master (or some other branch) commit deployed ?
- When was the last time firebase functions were deployed ?
This is primarily because most new teams on firebase are unaware of how to get the last deployment details of firebase functions. For now the best possible kind of data one can get around this, is the last deployment date and time. This information is available on the GCP Cloud Functions console page. If you simply search for the
Cloud Functions product and go to its listing page, you’ll see a listing like this:
The last column called
Last Deployed shows the date and time when the last deployment had occurred. If you click on the function name, you can get an additional detail which is the Version number or identifier of the deployed function. This number or identifier is bumped with every new deployment. It’ll look like this:
This version number will also be passed as a predefined environment variable to your function code’s execution context, which can be accessed like this:
From the GCP docs:
K_SERVICE– Reserved: The version identifier of the function.
A lot of teams follow a practise, where they have a separate internal or external endpoint that prints the deployed git commit. If not a separate endpoint then at least some place where they can see the current commit ID that’s powering the production or staging environment. This is more useful but currently there’s no in-built way in firebase functions to achieve this.
Note: As far as last or latest deployment details for firebase hosting service is concerned, you can simply go to the project’s hosting console and see a list of current and past hosting deployments.