From 570f8e5528169800cb6dc1de8c8c966966b6dc04 Mon Sep 17 00:00:00 2001 From: Thomas Kappler Date: Mon, 27 Jan 2025 11:35:34 +0100 Subject: [PATCH 1/2] Bump and simplify version requirement for the az CLI --- provider/pkg/provider/auth.go | 12 +++++------- provider/pkg/provider/auth_test.go | 3 +-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/provider/pkg/provider/auth.go b/provider/pkg/provider/auth.go index d75947180c85..2ceca77fbfb7 100644 --- a/provider/pkg/provider/auth.go +++ b/provider/pkg/provider/auth.go @@ -212,19 +212,17 @@ func getAzVersion() (*goversion.Version, error) { } func assertAzVersion(version *goversion.Version) error { - const versionHint = `Please make sure that the Azure CLI is installed in a version either -between 2.0.81 and 2.33, or at least 2.37 but less than 3.x; or configure another authentication -method. See https://www.pulumi.com/registry/packages/azure-native/installation-configuration/#credentials + const versionHint = `Please make sure that the Azure CLI is installed in a version of at least 2.37 but less than +3.x; or configure another authentication method. See +https://www.pulumi.com/registry/packages/azure-native/installation-configuration/#credentials for more information.` // We need this version because it doesn't print the error of #1565 - lowerOkRange := goversion.MustConstraints(goversion.NewConstraint(">=2.0.81, <2.34")) - upperOkRange := goversion.MustConstraints(goversion.NewConstraint(">=2.37.0, <3")) + versionRange := goversion.MustConstraints(goversion.NewConstraint(">=2.37.0, <3")) - if !lowerOkRange.Check(version) && !upperOkRange.Check(version) { + if !versionRange.Check(version) { return fmt.Errorf("found incompatible az version %s. %s", version, versionHint) } - return nil } diff --git a/provider/pkg/provider/auth_test.go b/provider/pkg/provider/auth_test.go index 97a74165f089..9ffd24b616b0 100644 --- a/provider/pkg/provider/auth_test.go +++ b/provider/pkg/provider/auth_test.go @@ -15,12 +15,11 @@ import ( func TestAcceptedAzVersions(t *testing.T) { goodVersions := []string{ - "2.0.81", "2.0.82", "2.1.81", "2.20", "2.33", "2.33.9", "2.37", "2.37.1", "2.38", "2.40", "2.99.99", } badVersions := []string{ "1", - "2", "2.0.80", "2.34", "2.34.1", "2.35", "2.36", "2.36.6", + "2", "2.0.80", "2.0.81", "2.1.81", "2.20", "2.33", "2.36.6", "3", "3.0.1", "3.5", "4", } From 36d0bb2cee33cc24d2758fa844c1e33ce1f893ad Mon Sep 17 00:00:00 2001 From: Thomas Kappler Date: Mon, 27 Jan 2025 11:38:54 +0100 Subject: [PATCH 2/2] Drive-by fix of path conflicts error message --- provider/pkg/gen/schema.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/provider/pkg/gen/schema.go b/provider/pkg/gen/schema.go index c94938fac5f6..5b5487f5e560 100644 --- a/provider/pkg/gen/schema.go +++ b/provider/pkg/gen/schema.go @@ -357,7 +357,7 @@ func PulumiSchema(rootDir string, modules openapi.AzureModules, versioning Versi // When a resource maps to more than one API path, it's a conflict and we need to detect and report it. #2495 isReleaseBuild := len(providerVersion.Build) == 0 if providerVersion.Major >= 3 && isReleaseBuild && resourcesPathTracker.hasConflicts() { - return nil, fmt.Errorf("path conflicts detected. You probably need to add a case to schema.go/dedupResourceNameByPath.\n%+v", resourcesPathTracker.pathConflicts) + return nil, fmt.Errorf("path conflicts detected. You probably need to add a case to resources.go/ResourceName.\n%+v", resourcesPathTracker.pathConflicts) } err := genMixins(&pkg, &metadata)