Skip to content

Commit f720a06

Browse files
use plugin cache for provider lock across for all platforms
The cache architecture already supports multi-platform, the only downside is that this might grow the cache. This seems expected.
1 parent 2c98e6a commit f720a06

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

internal/command/providers_lock.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ func (c *ProvidersLockCommand) Run(args []string) int {
249249

250250
// Use global plugin cache for extra speed if this architecture matches the systems (and therefore the caches) one
251251
globalCacheDir := c.providerGlobalCacheDir()
252-
if globalCacheDir != nil && platform == getproviders.CurrentPlatform {
253-
installer.SetGlobalCacheDir(globalCacheDir)
252+
if globalCacheDir != nil {
253+
installer.SetGlobalCacheDir(globalCacheDir.WithPlatform(platform))
254254
installer.SetGlobalCacheDirMayBreakDependencyLockFile(c.PluginCacheMayBreakDependencyLockFile)
255255
}
256256

internal/providercache/dir.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ func (d *Dir) BasePath() string {
7575
return filepath.Clean(d.baseDir)
7676
}
7777

78+
// WithPlatform creates a new dir with the provided platform based
79+
// on this dir
80+
func (d *Dir) WithPlatform(platform getproviders.Platform) *Dir {
81+
return NewDirWithPlatform(d.baseDir, platform)
82+
}
83+
7884
// AllAvailablePackages returns a description of all of the packages already
7985
// present in the directory. The cache entries are grouped by the provider
8086
// they relate to and then sorted by version precedence, with highest

0 commit comments

Comments
 (0)