Skip to content

Commit

Permalink
change default audience value for ACR (Azure#20838)
Browse files Browse the repository at this point in the history
* change default audience value and remove live test for China cloud as it always has network issue

* add changelog
  • Loading branch information
tadelesh authored May 17, 2023
1 parent bda7ac8 commit c5a5371
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions sdk/containers/azcontainerregistry/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* Add state restore for hash calculator when upload fails

### Other Changes
* Change default audience to https://containerregistry.azure.net

## 0.1.1 (2023-03-07)

Expand Down
3 changes: 1 addition & 2 deletions sdk/containers/azcontainerregistry/blob_custom_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"errors"
"fmt"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming"
Expand All @@ -38,7 +37,7 @@ func NewBlobClient(endpoint string, credential azcore.TokenCredential, options *
}

if reflect.ValueOf(options.Cloud).IsZero() {
options.Cloud = cloud.AzurePublic
options.Cloud = defaultCloud
}
c, ok := options.Cloud.Services[ServiceName]
if !ok || c.Audience == "" {
Expand Down
2 changes: 1 addition & 1 deletion sdk/containers/azcontainerregistry/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ stages:
ServiceDirectory: 'containers/azcontainerregistry'
RunLiveTests: true
TestRunTime: '30m'
SupportedClouds: 'Public,UsGov,China'
SupportedClouds: 'Public,UsGov'
EnvVars:
AZURE_CLIENT_ID: $(AZCONTAINERREGISTRY_CLIENT_ID)
AZURE_TENANT_ID: $(AZCONTAINERREGISTRY_TENANT_ID)
Expand Down
4 changes: 4 additions & 0 deletions sdk/containers/azcontainerregistry/cloud_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ func init() {
Audience: "https://management.core.windows.net/",
}
}

var defaultCloud = cloud.Configuration{
Services: map[cloud.ServiceName]cloud.ServiceConfiguration{ServiceName: {Audience: defaultAudience}},
}
3 changes: 1 addition & 2 deletions sdk/containers/azcontainerregistry/custom_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ package azcontainerregistry
import (
"errors"
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
"reflect"
Expand All @@ -31,7 +30,7 @@ func NewClient(endpoint string, credential azcore.TokenCredential, options *Clie
}

if reflect.ValueOf(options.Cloud).IsZero() {
options.Cloud = cloud.AzurePublic
options.Cloud = defaultCloud
}
c, ok := options.Cloud.Services[ServiceName]
if !ok || c.Audience == "" {
Expand Down
5 changes: 3 additions & 2 deletions sdk/containers/azcontainerregistry/custom_constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package azcontainerregistry

const (
moduleName = "azcontainerregistry"
moduleVersion = "v0.1.2"
moduleName = "azcontainerregistry"
moduleVersion = "v0.1.2"
defaultAudience = "https://containerregistry.azure.net"
)

0 comments on commit c5a5371

Please sign in to comment.