-
Notifications
You must be signed in to change notification settings - Fork 53
Description
When requirements.psd1
specifies a range of module versions (for example, { Az = 2.* }
), the PowerShell worker compares the currently installed module version with the highest version available on the PowerShell Gallery. If the Gallery contains a higher version, the worker removes the installed version and installs the one from the Gallery. For example, if v2.3 is installed and v2.4 is available, the worker removes v2.3 immediately.
The problem with this approach is that other worker instances may be currently running and using the older version. As a result, either removing the module files will fail at this point, or the worker will encounter module files missing unexpectedly, and hit errors that will be hard to diagnose.
On the other hand, never removing old module versions is also not a good option, as the old versions will continue piling up for modules that are updated on the PowerShell Gallery on the regular basis.
So, in order to ensure smooth transition from older module versions, come up with more conservative criteria, for example:
- Keep at least N latest module versions; and
- Remove module versions that were installed more than M days ago.
Make the parameters configurable (per function app?), decide on good default values.