pagopa / dx

Devex repository for shared tools and pipelines.
https://pagopa.github.io/dx/docs/
1 stars 0 forks source link

Fix function app slot host id collision #39

Closed christian-calabrese closed 5 months ago

christian-calabrese commented 5 months ago

List of changes

Set the AzureFunctionsWebHost__hostid environment variable on function app and its slot when the function name is longer than 32 characters

Motivation and context

In the newly implemented trial-system project, an issue has been encountered. The name of the staging slot (that is the concatenation of the function app name and "staging") was longer than 32 characters.

The default host id (used to create a container in the function's storage account), equals to the complete name truncated to 32 characters. When the complete slot name is longer than 32 characters, the host id (aka container name) may collide with the one used by the function app and cause problems.

For this reason, in this PR, we are going to set the host id statically to avoid collisions. "production" for the function app and the slot name for the function app slots (e.g. "staging").

More information here: https://learn.microsoft.com/en-us/azure/azure-functions/storage-considerations?tabs=azure-cli#avoiding-host-id-collisions https://learn.microsoft.com/en-us/azure/azure-functions/errors-diagnostics/diagnostic-events/azfd0004

Type of changes

Does this introduce a change to production resources with possible user impact?

Other information