-
Notifications
You must be signed in to change notification settings - Fork 14
Description
Problem
functions-differ writes new hashes to the .differspec.json file even if the detected changes were not deployed to Firebase.
This means that if you run functions-differ again after a failed deployment, you get an empty list of changed functions.
Proposed Solutions
The goal is to make functions-differ command invocation idempotent, meaning that multiple invocations of functions-differ should output the same list of changed functions until a successful deployment.
There's no easy solution to this because we can not detect if the deployment was successful. Some possible solutions are:
-
π‘ Use the source code deployed on GCF to calculate old hashes of the functions, instead of relying on hashes stored in
.differspec.json.- βοΈ Pros:
- Ensures that old hashes are always calculated from functions that were deployed successfully
- π Cons:
- Increases time of invocation significantly, as we would need to download source code of deployed functions.
- Increases complexity, as we would need to authenticate with GCP to download sources.
- Calculating hashes from downloaded source code is complicated, as the source code of the function includes all other files in the project as well.
- βοΈ Pros:
-
π‘ Execute
firebase deploycommand as a sub process fromfunctions-differand only update hashes when the sub process exits successfully- βοΈ Pros:
- Ensures that old hashes are always calculated from functions that were deployed successfully
- Makes the tool more fully-featured, as it provides an out of the box solution for deploying functions.
- π Cons:
- Imposes a dependency on the Firebase CLI, and would require changes whenever the CLI interface changes.
- In case of a partially successful deployment, it is difficult to detect which functions were deployed sucessfully.
- βοΈ Pros: