-
Notifications
You must be signed in to change notification settings - Fork 3.3k
{CI} Fix ignore logic #31784
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
{CI} Fix ignore logic #31784
Conversation
️✔️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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the extension ignore logic in the CI script by adding spaces around extension names to ensure exact matches rather than partial ones.
- Wraps both the ignore list and current extension in spaces when using
=~ - Prevents substrings from incorrectly triggering the ignore condition
scripts/ci/test_extensions.sh
Outdated
| echo | ||
| # Use regex to detect if $ext is in $ignore_list | ||
| if [[ $ignore_list =~ $ext ]]; then | ||
| if [[ " $ignore_list " =~ " $ext " ]]; then |
Copilot
AI
Jul 10, 2025
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.
Quoting the regex pattern on the right-hand side disables regex interpretation and may not produce the intended match. Consider removing the quotes around the pattern and using a bracket expression for spaces, e.g.: if [[ " $ignore_list " =~ [[:space:]]$ext[[:space:]] ]]; then.
| if [[ " $ignore_list " =~ " $ext " ]]; then | |
| if [[ " $ignore_list " =~ [[:space:]]$ext[[:space:]] ]]; then |
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.
@wangzelin007, is the copilot suggestion reasonable?
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.
This line is indeed doing literal match, so it is ok to quote it.
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.
Yes, as jiashuo said, this is intentional.
scripts/ci/test_extensions.sh
Outdated
| echo | ||
| # Use regex to detect if $ext is in $ignore_list | ||
| if [[ $ignore_list =~ $ext ]]; then | ||
| if [[ " $ignore_list " =~ " $ext " ]]; then |
Copilot
AI
Jul 10, 2025
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.
[nitpick] For clearer literal matching and to avoid regex pitfalls, you could use a case statement instead, e.g.: case " $ignore_list " in *" $ext "*) echo \"Ignore extension: $ext\"; continue;; esac.
scripts/ci/test_extensions.sh
Outdated
| echo | ||
| # Use regex to detect if $ext is in $ignore_list | ||
| if [[ $ignore_list =~ $ext ]]; then | ||
| if [[ " $ignore_list " =~ " $ext " ]]; then |
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.
Surrounding the string with spaces to achieve full match is a hack. Consider using ^ and $:
https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#index-_005b_005b
The match succeeds if the pattern matches any part of the string. If you want to force the pattern to match the entire string, anchor the pattern using the ‘^’ and ‘$’ regular expression operators.
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 would prefer to use a for loop, which is clearer and more intuitive.
Currently, load extension task skips ml test:

Add spaces around extension names for exact matching

Related command
Description
Testing Guide
History Notes
[Component Name 1] BREAKING CHANGE:
az command a: Make some customer-facing breaking change[Component Name 2]
az command b: Add some customer-facing featureThis checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.