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
Add split Go SDK #1934
Add split Go SDK #1934
Conversation
I think we need that in platform for some things anyway. We want to generate some types into the core sdk, but just the code files none of the project related stuff (i.e. no .csproj, go.mod, etc). I think that option would work for you here as well. |
094a376
to
b15bdc8
Compare
8c665a9
to
5c3076e
Compare
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.
Pair review with @thomas11
Document & changelog
d4aa065
to
b2de4d5
Compare
6ddbe11
to
2a799b9
Compare
- Maintain the commit hash from the build of the version number. - Add simple unit test suite of examples. - Output version to a file in the go SDK. - Add readme to the Go SDK. - When publishing Go, use the version from the version.txt to keep it all aligned.
Does the PR have any schema changes?Looking good! No breaking changes found. |
*Fix to use US spelling
8fc1bf2
to
d287217
Compare
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/can we add an acceptance test for this?
|
||
require ( | ||
github.com/blang/semver v3.5.1+incompatible | ||
github.com/pkg/errors v0.9.1 |
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.
Didn't realize we were still depending on pkg/errors...
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.
One general question would be how we update this template if versions change or we need additional dependencies added etc. Do you have thoughts on documenting a dev loop for this?
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.
No idea on what we actually use. This is taken from our currently manually committed go.mod in the sdk
folder which we currently manually maintain. I can add something to the contributing docs around updating this. Long term, I think codegen should be generating these dependencies - so they can be upgraded based on what the generated code will need - similar in approach to this issue around Python dependencies
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.
Just checked and apparently we do actually use that package in the generated SDK.
76de102
to
8a78904
Compare
So, not entirely straightforward to figure out, but it seems like it should work! |
Does the PR have any schema changes?Looking good! No breaking changes found. |
@viveklak doesn't look like program tests are likely to work at the time. Worth just doing a quiet release alongside the old SDK so we can continue testing against an actual real release? |
8a78904
to
4ddb85b
Compare
Does the PR have any schema changes?Looking good! No breaking changes found. |
sdk/pulumi-azure-native-sdk
to match new pulumi-azure-native-sdk repositorygo.mod
files as part of codegen (based on directories withinit.go
files).latest
if not available.go_prepublish
target to stripgo.sum
files andgo.mod
replace directivesOutstanding issues:
Original investigation notes
Investigation into solving #1930 as a proof of concept and to decide a route forward.
Either approach below would be best combined with committing the new go SDK into a new repo such as
pulumi-azure-sdk
as ~200 tags will need to be added on each release, and it adds significantly more code.Add go.mod files to the original structure
Pros: The core generation is almost identical, just with extra files appended
Have to reference the root sdk module of the same version. This would require publishing the root SDK first with the new version number, then pulling in the new version number into the per-module go.mod then publishing each after.
We really need the provider to be included in each sub-module directly to remove any internal dependencies between modules that have to be published together.
Split the schema and then generate independently
This results in every module having its own provider class (and config). This doesn't affect when using the default provider, but would look a little more messy with explicit providers.
Split by modifying discovery glob - makes discovery really quick for single modules.
Go package name is calculated from end of importBasePath in go language config.
authorization
,storate
andsynapse
seem to be mixins - not from specs. Could add options to skip adding these, have just filtered them out by token for now.Generate the go.mod and add to list of files to emit.
Optional: Remove Double Nesting
Go module is at something like
github.com/pulumi/pulumi-azure-native-sdk/compute
. Codegen wants to create a secondcompute
folder within that, but that's not great to have to importgithub.com/pulumi/pulumi-azure-native-sdk/compute/compute
.How do we avoid the double nesting of module name in Go when there's only one module? Could manually change the paths for now. Should we just live with double nesting for now?
There's separate init files in the root and module folders. The root file has construct provider and registers resource package. The module file has the resource "construct" method and registers resource module. Seems like we can just rename the module init file on moving, then fix the import used for the PkgVersion.
Opportunities to improve core codegen
Out of scope