Skip to content

Conversation

@CarolineNB
Copy link
Contributor

@CarolineNB CarolineNB commented Aug 7, 2023

This fix prevents appending .azurecr.io to queries when users specify their ACR.

This checklist is used to make sure that common guidelines for a pull request are followed.

Related command

az acr query -n <registry_name> -q

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally?

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify src/index.json.

@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Aug 7, 2023

️✔️Azure CLI Extensions Breaking Change Test
️✔️Non Breaking Changes

@azure-client-tools-bot-prd
Copy link

Hi @CarolineNB,
Please write the description of changes which can be perceived by customers into HISTORY.rst.
If you want to release a new extension version, please update the version in setup.py as well.

@yonzhan
Copy link
Collaborator

yonzhan commented Aug 7, 2023

ACR Query Extension


with self.argument_context('acr query') as c:
c.argument('registry_name', options_list=['--name', '-n'], help='The name of the container registry that the query is run against.')
c.argument('registry_name', options_list=['--name', '-n'], validator=validate_registry_name, help='The name of the container registry that the query is run against.')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a test on it?

# Query with basic auth and filter by repository
token = self.cmd('acr login -n {registry_name} --expose-token').get_output_in_json()
self.kwargs['username'] = EMPTY_GUID
self.kwargs['password'] = token["accessToken"]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @zhoxing-ms, is there a secure way for me to pass in credentials so that they do not show up in our recording files? This particular service is blocked by a feature flag that we cannot enable during the test--requiring us to log in to a pre-existing registry.

If not, I can remove it temporarily and we can replace with mocks until the feature flag is removed.

Copy link
Contributor

@zhoxing-ms zhoxing-ms Aug 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, you can try using the customized Preparer to avoid recording the accessToken for acr login. such as: code link

If not, I can remove it temporarily and we can replace with mocks until the feature flag is removed.

If this is only a one-time temporary need, it is also acceptable

Copy link
Contributor Author

@CarolineNB CarolineNB Aug 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preparer generates a new resource within a specified or new resource group correct?

In our case, the resource would need to exist already prior to running the tests (and we would need to login to it). Would it still be possible to use Preparer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test scenario we have is that we have a pre-created resources because the feature is blocked by default we need to enable it in a specific resources. Should we avoid using pre-created resources for testing?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CarolineNB Yes, please use the dynamically created resources in the test instead of pre-created resources to avoid the problem of dependent resources being deleted will cause the test to be failed

@CarolineNB
Copy link
Contributor Author

Hey @zhoxing-ms, tests have been added. Let me know if there's anything else needed before merging. Thanks!

@CarolineNB CarolineNB requested a review from huanwu August 16, 2023 23:55

Release History
===============
1.1.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For bug fix, please bump the patch version number. 1.0.0 -> 1.0.1


with self.argument_context('acr query') as c:
c.argument('registry_name', options_list=['--name', '-n'], help='The name of the container registry that the query is run against.')
c.argument('registry_name', options_list=['--name', '-n'], validator=validate_registry_name, help='The name of the container registry that the query is run against.')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question, do we need update history.rst?

@zhoxing-ms
Copy link
Contributor

Please take a look at this comment #6606 (comment). If you want to release a new extension version for this PR, please also modify the setup.py

@CarolineNB
Copy link
Contributor Author

Added, thanks @zhoxing-ms!

@CarolineNB
Copy link
Contributor Author

Hey @zhoxing-ms, is there anything else that is needed for this PR?

@zhoxing-ms
Copy link
Contributor

@jaysterp Could you please review this PR again?

Copy link
Member

@jaysterp jaysterp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zhoxing-ms zhoxing-ms merged commit eeaa887 into Azure:main Aug 22, 2023
@azclibot
Copy link
Collaborator

[Release] Update index.json for extension [ acrquery ] : https://dev.azure.com/azclitools/internal/_build/results?buildId=84533&view=results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants