{ACR} az acr build: Exclude .venv directories from build#32241
{ACR} az acr build: Exclude .venv directories from build#32241
az acr build: Exclude .venv directories from build#32241Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
There was a problem hiding this comment.
Pull Request Overview
Adds exclusion for .venv directories from Azure Container Registry build uploads to improve build performance by preventing unnecessary processing of virtual environment files.
- Implements hardcoded exclusion rule for .venv directories in the archive utility
- Adds warning message when .venv directories are excluded
- Addresses performance issues reported in GitHub issue #31250
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
az acr build: Exclude .venv directories from build
| return True, parent_matching_rule_index | ||
|
|
||
| # Exclude performance-impacting directories that are typically not needed in build context | ||
| if tarinfo.isdir() and os.path.basename(tarinfo.name) in build_ignore_dirs: |
There was a problem hiding this comment.
Can you check if the code will skip all files under the ignored directories? or will it continue to scan all of them?
There was a problem hiding this comment.
I added line 214 to exclude only the .venv folder ( in "ignored") from being scanned, since we agreed we are doing a targeted fix to only exclude venv. The code will still scan the child items of .git and .docker_ignore, even though those are in ignored group, according to original comment and code on line 212-213 ( "even the dir is ignored, its child items can still be included, so continue to scan"). This PR change will exclude only .venv from this scan.
az acr build: Exclude .venv directories from buildaz acr build: Exclude .venv directories from build
Add exclusion for .venv directories to improve performance.
Related command
az acr build
Description
Az acr build parses all files in repo even if excluded in .dockerignore. This PR targets .venv directories from getting processed thus reducing the unnecessarily long build time.
History Notes
Issue raised here: #31250
This checklist is used to make sure that common guidelines for a pull request are followed.
[x ] The PR title and description has followed the guideline in Submitting Pull Requests.
[x ] I adhere to the Command Guidelines.
[x ] I adhere to the Error Handling Guidelines.