-
Notifications
You must be signed in to change notification settings - Fork 43
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
Do not wipe the version when generating schemas for dynamic providers #2727
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2727 +/- ##
==========================================
+ Coverage 69.53% 69.63% +0.10%
==========================================
Files 301 301
Lines 38655 38725 +70
==========================================
+ Hits 26878 26968 +90
+ Misses 10257 10241 -16
+ Partials 1520 1516 -4 ☔ View full report in Codecov by Sentry. |
pkg/tfgen/generate.go
Outdated
// For pulumi-owned (not dynamically bridged) providers, omit the version so that the spec is stable | ||
// if the version is e.g. derived from the current Git commit hash. | ||
if strings.Contains(g.info.Repository, "pulumi") { | ||
pulumiPackageSpec.Version = "" | ||
} |
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 check doesn't do what the comment says. Specifically, it doesn't test pulumi-owned. I'm concerned that this will break external users who set .Repository
to the wrong value (or didn't set it). Can we add restoring the version to the post-process script instead?
dynamic/info.go | 1 +
dynamic/main.go | 1 +
2 files changed, 2 insertions(+)
diff --git a/dynamic/info.go b/dynamic/info.go
index d5b05fbc..76fea320 100644
--- a/dynamic/info.go
+++ b/dynamic/info.go
@@ -79,6 +79,7 @@ func providerInfo(ctx context.Context, p run.Provider, value parameterize.Value)
},
Parameter: value.Marshal(),
}
+ spec.Version = p.Version()
},
}
// Add presumed best-effort GitHub org to the provider info.
diff --git a/dynamic/main.go b/dynamic/main.go
index 0a97b970..ce8e387b 100644
--- a/dynamic/main.go
+++ b/dynamic/main.go
@@ -62,6 +62,7 @@ func initialSetup() (info.Provider, pfbridge.ProviderMetadata, func() error) {
spec.Attribution = ""
spec.Provider = schema.ResourceSpec{}
spec.Language = nil
+ spec.Version = version.Version()
},
}
71764f7
to
ab8f8ac
Compare
Hmmm, this doesn't actually seem like it fixes the schemas. |
This PR has been shipped in release v3.98.0. |
#2664 introduced using the full Generator for schema gen.
This added a call to UnstableGenerateFromSchema, which removes the version field from the package spec, a feature intended to make local builds stable.
This pull request re-adds the version in
SchemaPostProcessor
.