Do not re-deploy unchanged functions when using --only functions:codebase
[REQUIRED] Environment info
firebase-tools: 12.3.1
Platform: any
[REQUIRED] Test case
Due to this change here: https://github.com/firebase/firebase-tools/pull/4968, a functions deploy will always redeploy all functions when using the --only flag, regardless of whether there are any changes and whether that function was targeted directly.
I believe this could be changed to only force functions to deploy if they were targeted directly via --only functions:<function_name>
[REQUIRED] Steps to reproduce
- Deploy all functions
- Deploy an unchanged codebase using
--only functions:<codebase>
[REQUIRED] Expected behavior
The unchanged functions within the selected codebase will not be deployed again.
[REQUIRED] Actual behavior
All functions in the codebase will be re-deployed even if there have not been any changes.
Hi @gillycheesesteak. The Firebase CLI has a functionality that skips functions that have not been modified, but that logic only runs when deploying all functions. When given instructions to deploy a specific function/set of functions, it assumes that you know best and skips the change detection logic.
With that said, I'll be tagging this as a feature request. If I may have misunderstood you in any way, please let me know.
The feature request tag is fair. For clarity, I will explain my use-case further.
I have separate codebases, but they share a common library of code that all of them rely on. When that code changes, all functions need to be redeployed. My deploy happens in a GitHub action, and when all functions are deployed at once (40 individual functions currently), many of them fail due to timeouts.
My goal was to break those out into codebases that could then be deployed once at a time, but doing so I lose the functionality to only deploy when something has changed. So, to have the best of both worlds, I would like to do firebase deploy functions:codebase but retain the hash comparison functionality.
This is the issue that is causing full function deployments to fail in my use-case: https://github.com/firebase/firebase-tools/issues/5967
I just tested with firebase tools 12.4.7 (I'm learning and already read all the documentation) After reading some issues and pull request here, I was under the impression that the "skip no-op deploys" funcionality would skip the deploy of individual functions, but it seems to be based on whole codebases.
I have a project with a typescript "default" codebase, and a javascript "js" codebase, each one with 3 functions.
Changing even a character on any file of a codebase will cause firebase deploy --only functions to deploy ALL of the functions on said codebase, and skip only ALL the functions on the codebase that was unchanged.
Using only 1 codebase will thus trigger an update of all functions on the project after any change.
If the change is on 1 of 3 functions, and deployed with firebase deploy --only functions:function (or functions:codebase:function), firebase tools will deploy only said function, and then firebase deploy --only functions will skip that function (and the other codebase), but update the other 2 functions that were unchanged.
I read that firebase uploads and zips all of the codebase code for every function, so it seems that it compares the new zipped code with the uploaded code.