Skip to content
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

chore: remove minimal schema from source #4829

Merged
merged 6 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 0 additions & 50 deletions .github/workflows/aws-minimal-schema.yml

This file was deleted.

1 change: 1 addition & 0 deletions .mk/minimal_schema.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ bin/linux-arm64/$(PROVIDER): minimal_schema_no_deps
bin/darwin-amd64/$(PROVIDER): minimal_schema_no_deps
bin/darwin-arm64/$(PROVIDER): minimal_schema_no_deps
bin/windows-amd64/$(PROVIDER).exe: minimal_schema_no_deps
provider_no_deps: minimal_schema_no_deps
3 changes: 0 additions & 3 deletions provider/cmd/pulumi-resource-aws/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,4 @@ func main() {
}); err != nil {
log.Fatal(err)
}

// Also compute the embedded version of the minimal schema.
embedMinimalSchema(version)
}
25 changes: 14 additions & 11 deletions provider/cmd/pulumi-resource-aws/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
package main

import (
"bytes"
"compress/gzip"
"context"
_ "embed"
"embed"
"io"
"os"

Expand All @@ -30,16 +29,15 @@ import (
"github.com/pulumi/pulumi/sdk/v3/go/common/util/contract"
)

//go:embed schema-embed.json
var pulumiSchema []byte

//go:embed schema-minimal-embed.json
var pulumiMinimalSchema []byte
//go:embed schema*embed.json
var schemas embed.FS

// The data in the minimal schema is compressed with GZIP to avoid bloating the provider size at the cost of slightly
// slower init for uses of the feature.
func decompressMinimalSchema() []byte {
reader, err := gzip.NewReader(bytes.NewReader(pulumiMinimalSchema))
reader0, err := schemas.Open("schema-minimal-embed.json")
contract.AssertNoErrorf(err, "Failed to open a reader into the embedded schema-minimal-embed.json")
reader, err := gzip.NewReader(reader0)
contract.AssertNoErrorf(err, "Failed to open a reader into schema-minimal-embed.json")
bytes, err := io.ReadAll(reader)
contract.AssertNoErrorf(err, "Failed to read schema-minimal-embed.json")
Expand All @@ -50,10 +48,15 @@ func main() {
ctx := context.Background()
info := aws.Provider()

s := pulumiSchema
var schemaBytes []byte
if cmdutil.IsTruthy(os.Getenv("PULUMI_AWS_MINIMAL_SCHEMA")) {
s = decompressMinimalSchema()
schemaBytes = decompressMinimalSchema()
} else {
schemaReader, err := schemas.Open("schema-embed.json")
contract.AssertNoErrorf(err, "Failed to open a reader into the embedded schema-embed.json")
schemaBytes, err = io.ReadAll(schemaReader)
contract.AssertNoErrorf(err, "Failed to read schema-embed.json")
}

pf.MainWithMuxer(ctx, "aws", *info, s)
pf.MainWithMuxer(ctx, "aws", *info, schemaBytes)
}
Loading
Loading