Azure / ResourceModules

This repository includes a CI platform for and collection of mature and curated Bicep modules. The platform supports both ARM and Bicep and can be leveraged using GitHub actions as well as Azure DevOps pipelines.
https://aka.ms/carml
MIT License
726 stars 458 forks source link

[Feature Request]: Define a culture to use when sorting objects #3722

Open MariusStorhaug opened 1 year ago

MariusStorhaug commented 1 year ago

Description

Add -Culture 'en-US' to all Sort-Object calls, so that sorting does not depend on the environment and culture of the one running the readme gen scripts.

From #3665 image

Seems this pipeline recently failed due to sorting issues.

MariusStorhaug commented 1 year ago

Can be done multiple ways...

MariusStorhaug commented 1 year ago

Alternative 1:

Be sure to always include the following when Sort-Object is used.

Sort-Object (...) -Culture 'en-US'
MariusStorhaug commented 1 year ago

Alternative 2 If we add the following block on scripts, it would not be something that we would need to think about for new usage of Sort-Object.

$PSDefaultParameterValues = @{
  'Sort-Object:Culture'='en-US'
}
AlexanderSehr commented 1 year ago

Hey @MariusStorhaug, good call. I haven't seen this issue in quite some time actually. However, if it still exists (and from what you said I take it that's the case), I agree that we should do something about it.

That said, I guess Alternative 2 seems to be the safer option - though I have to admit I haven't seen such an implementation anywhere yet.

MariusStorhaug commented 1 year ago

Fully documented here; https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_parameters_default_values?view=powershell-7.3