improve provider lock speed by using cache

Closes #33837
use-plugin-cache-for-provider-lock
Daniel Schmidt 2 years ago
parent 5b29b92abe
commit 2c98e6a347
No known key found for this signature in database
GPG Key ID: 377C3A4D62FBBBE2

@ -243,9 +243,17 @@ func (c *ProvidersLockCommand) Run(args []string) int {
}
ctx := evts.OnContext(ctx)
// We can not use c.providerGlobalCacheDir() as we install the provider into a temp dir
dir := providercache.NewDirWithPlatform(tempDir, platform)
installer := providercache.NewInstaller(dir, source)
// Use global plugin cache for extra speed if this architecture matches the systems (and therefore the caches) one
globalCacheDir := c.providerGlobalCacheDir()
if globalCacheDir != nil && platform == getproviders.CurrentPlatform {
installer.SetGlobalCacheDir(globalCacheDir)
installer.SetGlobalCacheDirMayBreakDependencyLockFile(c.PluginCacheMayBreakDependencyLockFile)
}
newLocks, err := installer.EnsureProviderVersions(ctx, oldLocks, reqs, providercache.InstallNewProvidersForce)
if err != nil {
diags = diags.Append(tfdiags.Sourceless(

Loading…
Cancel
Save