pulumi/sdk/go/common/workspace
Justin Van Patten 594da1e95c
Fix plugin install failures on Windows (#5759)
When installing a plugin, previous versions of Pulumi extracted the
plugin tarball to a temp directory and then renamed the temp directory
to the final plugin directory. This was done to prevent concurrent
installs: if a process fails to rename the temp dir because the final
dir already exists, it means another process already installed the
plugin. Unfortunately, on Windows the rename operation often fails due
to aggressive virus scanners opening files in the temp dir.

In order to provide reliable plugin installs on Windows, we now extract
the tarball directly into the final directory, and use file locks to
prevent concurrent installs from toppling over one another.

During install, a lock file is created in the plugin cache directory
with the same name as the plugin's final directory but suffixed with
`.lock`. The process that obtains the lock is responsible for extracting
the tarball. Before it does that, it cleans up any previous temp
directories of failed installs of previous versions of Pulumi. Then it
creates an empty `.partial` file next to the `.lock` file. The
`.partial` file indicates an installation is in-progress. The `.partial`
file is deleted when installation is complete, indicating the plugin was
successfully installed. If a failure occurs during installation, the
`.partial` file will remain indicating the plugin wasn't fully
installed. The next time the plugin is installed, the old installation
directory will be removed and replaced with a fresh install.

This is the same approach Go uses for installing modules in its
module cache.
2020-11-16 09:44:29 -08:00
..
creds.go Breaking changes due to Feature 2.0 work 2020-04-14 09:30:25 +01:00
paths.go switch os/user with luser 2020-07-27 14:44:08 -07:00
plugins.go Fix plugin install failures on Windows (#5759) 2020-11-16 09:44:29 -08:00
plugins_install_nodejs_test.go Install plugin dependencies (#5353) 2020-09-14 13:54:26 -07:00
plugins_install_python_test.go Install plugin dependencies (#5353) 2020-09-14 13:54:26 -07:00
plugins_install_test.go Fix plugin install failures on Windows (#5759) 2020-11-16 09:44:29 -08:00
plugins_test.go move pkg/workspace -> sdk/go/common/workspace 2020-03-18 14:35:53 -07:00
project.go Install plugin dependencies (#5353) 2020-09-14 13:54:26 -07:00
project_test.go move pkg/workspace -> sdk/go/common/workspace 2020-03-18 14:35:53 -07:00
settings.go move pkg/workspace -> sdk/go/common/workspace 2020-03-18 14:35:53 -07:00
templates.go Handle blank project names in 'new' (#5504) 2020-10-05 13:40:24 -07:00
templates_test.go Handle blank project names in 'new' (#5504) 2020-10-05 13:40:24 -07:00
workspace.go Breaking changes due to Feature 2.0 work 2020-04-14 09:30:25 +01:00