fix(repo-cache): pass relative paths to fs layer (#26227)

This commit is contained in:
Michael Kriese 2023-12-14 08:18:12 +01:00 committed by GitHub
parent e1dd622a9b
commit 9474f9a5d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

View file

@ -188,7 +188,7 @@ describe('util/cache/repository/impl/local', () => {
`Repository cache type not supported using type "local" instead`,
);
expect(fs.outputCacheFile).toHaveBeenCalledWith(
'/tmp/cache/renovate/repository/github/some/repo.json',
'renovate/repository/github/some/repo.json',
JSON.stringify(newCacheRecord),
);
});

View file

@ -1,5 +1,4 @@
import upath from 'upath';
import { GlobalConfig } from '../../../../config/global';
import { logger } from '../../../../logger';
import { cachePathExists, outputCacheFile, readCacheFile } from '../../../fs';
import type { RepoCacheRecord } from '../schema';
@ -30,10 +29,9 @@ export class RepoCacheLocal extends RepoCacheBase {
}
private getCacheFileName(): string {
const cacheDir = GlobalConfig.get('cacheDir');
const repoCachePath = '/renovate/repository/';
const repoCachePath = 'renovate/repository/';
const platform = this.platform;
const fileName = `${this.repository}.json`;
return upath.join(cacheDir, repoCachePath, platform, fileName);
return upath.join(repoCachePath, platform, fileName);
}
}