functions-differ icon indicating copy to clipboard operation
functions-differ copied to clipboard

Store hashes somewhere other than differspec file

Open haroldadmin opened this issue 3 years ago • 4 comments

Problem

In a CI workflow, all changes made to files are ephemeral. They last only as long as the workflow itself.

functions-differ does not work well in a CI environment. Updates to function hashes are not persisted across CI runs, meaning that the hashes in .differspec.json are not updated. This leads to incorrect calculations of changed functions.

Proposed Solutions

  • :bulb: Store function hashes in an online database accessible from both CI environment, and a local dev workflow.
    • :heavy_check_mark: Pros:
      • Hashes persist across CI and local deployment workflows
      • .differspec.json file is simplified
    • :stop_sign: Cons:
      • Creating a central repository of function hashes might create privacy concerns
      • Allowing users to store hashes in their own databases on GCP would increase complexity of the tool

haroldadmin avatar May 01 '21 07:05 haroldadmin

Is there any progress on this issue by any chance? We would love to use your package, but we are deploying using azure devops, so using the .differspec.json is not currently working for us.

lordalisat avatar Aug 13 '21 12:08 lordalisat

There's no progress to report yet, unfortunately. A workaround for this problem is to cache your .differspec.json file between CI runs so that your deployment history on CI remains consistent.

haroldadmin avatar Aug 13 '21 16:08 haroldadmin

A configurable SpecWriterAdapter & SpecReaderAdapter would be great, with a few prebuilt options for likely uses cases.

Since this is built for Firebase, storing a JSON document in Firestore or JSON file in GCS seems appropriate. But providing an adapter API means you could configure it to read/write anywhere.

jsakas avatar Nov 15 '21 20:11 jsakas

That's a nice idea! If you would like to implement it I am happy to accept a pull request for it. If that's not possible, I'll include it in my list of things to add for this package (but no ETA).

haroldadmin avatar Nov 16 '21 03:11 haroldadmin