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

Apply default dependencies when called from Pulumi CLI #1501

Merged
merged 4 commits into from
Dec 11, 2024

Conversation

danielrbradley
Copy link
Member

@danielrbradley danielrbradley commented Dec 11, 2024

The pulumi package gen-sdk command calls GeneratePackage directly, so we need to apply the defaults at that layer rather than in the pulumi-java-gen specific code.

Fixes #1500

The `pulumi package gen-sdk` command calls `GeneratePackage` directly, so we need to apply the defaults at that layer rather than in the pulumi-java-gen specific code.
@danielrbradley danielrbradley requested a review from t0yv0 December 11, 2024 15:53
@danielrbradley danielrbradley self-assigned this Dec 11, 2024
@danielrbradley danielrbradley requested a review from a team as a code owner December 11, 2024 15:53
Copy link
Contributor

@lunaris lunaris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good -- thanks for raising!

- Need to assign back to a new variable.
- Assign before turning into a pointer.
- Update changelog
@danielrbradley
Copy link
Member Author

danielrbradley commented Dec 11, 2024

From local testing I can confirm this fixes two of the three missing dependencies in pulumi/pulumi-azure-native#3776

However, the third missing dependency is actually the Pulumi Java SDK itself. This is added when calling the pulumi-java-gen binary directly because the build process bakes in the version number. However, AFAIK there's no way for a Go package to fetch its own version automatically.

Question for @lunaris and @Frassle: do we just hard code the self-reference and manually bump it as required or should we do something clever like letting the pulumi/cmd set the verison?

Without the pulumi java dependency the SDK is not buildable. We can't infer this at build time because go modules don't have a 'build phase' and can't lookup their own version.
@Frassle
Copy link
Member

Frassle commented Dec 11, 2024

do we just hard code the self-reference and manually bump it as required or should we do something clever like letting the pulumi/cmd set the verison?

We add it as a linker flag when building. https://github.com/pulumi/pulumi-java/blob/main/.goreleaser.yml#L22

@danielrbradley
Copy link
Member Author

danielrbradley commented Dec 11, 2024

We add it as a linker flag when building. https://github.com/pulumi/pulumi-java/blob/main/.goreleaser.yml#L22

That's fine when building the binary, but for pulumi package gen-sdk it's running this code as a go module reference, so doesn't get the version injected because there's no "build time". Unless I'm missing something about how we release the go package?

@blampe
Copy link
Contributor

blampe commented Dec 11, 2024

Also unblocks pulumi/pulumi-kubernetes#3151

@Frassle
Copy link
Member

Frassle commented Dec 11, 2024

That's fine when building the binary, but for pulumi package gen-sdk it's running this code as a go module reference, so doesn't get the version injected because there's no "build time". Unless I'm missing something about how we release the go package?

Oh right yeh. We plan on moving this code to run over grpc so it will actually be in the build pulumi-language-java binary. Probably easier to just wait for that change. I imagine we're close to switching over, I think the java binary does now support these rpc calls.

@danielrbradley
Copy link
Member Author

Ok, will stick with the hard coded default for now but can override that when we do the grpc plugin change.

@danielrbradley danielrbradley merged commit 8f88a80 into main Dec 11, 2024
23 checks passed
@danielrbradley danielrbradley deleted the fix-1500-default-dependencies branch December 11, 2024 18:55
danielrbradley added a commit to pulumi/pulumi-azure-native that referenced this pull request Dec 12, 2024
New Pulumi CLI version includes bump to Java which includes the fix for the missing dependencies: pulumi/pulumi-java#1501
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Default dependencies not added when caled from pulumi package gen-sdk
4 participants