-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[codegen/go] Emit pulumiplugin.json
as part of codegen
#8530
Conversation
Test changes will follow in a later commit.
Diff for pulumi-azuread with merge commit 4770251 |
Diff for pulumi-random with merge commit 4770251 |
Diff for pulumi-azuread with merge commit c93c83e |
Diff for pulumi-random with merge commit c93c83e |
Diff for pulumi-gcp with merge commit 4770251 |
Diff for pulumi-kubernetes with merge commit 4770251 |
Diff for pulumi-kubernetes with merge commit c93c83e |
Diff for pulumi-gcp with merge commit c93c83e |
Diff for pulumi-azure with merge commit 4770251 |
Diff for pulumi-azure with merge commit c93c83e |
Diff for pulumi-aws with merge commit c93c83e |
Diff for pulumi-aws with merge commit 4770251 |
Codecov Report
@@ Coverage Diff @@
## master #8530 +/- ##
==========================================
+ Coverage 58.61% 58.64% +0.03%
==========================================
Files 634 634
Lines 96844 96877 +33
Branches 1378 1378
==========================================
+ Hits 56762 56815 +53
+ Misses 36819 36796 -23
- Partials 3263 3266 +3
Continue to review full report at Codecov.
|
Diff for pulumi-azure-native with merge commit 4770251 |
Diff for pulumi-azure-native with merge commit c93c83e |
if err != nil { | ||
return nil, fmt.Errorf("Failed to format pulumiplugin.json: %w", err) | ||
} | ||
files[path.Join(pathPrefix, "pulumiplugin.json")] = pulumiPlugin |
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.
I'm not sure how we want to handle generating this file for Go. With the change to the Go language host, it's going to be looking for the pulumiplugin.json
file next to go.mod
:
pulumi/sdk/go/pulumi-language-go/main.go
Line 148 in eb735c7
path := filepath.Join(m.Dir, "pulumiplugin.json") |
For example, for pulumi-random, the lang host will be looking for the file in:
but the codegen is currently generating it here:
./sdk/go/random/pulumiplugin.json
Not sure what we want to do about this. Some ideas (I don't love these):
-
Don't generate the file for Go. This would be a little strange since we're now generating the file for Python and .NET. But it does provide the most flexibility for Go. For most providers, you could add the file manually next to the
go.mod
. For the larger providers (i.e. Azure Native) where we're considering breaking it up into multiple modules, we can manually place apulumiplugin.json
next to thego.mod
for all of those modules. -
Update the language host to probe for the file in more places. I'm not sure if there's a good way to do this. Our typical convention is to have
sdk
thengo
then the name of the package likerandom
. So I guess we could have the language host try to look for thepulumiplugin.json
file there. But I'm not sure that convention is always going to be followed, especially considering we may break up Azure Native into multiple modules.
Any other ideas?
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.
Good catch! To make matters even more complicated, sdk/go/random
is a configurable option, it's not hardcoded. The current lookup method requires that pulumiplugin.json
is in the same folder as go.mod
, which makes sense to me. Except that it would mean putting another go specific file in the sdk
folder.
Let me think for a bit.
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.
After discussing offline, I intend to do the following
- Continue to generate
pulumiplugin.json
inm.Dir/go/packagemane
by default. - Unless
rootPackageName
is set. Then I will generatepulumiplugin.json
in the top level directory. It will be the responsibility of the codegen user to move it next togo.mod
. - Change
pulumiplugin.json
lookup to probem.Dir
m.Dir/go
m.Dir/go/${package name}
Diff for pulumi-random with merge commit 18b1e45 |
Diff for pulumi-azuread with merge commit 18b1e45 |
Diff for pulumi-kubernetes with merge commit 18b1e45 |
Diff for pulumi-gcp with merge commit 18b1e45 |
Diff for pulumi-azure with merge commit 18b1e45 |
Diff for pulumi-aws with merge commit 18b1e45 |
Diff for pulumi-azure-native with merge commit 18b1e45 |
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.
LGTM
Description
Fixes #8529
Note:
Checklist