diff --git a/dist/restore/index.js b/dist/restore/index.js index 7adf64f..05267ef 100644 --- a/dist/restore/index.js +++ b/dist/restore/index.js @@ -86767,7 +86767,11 @@ class CacheConfig { this.cachePaths = []; /** The primary cache key */ this.cacheKey = ""; - /** The secondary (restore) key that only contains the prefix and environment */ + /** + * The secondary (restore) key that only contains the prefix and environment + * This should be used if the primary cacheKey is not available - IE pulling from main on a branch + * instead of the branch itself + * */ this.restoreKey = ""; /** Whether to cache CARGO_HOME/.bin */ this.cacheBin = true; @@ -86946,6 +86950,11 @@ class CacheConfig { let lockHash = digest(hasher); keyFiles.push(...parsedKeyFiles); self.keyFiles = sort_and_uniq(keyFiles); + // todo(jon): make sure we differentiate incrementals on different branches + // we can use just a single cache per incremental branch + if (self.incremental) { + key += `-incremental`; + } key += `-${lockHash}`; self.cacheKey = key; self.cachePaths = [external_path_default().join(config_CARGO_HOME, "registry"), external_path_default().join(config_CARGO_HOME, "git")]; diff --git a/dist/save/index.js b/dist/save/index.js index 714a7c6..9fb3841 100644 --- a/dist/save/index.js +++ b/dist/save/index.js @@ -86767,7 +86767,11 @@ class CacheConfig { this.cachePaths = []; /** The primary cache key */ this.cacheKey = ""; - /** The secondary (restore) key that only contains the prefix and environment */ + /** + * The secondary (restore) key that only contains the prefix and environment + * This should be used if the primary cacheKey is not available - IE pulling from main on a branch + * instead of the branch itself + * */ this.restoreKey = ""; /** Whether to cache CARGO_HOME/.bin */ this.cacheBin = true; @@ -86946,6 +86950,11 @@ class CacheConfig { let lockHash = digest(hasher); keyFiles.push(...parsedKeyFiles); self.keyFiles = sort_and_uniq(keyFiles); + // todo(jon): make sure we differentiate incrementals on different branches + // we can use just a single cache per incremental branch + if (self.incremental) { + key += `-incremental`; + } key += `-${lockHash}`; self.cacheKey = key; self.cachePaths = [external_path_default().join(CARGO_HOME, "registry"), external_path_default().join(CARGO_HOME, "git")]; diff --git a/src/config.ts b/src/config.ts index 706e6e2..ecae9fb 100644 --- a/src/config.ts +++ b/src/config.ts @@ -23,7 +23,11 @@ export class CacheConfig { public cachePaths: Array = []; /** The primary cache key */ public cacheKey = ""; - /** The secondary (restore) key that only contains the prefix and environment */ + /** + * The secondary (restore) key that only contains the prefix and environment + * This should be used if the primary cacheKey is not available - IE pulling from main on a branch + * instead of the branch itself + * */ public restoreKey = ""; /** Whether to cache CARGO_HOME/.bin */ @@ -251,6 +255,8 @@ export class CacheConfig { keyFiles.push(...parsedKeyFiles); self.keyFiles = sort_and_uniq(keyFiles); + // todo(jon): make sure we differentiate incrementals on different branches + // we can use just a single cache per incremental branch if (self.incremental) { key += `-incremental`; }