-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compute schema-minimal.json #4587
Conversation
Iterating to make tests happy. |
Does the PR have any schema changes?Looking good! No breaking changes found. Maintainer note: consult the runbook for dealing with any breaking changes. |
Might need #4589 first to get schema in-line with the expected one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense to me. A few questions:
- It looks like it's not specific to AWS - should we find a shared library to put the rewrite function?
- What happens if we generate non-node SDKs with the light schema? Will there be any changes? I would hope for a yes. If so, should we actually generate those SDKs from this schema?
- What are the downsides (if any) of servicing this light schema from provider's gRPC?
|
At a very high-level Mikhail I'm thinking of schema-light as a semi-temporary workaround until we can take the breaks in V7 major, so my default assumption is to invest minimally here to meet the requirements and not over-do it. Let's talk if we envision something more permanent here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a great temp workaround with enough guard rails that we're not gonna regress here. Would be great to see if we can build the SDKs with that
provider/schema_light_test.go
Outdated
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestNoDanglingReferencesInLightSchema(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Good way to ensure we're not regressing!
Agree with all your responses, thank you. One problem is that Cosmic expects to consume this schema via a CLI command, so they will not see the light schema. I'm not sure they are open to changing their tooling to retrieve our schema from our GitHub. But we can ask. I think it's a good suggestion to let them try the result before shipping it. Is this PR ready for me to point them to? |
That is interesting new bit of information, thank you! In that case I can embed the light schema in the provider and make it available through GetSchema() but perhaps under environment variable flag for starters. We can promote this to the default behavior once it matures and we decide it's safe and beneficial. |
This PR has schema-light.json but I need to add the ability to serve it off GetSchema(). Working on it presently. |
72f93d5
to
bb90adc
Compare
Re-generating SDKs other than Node is coming back clean. That's good. Added support for versioning and embedding the light schema in the provider, and dispatching to it through a flag. I might need to fight the tests and CI some more, but PTAL again on the approach. |
Once I get tests to pass I will re-brand this as "minimal". Thanks. |
The standard workflows are great, but sometimes build-time complexity is a necessary evil for temporary or experimental features. One concrete use case is simplifying computing the minimal schema in AWS: pulumi/pulumi-aws#4587 This small change permits providers to define *.mk files to add some provider-specific extensions to Make.
The standard workflows are great, but sometimes build-time complexity is a necessary evil for temporary or experimental features. One concrete use case is simplifying computing the minimal schema in AWS: pulumi/pulumi-aws#4587 This small change permits providers to define *.mk files to add some provider-specific extensions to Make.
- name: Install Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.22.x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The provider is using 1.23 now
Check that minimal schema is up-to-date. | ||
|
||
on: | ||
pull_request: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also run that as part of the release process? That would guard against releasing an inconsistent schema (e.g. when mismerges happen)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I will follow up. I cannot test this workflow before it merges, I'll need some more PRs to get this right.
This PR has been shipped in release v6.56.0. |
Keeping a copy of minimal schema (introduced in #4587) is proving to conflict with Pulumi tooling such as `upgrade-provider` and is not strictly necessary. With this change the minimal schema itself as well as CI checks to make sure it is up to date are removed. Instead it will be computed on-the-fly by the release job as before: - GitHub actions invoke this: https://github.com/pulumi/pulumi-aws/blob/916e6f28039407d7dcb1a295c6f9e43613dd6f87/.github/workflows/build_provider.yml#L60 - Make extension ensures that this runs go generate prior to the actual build so that the minimal schema is re-computed: https://github.com/pulumi/pulumi-aws/blob/916e6f28039407d7dcb1a295c6f9e43613dd6f87/.mk/minimal_schema.mk#L9 Fixes: - #4811 - #4702
Perform automatic rewrites over the schema to remove dangling type references and produce a minimal schema for tool consumption that is distinct from the real schema fed into SDK generation. The "minimal" schema has these properties:
Specifically for Node, the minimal schema may say that a string is accepted where string + concrete type union can actually be used in Node.
By default the minimal schema is not load bearing. It is possible to activate it by setting an environment variable:
With this set,
pulumi-resource-aws
will be serving the minimal schema from theGetSchema()
gRPC method.Also it is possible to generate SDKs based off the minimal schema. Currently this generates exact same SDKs as the normal process for Python, Go, .NET and Java, for example:
Generating Node SDK off the minimal schema produces slight changes. These may break user programs and we do not want to ship this as the main schema just yet. We intend to reconcile them and remove the distinct minimal schema at the next major version of the provider.
Re: #2565