Azure / azure-dev

A developer CLI that reduces the time it takes for you to get started on Azure. The Azure Developer CLI (azd) provides a set of developer-friendly commands that map to key stages in your workflow - code, build, deploy, monitor, repeat.
https://aka.ms/azd
MIT License
388 stars 178 forks source link

Revisit/discuss azd service operation caching #3392

Open weikanglim opened 4 months ago

weikanglim commented 4 months ago

azd currently stores and reuses implicit caching when running azd up. Consider a workflow that looks like:

steps:
- package --all # Validate everything builds
- provision
- # update api app settings
- deploy api

In this scenario, deploy api will actually reuse the prepackaged results from step 1 and fail to observe the app settings change due to implicit state being cached and reused across the execution.

Caching was originally done so that azd deploy would reuse results from azd package if invoked in a single command execution. Now that up is also exposed as a workflow, this type of caching can start leading to unintended consequences.

I also wonder if we should revisit how azd up does packaging first in the default flow. With provision caching, rerunning azd up when provision succeeds will only incur the cost of state checking. The model that we have personally feels unnatural to what a user expects.

wbreza commented 1 month ago

Based on your example and comment it looks like in this scenario step 1 should actually be a package step and not build? If they are just validating that everything builds then that seems appropriate to me.

This is the current/expected behavior that deploy api should use the package generated in step 1 rather than re-package the application.