-
Notifications
You must be signed in to change notification settings - Fork 198
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
Support azd hooks out of azure.yaml, Part I of merging azd operation to hooks #4244
Open
vhvb1989
wants to merge
14
commits into
Azure:main
Choose a base branch
from
vhvb1989:merge-azd-operation-and-hooks
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
4d59c6d
service hooks
vhvb1989 fc2b714
Merge branch 'main' of github.com:Azure/azure-dev into merge-azd-oper…
vhvb1989 3c3b954
As part of merging azd operation and hooks, this PR allows users to d…
vhvb1989 9a561f5
test new function
vhvb1989 704c5d1
Merge branch 'main' of github.com:Azure/azure-dev into merge-azd-oper…
vhvb1989 0c6cdf4
Merge branch 'main' of github.com:Azure/azure-dev into merge-azd-oper…
vhvb1989 a65c3b4
lint
vhvb1989 8605e02
Merge branch 'main' of github.com:Azure/azure-dev into merge-azd-oper…
vhvb1989 af3da51
wait here
vhvb1989 99ca56a
Merge branch 'main' of github.com:Azure/azure-dev into merge-azd-oper…
vhvb1989 a292068
User project to parse hooks from external files
vhvb1989 1178156
ignore all stat errors as a way to handle Aspire projects
vhvb1989 deae098
Merge branch 'main' of github.com:Azure/azure-dev into merge-azd-oper…
vhvb1989 5b2ae88
Merge branch 'main' of github.com:Azure/azure-dev into merge-azd-oper…
vhvb1989 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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.
I wouldn't put the hooks in /infra folder to make the not service specific.
If you put in the infra folder then that means they are related to infra, which they can be, but that isn't always true.
I recommend either:
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.
100% agree here. The hooks config file should either be in the same folder as the
azure.yaml
for project level command hooks or in aproject
folder of a service for service specific hooks.Only
provision
hooks are related to infra and that shouldn't override configuration for all hook configuration.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.
Adding it to /infra is the fundamental intention of this PR, :)
azd.operations are infrastructure-extensions.
When translating to azd.operations to hooks, we would expect the azd.hooks in the /infra folder to use either
postprovision
orpreprovision
. Otherwise, hooks would be defined in azure.yaml.I don't expect folks to migrate from using azure.yaml to use azd.hooks file in /infra folder. The intention is to allow projects like Aspire to generate the infrastructure including hooks (currently known as azd.operations).
Would you feel better if azd fails when using azd.hooks in /infra to define a non postprovision or preprovision hook?
However, I wouldn't find too much value in such validation.
The expectation, when using Aspire to generate infrastructure (with azd infra synth) is that folks can easily delete the infra (by deleing the infra folder) to go back to auto-in-memory-generation. If the azd.hooks file goes out of /infra, we would be adding an extra step for cleaning the infra files.
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.
How about updating this to work with any file in the project that is prefixed with azd.hooks, but not make /infra the standard. As-in, if the user Really wants to put it in infra. We don't stop them, but if they want to put it in the route, they can. They can put it wherever they want in your particular case. You want it in infra and that should be fine with a flexible design, But I don't think we should force them to put it in infra folder.
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.
Can we use this PR as the first step on that direction? Then wait and measure usage and if customers ask for more?
My expectation is that customers will continue to use azure.yaml for hooks, as you have the yaml schema to help you use IntelliSense and spot errors. The azd.hooks file is coming right now as an alternative for code-generators.
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.
The azd operations is an alpha feature and is subject to change. As we discussed these really are the same as hooks with more hard coded operations vs generic scripts. Because of this I would not want to see azd operations continue forward as its own unique feature for only infra related activities. For aspire scenarios it really shouldn't matter whether you generate this file in the infra folder or in the project root.
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.
It matters a lot!! For customers running
azd infra synth
, the output goes to the /infra folder.We used to output to
/infra folder + services' folders
and got user's feedback/request to consolidate it all in one single folder (so they could remove it if they want to go back to Aspire-generation).That's why it is fundamental in this case to start by supporting the azd.hooks file at /infra folder, to solve the main user-case we have right now.
In the future, we can expand to all folders if we want (or customers ask for it). Right now, I think it would be much more than what we need.
And yes, after this, azd operations alpha feature would be retired :)
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.
I understand that the infra gets generated in the infra folder but this doesn't mean and hooks configuration should be here also. I'd strongly advise we don't include the hooks yaml in the infra and move this to the root as suggested above.