azure-dev icon indicating copy to clipboard operation
azure-dev copied to clipboard

Report an error if azd infra synth is used and the model is out of sync with the manifests

Open davidfowl opened this issue 1 year ago • 1 comments

If you run azd infra synth and then you update the app model code, it's ignore when running azd commands (provision/up/deploy). This can be really confusing and we should do extra work here to let the user know that they are out of sync.

davidfowl avatar Apr 24 '24 04:04 davidfowl

@vhvb1989 chatted about this a bit. I think there are a few things we can do here:

  1. When using files instead of what we would generate via talking to the AppHost, print some info level messages in our output saying what's going on, so it's clearer from a console log what happened instead of having to dig into the output of --debug and hope we wrote a debug message. We can do this quickly today. We should also consider writing comments at the top of the files generated by infra synth that says they were generated by azd infra synth so readers understand what's going on.

  2. We could compute a hash of the manifest + all the referenced bicep files and burn that into our generated files. Then, when using them, compute the hash and ensure they match. If they don't, issue a warning that lets the user know "you modified the AppHost since you've run infra synth and the changes will not be reflected". For the hash, I suspect that the manifest + the linked bicep files is sufficient to give us a cache key. We may want to do some level of normalization (maybe just \r\n -> \n given that this will likely be common in mixed Linux/Windows cases) to ensure the hash is stable against non-semantic changes, but it feels like a place we need to be careful to avoid boiling the oceans.

ellismg avatar Apr 25 '24 22:04 ellismg