Azure / azure-dev

A developer CLI that reduces the time it takes for you to get started on Azure. The Azure Developer CLI (azd) provides a set of developer-friendly commands that map to key stages in your workflow - code, build, deploy, monitor, repeat.
https://aka.ms/azd
MIT License
396 stars 190 forks source link

[Issue] azd init should ignore some files #4142

Open jongio opened 1 month ago

jongio commented 1 month ago

When a user runs azd init it copies all files from the repo. Sometimes we don't want that.

The template author may want a CONTRIBUTING.md file in the repo or a file in the .github folder for the template authoring experience. But doesn't want the user to have that file when they are using the template.

Examples of files that we don't want to be copied when initialization a template, but should be in the repo. https://github.com/Azure-Samples/agent-openai-python-prompty/blob/main/CONTRIBUTING.md https://github.com/Azure-Samples/agent-openai-python-prompty/blob/main/CHANGELOG.md https://github.com/Azure-Samples/agent-openai-python-prompty/blob/main/.github/CODE_OF_CONDUCT.md https://github.com/Azure-Samples/agent-openai-python-prompty/blob/main/.github/workflows/azure-dev-validation.yaml

Suggestion:

Add a .azdignore file to the root of the repo that contains files/paths that azd should ignore during the init.

vhvb1989 commented 1 month ago

What about git clone , a codespace or manual donwload? There would be an inconsistency between acquiring templates with azd init v/s other acquisition methods.

Here's an alternative:

A strategy like this would enable folks to start a codespace from the azd-template branch to use and own the template, or from main branch to contribute to the template itself (like updating the .azdignore files)

jongio commented 1 month ago

As a template author I do not want to manage two different branches - too much overhead.

wbreza commented 1 month ago

We can only control how azd itself acquires templates. I think this feature would be helpful for template authors that want to exclude files during the azd init process.

We know if developers manually acquire the template that the azd ignore file will not be processed. One other idea is that any additional azd init call on a template after clone will check for the existence of the file and clean any effected files.