Open sinedied opened 3 months ago
I support this suggestion. There are situations where specifying the shell makes sense, but it creates a hidden prerequisite.
For example, I had a colleague who could not deploy an AZD template, and we spent some time debugging before we figured out that they did not have PowerShell 7 installed on their Windows machine. From their perspective, there was nothing in the code sample or AZD documentation that said you must have PowerShell 7 installed (pwsh
) to use the AZD template.
Output from
azd version
Runazd version
and copy and paste the output here: azd version 1.7.0 (commit 49d6adc2efb178083f61822e6b4715258560803d)Describe the bug When defining scripts, we currently use yaml like this:
This separate the commands to run into two categories: execution for posix-systems (Linux/Mac), and Windows.
The issue is that the distinction is not clear at all, and even misleading:
sh
will actually runbash
and notsh
, which is misleading (bash has a different feature set and by default is not POSIX-compliant)These issues could be cleared by using a simpler script definition based on the shell name, similar to how it works in GitHub Actions:
Instead of discriminating the system (which makes no sense when using WSL or Git Bash), we could just specify which shell to use. The logic could be:
<shell> --version
and see if it fails.You could even make the shell specification optional, and use whatever default shell is available on the system for simple commands, for example:
It would even be possible to support the new syntax and keep the old deprecated syntax for backward compatibility with existing azure.yaml configurations.
What do you think about this proposal?