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

Don't try to install provider during schema loading unless missing #13305

Merged
merged 1 commit into from Jun 28, 2023

Conversation

Frassle
Copy link
Member

@Frassle Frassle commented Jun 28, 2023

Description

Fixes pulumi/pulumi-terraform-bridge#1247

When running tfgen the provider plugin is generally only available on PATH, not in the plugins directory. The schema loader was only checking the plugins directory to decided if it had a resource provider already installed, and so sent off lots of github requests to lookup latest versions of plugins while running example conversion.

This changes the schema loader to use the same logic we use elsewhere where we try to use the provider (which will also look at PATH) and then if we get a missing plugin error we'll do the install and then try again.

I've also moved the SetKnownPluginDownloadURL call into workspace.InstallPlugin so we don't forget to call it before passing specs in.

Finally I've also removed the InstallPlugin method from Host as the only place it was used was in the schema loader, which is now using workspace.InstallPlugin like everywhere else.

Checklist

  • I have run make tidy to update any new dependencies
  • I have run make lint to verify my code passes the lint check
    • I have formatted my code using gofumpt
  • I have added tests that prove my fix is effective or that my feature works
  • I have run make changelog and committed the changelog/pending/<file> documenting my change
  • Yes, there are changes in this PR that warrants bumping the Pulumi Cloud API version

@pulumi-bot
Copy link
Contributor

pulumi-bot commented Jun 28, 2023

Changelog

[uncommitted] (2023-06-28)

Bug Fixes

  • [sdkgen] Fix loading schemas from providers on PATH.
    #13305

Fixes pulumi/pulumi-terraform-bridge#1247

When running tfgen the provider plugin is generally only available on
PATH, not in the plugins directory. The schema loader was only checking
the plugins directory to decided if it had a resource provider already
installed, and so sent off lots of github requests to lookup latest
versions of plugins while running example conversion.

This changes the schema loader to use the same logic we use elsewhere
where we try to use the provider (which will also look at PATH) and then
if we get a missing plugin error we'll do the install and then try
again.

I've also moved the `SetKnownPluginDownloadURL` call into
workspace.InstallPlugin so we don't forget to call it before passing
specs in.

Finally I've also removed the InstallPlugin method from Host as the only
place it was used was in the schema loader, which is now using
workspace.InstallPlugin like everywhere else.
@Frassle Frassle requested a review from a team June 28, 2023 15:05
@Frassle
Copy link
Member Author

Frassle commented Jun 28, 2023

bors merge

@bors
Copy link
Contributor

bors bot commented Jun 28, 2023

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot merged commit 301a6ce into master Jun 28, 2023
42 checks passed
@bors bors bot deleted the fraser/fixPluginInstall branch June 28, 2023 16:36
AaronFriel added a commit to pulumi/pulumi-aws that referenced this pull request Jun 30, 2023
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.

Plugin download issue during build: 404 HTTP error fetching plugin
3 participants