Skip to content

Update hashes only on successful deploymentsΒ #1

@haroldadmin

Description

@haroldadmin

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.
  • πŸ’‘ Execute firebase deploy command as a sub process from functions-differ and 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions