diff --git a/CHANGELOG.md b/CHANGELOG.md index a98bffd81..d5a907505 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,9 @@ CHANGELOG - Add support for publishing Python policy packs. [#4644](https://github.com/pulumi/pulumi/pull/4644) +- Improve download perf by fetching plugins from a CDN. + [#4692](https://github.com/pulumi/pulumi/pull/4692) + ## 2.2.1 (2020-05-13) - Add new brew target to fix homebrew builds [#4633](https://github.com/pulumi/pulumi/pull/4633) diff --git a/pkg/cmd/pulumi/plugin_install.go b/pkg/cmd/pulumi/plugin_install.go index d39ba97b5..5d65ffd37 100644 --- a/pkg/cmd/pulumi/plugin_install.go +++ b/pkg/cmd/pulumi/plugin_install.go @@ -26,13 +26,11 @@ import ( "github.com/pulumi/pulumi/pkg/v2/backend/display" "github.com/pulumi/pulumi/sdk/v2/go/common/diag" "github.com/pulumi/pulumi/sdk/v2/go/common/util/cmdutil" - "github.com/pulumi/pulumi/sdk/v2/go/common/util/contract" "github.com/pulumi/pulumi/sdk/v2/go/common/workspace" ) func newPluginInstallCmd() *cobra.Command { var serverURL string - var cloudURL string var exact bool var file string var reinstall bool @@ -56,23 +54,6 @@ func newPluginInstallCmd() *cobra.Command { Color: cmdutil.GetGlobalColorization(), } - if serverURL != "" && cloudURL != "" { - return errors.New("only one of server and cloud-url may be specified") - } - - if cloudURL != "" { - cmdutil.Diag().Warningf(diag.Message("", "cloud-url is deprecated, please pass '--server "+ - "%s/releases/plugins' instead."), cloudURL) - - serverURL = cloudURL + "/releases/plugins" - } - - // Note we don't presently set this as the default value for `--server` so we can play games like the above - // where we want to ensure at most one of `--server` or `--cloud-url` is set. - if serverURL == "" { - serverURL = "https://api.pulumi.com/releases/plugins" - } - // Parse the kind, name, and version, if specified. var installs []workspace.PluginInfo if len(args) > 0 { @@ -91,7 +72,7 @@ func newPluginInstallCmd() *cobra.Command { Kind: workspace.PluginKind(args[0]), Name: args[1], Version: &version, - ServerURL: serverURL, + ServerURL: serverURL, // If empty, will use default plugin source. }) } else { if file != "" { @@ -179,8 +160,6 @@ func newPluginInstallCmd() *cobra.Command { cmd.PersistentFlags().StringVar(&serverURL, "server", "", "A URL to download plugins from") - cmd.PersistentFlags().StringVarP(&cloudURL, - "cloud-url", "c", "", "A cloud URL to download releases from") cmd.PersistentFlags().BoolVar(&exact, "exact", false, "Force installation of an exact version match (usually >= is accepted)") cmd.PersistentFlags().StringVarP(&file, @@ -190,8 +169,5 @@ func newPluginInstallCmd() *cobra.Command { cmd.PersistentFlags().BoolVar(&verbose, "verbose", false, "Print detailed information about the installation steps") - // We are moving away from supporting this option, for now we mark it hidden. - contract.AssertNoError(cmd.PersistentFlags().MarkHidden("cloud-url")) - return cmd } diff --git a/sdk/go/common/workspace/plugins.go b/sdk/go/common/workspace/plugins.go index 79c760f79..39a27b8ba 100644 --- a/sdk/go/common/workspace/plugins.go +++ b/sdk/go/common/workspace/plugins.go @@ -26,6 +26,7 @@ import ( "regexp" "runtime" "sort" + "strings" "time" "github.com/blang/semver" @@ -190,8 +191,9 @@ func (info PluginInfo) Download() (io.ReadCloser, int64, error) { // is hosted by Pulumi. serverURL := info.ServerURL if serverURL == "" { - serverURL = "https://api.pulumi.com/releases/plugins" + serverURL = "https://get.pulumi.com/releases/plugins" } + serverURL = strings.TrimSuffix(serverURL, "/") endpoint := fmt.Sprintf("%s/pulumi-%s-%s-v%s-%s-%s.tar.gz", serverURL, info.Kind, info.Name, info.Version, os, arch) req, err := http.NewRequest("GET", endpoint, nil)