From bac8315822cfcbdcba7c5628c03d3ab2401e1149 Mon Sep 17 00:00:00 2001 From: Kyle Pitzen Date: Tue, 22 Nov 2022 09:35:34 -0500 Subject: [PATCH 1/5] Bumps grpcio to version 1.50 Currently, pinning to a version of grpcio <1.50 can cause build errors on newer versions of python+pip - the existing setup.py install method of building libararies is being deprecated and wheels are not being backported for older versions of grpcio. Since this change is a no-op as far as our python proto clients are concerned, it feels safe to bump to a version that will be supported going forward --- .../pending/20221122--sdk-python--bumps-grpcio-to-1-50.yaml | 4 ++++ proto/.checksum.txt | 2 +- proto/build-container/Dockerfile | 4 ++-- sdk/python/lib/setup.py | 2 +- sdk/python/requirements.txt | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 changelog/pending/20221122--sdk-python--bumps-grpcio-to-1-50.yaml diff --git a/changelog/pending/20221122--sdk-python--bumps-grpcio-to-1-50.yaml b/changelog/pending/20221122--sdk-python--bumps-grpcio-to-1-50.yaml new file mode 100644 index 000000000000..f72a61383654 --- /dev/null +++ b/changelog/pending/20221122--sdk-python--bumps-grpcio-to-1-50.yaml @@ -0,0 +1,4 @@ +changes: +- type: chore + scope: sdk/python + description: Bumps grpcio to 1.50 diff --git a/proto/.checksum.txt b/proto/.checksum.txt index 781af4a284bd..eef406394b55 100644 --- a/proto/.checksum.txt +++ b/proto/.checksum.txt @@ -1,4 +1,4 @@ -283055245 2069 proto/build-container/Dockerfile +3850377987 2069 proto/build-container/Dockerfile 3003861496 625 proto/build-container/scripts/install-go.sh 853251015 873 proto/build-container/scripts/install-node.sh 2003827277 549 proto/build-container/scripts/install-packages.sh diff --git a/proto/build-container/Dockerfile b/proto/build-container/Dockerfile index 512648c03f3d..80fcc66de82d 100644 --- a/proto/build-container/Dockerfile +++ b/proto/build-container/Dockerfile @@ -54,6 +54,6 @@ RUN PROTOC_VERSION=3.20.1 \ PROTOC_GEN_GO_VERSION=1.5.2 \ NODEJS_GRPC_VERSION=1.24.2 \ NODEJS_GRPC_TOOLS_VERSION=1.8.1 \ - PYTHON_GRPCIO_VERSION=1.49.1 \ - PYTHON_GRPCIO_TOOLS_VERSION=1.49.1 \ + PYTHON_GRPCIO_VERSION=1.50.0 \ + PYTHON_GRPCIO_TOOLS_VERSION=1.50.0 \ /build-scripts/install-protobuf-tools.sh \ No newline at end of file diff --git a/sdk/python/lib/setup.py b/sdk/python/lib/setup.py index b6addde69127..1eefaa8dc752 100644 --- a/sdk/python/lib/setup.py +++ b/sdk/python/lib/setup.py @@ -45,7 +45,7 @@ def readme(): # Keep this list in sync with Pipfile install_requires=[ 'protobuf~=4.21', - 'grpcio==1.47', + 'grpcio==1.50', 'dill~=0.3', 'six~=1.12', 'semver~=2.8', diff --git a/sdk/python/requirements.txt b/sdk/python/requirements.txt index 4f0f7a6452a9..220e281cddfe 100644 --- a/sdk/python/requirements.txt +++ b/sdk/python/requirements.txt @@ -1,7 +1,7 @@ # Packages needed by the library. # Keep this list in sync with setup.py. protobuf~=4.21 -grpcio==1.47 +grpcio==1.50 dill~=0.3 six~=1.12 semver~=2.8 From 724fae5c4888e7fd7d98605f3266fa2f0257d636 Mon Sep 17 00:00:00 2001 From: Ian Wahbe Date: Tue, 22 Nov 2022 12:44:19 -0800 Subject: [PATCH 2/5] Mark external modules as forign Previously, the names of forign types in the top level were omitted, since the top level module is always "". Apply the same fix for enum types. --- pkg/codegen/go/gen.go | 11 +++++++---- pkg/codegen/go/gen_program_expressions.go | 6 ++++-- pkg/codegen/testing/test/program_driver.go | 2 -- .../testdata/aws-webserver-pp/go/aws-webserver.go | 6 +++--- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/pkg/codegen/go/gen.go b/pkg/codegen/go/gen.go index 029f2ef7e03f..2b230857575e 100644 --- a/pkg/codegen/go/gen.go +++ b/pkg/codegen/go/gen.go @@ -40,6 +40,11 @@ import ( "github.com/pulumi/pulumi/sdk/v3/go/common/util/contract" ) +// A signifier that the module is external, and will never match. +// +// This token is always an invalid module since ':' is not allowed within modules. +const ExternalModuleSig = ":always-external:" + type typeDetails struct { // Note: if any of {ptr,array,map}Input are set, input and the corresponding output field must also be set. The // mark* functions ensure that these invariants hold. @@ -242,10 +247,7 @@ func (pkg *pkgContext) resolveEnumType(t *schema.EnumType) string { } extPkgCtx, _ := pkg.contextForExternalReference(t) - enumType := extPkgCtx.tokenToEnum(t.Token) - if !strings.Contains(enumType, ".") { - enumType = fmt.Sprintf("%s.%s", extPkgCtx.pkg.Name, enumType) - } + enumType := extPkgCtx.typeString(t) return enumType } @@ -730,6 +732,7 @@ func (pkg *pkgContext) contextForExternalReference(t schema.Type) (*pkgContext, extPkgCtx.pkgImportAliases = pkgImportAliases extPkgCtx.externalPackages = pkg.externalPackages mod := tokenToPackage(extPkg, goInfo.ModuleToPackage, token) + extPkgCtx.mod = ExternalModuleSig return extPkgCtx, *maps[mod].detailsForType(t) } diff --git a/pkg/codegen/go/gen_program_expressions.go b/pkg/codegen/go/gen_program_expressions.go index 7214004b5d9e..b651afb06d22 100644 --- a/pkg/codegen/go/gen_program_expressions.go +++ b/pkg/codegen/go/gen_program_expressions.go @@ -168,8 +168,10 @@ func (g *generator) genSafeEnum(w io.Writer, to *model.EnumType) func(member *sc } memberTag, err := makeSafeEnumName(memberTag, enumName) contract.AssertNoErrorf(err, "Enum is invalid") - namespace := tokenToModule(to.Token) - g.Fgenf(w, "%s.%s", namespace, memberTag) + pkg, mod, _, _ := pcl.DecomposeToken(to.Token, to.SyntaxNode().Range()) + mod = g.getModOrAlias(pkg, mod, mod) + + g.Fgenf(w, "%s.%s", mod, memberTag) } } diff --git a/pkg/codegen/testing/test/program_driver.go b/pkg/codegen/testing/test/program_driver.go index 23645bc96ed4..7e086de4f576 100644 --- a/pkg/codegen/testing/test/program_driver.go +++ b/pkg/codegen/testing/test/program_driver.go @@ -113,8 +113,6 @@ var PulumiPulumiProgramTests = []ProgramTest{ { Directory: "aws-webserver", Description: "AWS Webserver", - SkipCompile: codegen.NewStringSet("go"), - // Blocked on go: TODO[pulumi/pulumi#8070] }, { Directory: "simple-range", diff --git a/pkg/codegen/testing/test/testdata/aws-webserver-pp/go/aws-webserver.go b/pkg/codegen/testing/test/testdata/aws-webserver-pp/go/aws-webserver.go index 1e27a98c5987..863264cfe555 100644 --- a/pkg/codegen/testing/test/testdata/aws-webserver-pp/go/aws-webserver.go +++ b/pkg/codegen/testing/test/testdata/aws-webserver-pp/go/aws-webserver.go @@ -25,9 +25,9 @@ func main() { if err != nil { return err } - ami, err := aws.GetAmi(ctx, &GetAmiArgs{ - Filters: []GetAmiFilter{ - GetAmiFilter{ + ami, err := aws.GetAmi(ctx, &aws.GetAmiArgs{ + Filters: []aws.GetAmiFilter{ + aws.GetAmiFilter{ Name: "name", Values: []string{ "amzn-ami-hvm-*-x86_64-ebs", From bff689c80b44fe1ddb0200d979548684a6bf66f2 Mon Sep 17 00:00:00 2001 From: Ian Wahbe Date: Tue, 22 Nov 2022 15:47:36 -0800 Subject: [PATCH 3/5] Cleanup import generation --- pkg/codegen/go/gen_program.go | 62 ++++++++++++++--------------------- 1 file changed, 25 insertions(+), 37 deletions(-) diff --git a/pkg/codegen/go/gen_program.go b/pkg/codegen/go/gen_program.go index 93268790320d..602b6a02173a 100644 --- a/pkg/codegen/go/gen_program.go +++ b/pkg/codegen/go/gen_program.go @@ -363,7 +363,7 @@ func (g *generator) collectImports( program *pcl.Program, stdImports, pulumiImports, - preambleHelperMethods codegen.StringSet) (codegen.StringSet, codegen.StringSet, codegen.StringSet) { + preambleHelperMethods codegen.StringSet) { // Accumulate import statements for the various providers for _, n := range program.Nodes { if r, isResource := n.(*pcl.Resource); isResource { @@ -432,8 +432,6 @@ func (g *generator) collectImports( }) contract.Assert(len(diags) == 0) } - - return stdImports, pulumiImports, preambleHelperMethods } func (g *generator) collectConvertImports( @@ -492,48 +490,38 @@ func (g *generator) getGoPackageInfo(pkg string) (GoPackageInfo, bool) { return info, ok } -func (g *generator) getPulumiImport(pkg, vPath, mod, name string) string { - info, _ := g.getGoPackageInfo(pkg) - if m, ok := info.ModuleToPackage[mod]; ok { - mod = m - } +func (g *generator) getPulumiImport(pkg, versionPath, mod, name string) string { + // We do this before we let the user set overrides. That way the user can still have a + // module named IndexToken. + info, _ := g.getGoPackageInfo(pkg) // We're allowing `info` to be zero-initialized - imp := fmt.Sprintf("github.com/pulumi/pulumi-%s/sdk%s/go/%s/%s", pkg, vPath, pkg, mod) - // namespaceless invokes "aws:index:..." - if mod == "" { - imp = fmt.Sprintf("github.com/pulumi/pulumi-%s/sdk%s/go/%s", pkg, vPath, pkg) - } + importPath := func(mod string) string { + importBasePath := info.ImportBasePath + if importBasePath == "" { + importBasePath = fmt.Sprintf("github.com/pulumi/pulumi-%s/sdk%s/go/%s", pkg, versionPath, pkg) + } - // All providers don't follow the sdk/go/ scheme. Allow ImportBasePath as - // a means to override this assumption. - if info.ImportBasePath != "" { - if mod != "" { - imp = fmt.Sprintf("%s/%s", info.ImportBasePath, mod) - } else { - imp = info.ImportBasePath + if mod != "" && mod != IndexToken { + return fmt.Sprintf("%s/%s", importBasePath, mod) } + return importBasePath } - if alias, ok := info.PackageImportAliases[imp]; ok { - return fmt.Sprintf("%s %q", alias, imp) + if m, ok := info.ModuleToPackage[mod]; ok { + mod = m } - modSplit := strings.Split(mod, "/") - // account for mods like "eks/ClusterVpcConfig" index... - if len(modSplit) > 1 { - if modSplit[0] == "" || modSplit[0] == IndexToken { - imp = fmt.Sprintf("github.com/pulumi/pulumi-%s/sdk%s/go/%s", pkg, vPath, pkg) - if info.ImportBasePath != "" { - imp = info.ImportBasePath - } - } else { - imp = fmt.Sprintf("github.com/pulumi/pulumi-%s/sdk%s/go/%s/%s", pkg, vPath, pkg, modSplit[0]) - if info.ImportBasePath != "" { - imp = fmt.Sprintf("%s/%s", info.ImportBasePath, modSplit[0]) - } - } + path := importPath(mod) + if alias, ok := info.PackageImportAliases[path]; ok { + return fmt.Sprintf("%s %q", alias, path) } - return fmt.Sprintf("%q", imp) + + // Trim off anything after the first '/'. + // This handles transforming modules like s3/bucket to s3 (as found in + // aws:s3/bucket:Bucket). + mod = strings.SplitN(mod, "/", 2)[0] + + return fmt.Sprintf("%#v", importPath(mod)) } // genPostamble closes the method From 648a37777f495b2735e5e73e62a2818c49aff80a Mon Sep 17 00:00:00 2001 From: github-actions Date: Wed, 23 Nov 2022 00:12:47 +0000 Subject: [PATCH 4/5] chore: changelog for v3.47.2 --- CHANGELOG.md | 14 ++++++++++++++ ...mpt-to-up-to-use-experimental-update-plans.yaml | 4 ---- ...atches-when-using-input-values-for-outputs.yaml | 4 ---- 3 files changed, 14 insertions(+), 8 deletions(-) delete mode 100644 changelog/pending/20221115--cli--add-prompt-to-up-to-use-experimental-update-plans.yaml delete mode 100644 changelog/pending/20221121--sdk-python--dont-error-on-type-mismatches-when-using-input-values-for-outputs.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index c72a4638d856..d4d9d4fe854e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 3.47.2 (2022-11-22) + + +### Features + +- [cli] Add prompt to `up` to use experimental update plans. + [#11353](https://github.com/pulumi/pulumi/pull/11353) + + +### Bug Fixes + +- [sdk/python] Don't error on type mismatches when using input values for outputs + [#11422](https://github.com/pulumi/pulumi/pull/11422) + ## 3.47.1 (2022-11-18) diff --git a/changelog/pending/20221115--cli--add-prompt-to-up-to-use-experimental-update-plans.yaml b/changelog/pending/20221115--cli--add-prompt-to-up-to-use-experimental-update-plans.yaml deleted file mode 100644 index 1e6ba8ec6631..000000000000 --- a/changelog/pending/20221115--cli--add-prompt-to-up-to-use-experimental-update-plans.yaml +++ /dev/null @@ -1,4 +0,0 @@ -changes: -- type: feat - scope: cli - description: Add prompt to `up` to use experimental update plans. diff --git a/changelog/pending/20221121--sdk-python--dont-error-on-type-mismatches-when-using-input-values-for-outputs.yaml b/changelog/pending/20221121--sdk-python--dont-error-on-type-mismatches-when-using-input-values-for-outputs.yaml deleted file mode 100644 index d5c043894196..000000000000 --- a/changelog/pending/20221121--sdk-python--dont-error-on-type-mismatches-when-using-input-values-for-outputs.yaml +++ /dev/null @@ -1,4 +0,0 @@ -changes: -- type: fix - scope: sdk/python - description: Don't error on type mismatches when using input values for outputs From 1c521a4b80996d764048f1c4618ff0e2cf60d358 Mon Sep 17 00:00:00 2001 From: github-actions Date: Wed, 23 Nov 2022 00:14:22 +0000 Subject: [PATCH 5/5] chore: post-release go.mod updates --- pkg/go.mod | 2 +- tests/go.mod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/go.mod b/pkg/go.mod index b77efdb8f264..04a8ae37a214 100644 --- a/pkg/go.mod +++ b/pkg/go.mod @@ -36,7 +36,7 @@ require ( github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d github.com/opentracing/opentracing-go v1.2.0 github.com/pgavlin/goldmark v1.1.33-0.20200616210433-b5eb04559386 - github.com/pulumi/pulumi/sdk/v3 v3.47.1 + github.com/pulumi/pulumi/sdk/v3 v3.47.2 github.com/santhosh-tekuri/jsonschema/v5 v5.0.0 github.com/sergi/go-diff v1.2.0 github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 diff --git a/tests/go.mod b/tests/go.mod index 46ced06885e6..1fab060ea6c0 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -12,7 +12,7 @@ require ( github.com/blang/semver v3.5.1+incompatible github.com/golang/protobuf v1.5.2 github.com/pulumi/pulumi/pkg/v3 v3.34.1 - github.com/pulumi/pulumi/sdk/v3 v3.47.1 + github.com/pulumi/pulumi/sdk/v3 v3.47.2 github.com/stretchr/testify v1.8.0 google.golang.org/grpc v1.49.0 sourcegraph.com/sourcegraph/appdash v0.0.0-20211028080628-e2786a622600