feat(hooks): add hooks command to list configured lifecycle hooks#515
Open
jongio wants to merge 1 commit into
Open
feat(hooks): add hooks command to list configured lifecycle hooks#515jongio wants to merge 1 commit into
jongio wants to merge 1 commit into
Conversation
Add `azd app hooks` to list the project-level lifecycle hooks configured in azure.yaml. For each hook (prerun, postrun, prestop, poststop) it shows the command, shell, continueOnError and interactive flags, and any Windows or POSIX override, in lifecycle order. Reuses the nil-safe Hooks accessors so an absent hooks block needs no special handling. Supports text and JSON output and prints a short message when nothing is configured. Adds table-driven unit tests and docs. Closes #510 Co-authored-by: Copilot App <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
azd app hooks, a read-only command that lists the project-level lifecycle hooks configured in azure.yaml.For each configured hook (prerun, postrun, prestop, poststop) it shows the command it runs, the shell it uses, whether it continues on error or needs user interaction, and any per-platform override for Windows or POSIX.
Why
Lifecycle hooks run around
azd app runandazd app stop, but there is no way to see what they are without opening azure.yaml and reading the nested hook blocks by hand. This lists them in lifecycle order so you can confirm what will run and spot a misconfigured shell or platform override quickly.Usage
Text output:
Details
Hooksaccessors (GetPrerun,GetPostrun,GetPrestop,GetPoststop) so an absent hooks block is handled without special cases.Tests
Table-driven unit tests cover the empty case, lifecycle ordering and field mapping, platform overrides (including a pointer override left unset), the nil override path, JSON shape, and the small formatting helpers.
Verification
go build ./...cleango vet ./src/cmd/app/commands/...cleango test ./src/cmd/app/commands/cleangolangci-lint run ./src/cmd/app/commands/...reports 0 issuesCloses #510