-
Notifications
You must be signed in to change notification settings - Fork 249
fix: Make hook shell optional with OS-based defaults (#3613) #5809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Auto-detect shell based on OS when not explicitly specified (pwsh for Windows, sh for others) - Display warnings to inform users about default shell usage and encourage explicit configuration - Add comprehensive validation and warning system in both middleware and hooks run command - Update tests to reflect new behavior where missing shell is no longer an error - Maintain backward compatibility for existing hook configurations Fixes Azure#3613
This is fantastic, @vhvb1989 -- thank you! What do you think about adding a short aka link to the error message? aka.ms/azd-hooks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash:
pwsh:
WindowsPowerShell install
MSI install
Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
Thanks, this will simplify many of our config files! |
Overview
This PR addresses issue #3613 by making the shell configuration optional for hooks and implementing automatic OS-based shell detection.
Changes Made
Core Functionality
pwsh
on Windows andsh
on Linux/macOSKey Files Modified
pkg/ext/models.go
: Added OS-based shell detection and default shell trackingpkg/ext/hooks_manager.go
: Enhanced validation to detect and warn about default shell usagecmd/hooks.go
: Added validation and warning display toazd hooks run
commandWarning Examples
Before (Error):
After (Working with Warning):
Example Usage
Testing
azd hooks run
commandFixes
Closes #3613
Type of Change