Skip to content

Commit

Permalink
Make ACR feature work with sovereign clouds (#4289)
Browse files Browse the repository at this point in the history
  • Loading branch information
bwateratmsft authored Apr 25, 2024
1 parent 4357003 commit ea21b37
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 31 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
- Python Dockerfiles will now be scaffolded with the `python:3-slim` tag, so that they do not need to be updated annually. [#4234](https://github.com/microsoft/vscode-docker/pull/4234)
- Python debugging will now use the `debugpy` debug configuration instead of the now-deprecated `python` debug configuration. This requires recent versions of the [Python](https://marketplace.visualstudio.com/items?itemName=ms-python.python) and [Python Debugger](https://marketplace.visualstudio.com/items?itemName=ms-python.debugpy) extensions. [#4221](https://github.com/microsoft/vscode-docker/issues/4221)

### Fixed
- Sovereign clouds such as Azure China and Azure US Government should now work with the connect to Azure Container Registry feature. [#4287](https://github.com/microsoft/vscode-docker/issues/4287)

## 1.29.0 - 12 February 2024
### Added
- Node.js 18 is now used, requiring at minimum VSCode 1.82.0. [#4167](https://github.com/microsoft/vscode-docker/pull/4167)
Expand Down
35 changes: 9 additions & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2998,7 +2998,7 @@
"@azure/storage-blob": "^12.14.0",
"@microsoft/compose-language-service": "^0.2.0",
"@microsoft/vscode-azext-azureappservice": "~2.0",
"@microsoft/vscode-azext-azureauth": "^1.4.0",
"@microsoft/vscode-azext-azureauth": "^2.3.0",
"@microsoft/vscode-azext-azureutils": "^2.0.0",
"@microsoft/vscode-azext-utils": "^2.1.1",
"@microsoft/vscode-container-client": "^0.1.1",
Expand Down
2 changes: 1 addition & 1 deletion src/tree/registries/Azure/ACROAuthProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See LICENSE in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { AzureSubscription } from '@microsoft/vscode-azext-azureauth';
import type { AzureSubscription } from '@microsoft/vscode-azext-azureauth';
import { LoginInformation, httpRequest } from '@microsoft/vscode-docker-registries';
import { AuthenticationProvider } from "@microsoft/vscode-docker-registries/";
import * as vscode from 'vscode';
Expand Down
2 changes: 1 addition & 1 deletion src/tree/registries/Azure/AzureRegistryDataProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import type { Registry as AcrRegistry, RegistryListCredentialsResult } from '@azure/arm-containerregistry';
import { AzureSubscription, VSCodeAzureSubscriptionProvider } from '@microsoft/vscode-azext-azureauth';
import { VSCodeAzureSubscriptionProvider, type AzureSubscription } from '@microsoft/vscode-azext-azureauth';
import { IActionContext, callWithTelemetryAndErrorHandling } from '@microsoft/vscode-azext-utils';
import { RegistryV2DataProvider, V2Registry, V2RegistryItem, V2Repository, V2Tag, getContextValue, registryV2Request } from '@microsoft/vscode-docker-registries';
import { CommonRegistryItem, isRegistry, isRegistryRoot, isRepository, isTag } from '@microsoft/vscode-docker-registries/lib/clients/Common/models';
Expand Down
12 changes: 10 additions & 2 deletions src/utils/azureUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
*--------------------------------------------------------------------------------------------*/

import type { ContainerRegistryManagementClient } from '@azure/arm-containerregistry';
import { AzureSubscription } from '@microsoft/vscode-azext-azureauth';
import type { AzureSubscription } from '@microsoft/vscode-azext-azureauth';
import { l10n } from 'vscode';
import { getArmContainerRegistry } from './lazyPackages';

function parseResourceId(id: string): RegExpMatchArray {
const matches: RegExpMatchArray | null = id.match(/\/subscriptions\/(.*)\/resourceGroups\/(.*)\/providers\/(.*)\/(.*)/i);
Expand All @@ -20,5 +21,12 @@ export function getResourceGroupFromId(id: string): string {
}

export async function createAzureContainerRegistryClient(subscriptionItem: AzureSubscription): Promise<ContainerRegistryManagementClient> {
return new (await import('@azure/arm-containerregistry')).ContainerRegistryManagementClient(subscriptionItem.credential, subscriptionItem.subscriptionId);
const armContainerRegistry = await getArmContainerRegistry();
return new armContainerRegistry.ContainerRegistryManagementClient(
subscriptionItem.credential,
subscriptionItem.subscriptionId,
{
endpoint: subscriptionItem.environment.resourceManagerEndpointUrl
}
);
}

0 comments on commit ea21b37

Please sign in to comment.