1
0
Fork 0
mirror of https://code.forgejo.org/actions/cache.git synced 2024-10-17 06:34:41 +02:00

Fix cache restore bug in gh issue #1377 by fixing paths (#15)

This commit is contained in:
Dev 2023-12-22 01:51:34 -05:00 committed by GitHub
parent 7d69ef2398
commit 9b747acaaa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 6 additions and 6 deletions

View file

@ -64018,7 +64018,7 @@ function restoreImpl(stateProvider) {
const enableCrossOsArchive = utils.getInputAsBool(constants_1.Inputs.EnableCrossOsArchive); const enableCrossOsArchive = utils.getInputAsBool(constants_1.Inputs.EnableCrossOsArchive);
const failOnCacheMiss = utils.getInputAsBool(constants_1.Inputs.FailOnCacheMiss); const failOnCacheMiss = utils.getInputAsBool(constants_1.Inputs.FailOnCacheMiss);
const lookupOnly = utils.getInputAsBool(constants_1.Inputs.LookupOnly); const lookupOnly = utils.getInputAsBool(constants_1.Inputs.LookupOnly);
const cacheKey = yield cache.restoreCache(cachePaths, primaryKey, restoreKeys, { lookupOnly: lookupOnly }, enableCrossOsArchive, s3config, s3BucketName); const cacheKey = yield cache.restoreCache(cachePaths.slice(), primaryKey, restoreKeys, { lookupOnly: lookupOnly }, enableCrossOsArchive, s3config, s3BucketName);
if (!cacheKey) { if (!cacheKey) {
if (failOnCacheMiss) { if (failOnCacheMiss) {
throw new Error(`Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: ${primaryKey}`); throw new Error(`Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: ${primaryKey}`);

View file

@ -64018,7 +64018,7 @@ function restoreImpl(stateProvider) {
const enableCrossOsArchive = utils.getInputAsBool(constants_1.Inputs.EnableCrossOsArchive); const enableCrossOsArchive = utils.getInputAsBool(constants_1.Inputs.EnableCrossOsArchive);
const failOnCacheMiss = utils.getInputAsBool(constants_1.Inputs.FailOnCacheMiss); const failOnCacheMiss = utils.getInputAsBool(constants_1.Inputs.FailOnCacheMiss);
const lookupOnly = utils.getInputAsBool(constants_1.Inputs.LookupOnly); const lookupOnly = utils.getInputAsBool(constants_1.Inputs.LookupOnly);
const cacheKey = yield cache.restoreCache(cachePaths, primaryKey, restoreKeys, { lookupOnly: lookupOnly }, enableCrossOsArchive, s3config, s3BucketName); const cacheKey = yield cache.restoreCache(cachePaths.slice(), primaryKey, restoreKeys, { lookupOnly: lookupOnly }, enableCrossOsArchive, s3config, s3BucketName);
if (!cacheKey) { if (!cacheKey) {
if (failOnCacheMiss) { if (failOnCacheMiss) {
throw new Error(`Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: ${primaryKey}`); throw new Error(`Failed to restore cache entry. Exiting as fail-on-cache-miss is set. Input key: ${primaryKey}`);

View file

@ -100292,7 +100292,7 @@ function saveImpl(stateProvider) {
const s3BucketName = core.getInput(constants_1.Inputs.AWSS3Bucket); const s3BucketName = core.getInput(constants_1.Inputs.AWSS3Bucket);
const s3config = utils.getInputS3ClientConfig(); const s3config = utils.getInputS3ClientConfig();
const enableCrossOsArchive = utils.getInputAsBool(constants_1.Inputs.EnableCrossOsArchive); const enableCrossOsArchive = utils.getInputAsBool(constants_1.Inputs.EnableCrossOsArchive);
cacheId = yield cache.saveCache(cachePaths, primaryKey, { uploadChunkSize: utils.getInputAsInt(constants_1.Inputs.UploadChunkSize) }, enableCrossOsArchive, s3config, s3BucketName); cacheId = yield cache.saveCache(cachePaths.slice(), primaryKey, { uploadChunkSize: utils.getInputAsInt(constants_1.Inputs.UploadChunkSize) }, enableCrossOsArchive, s3config, s3BucketName);
if (cacheId != -1) { if (cacheId != -1) {
core.info(`Cache saved with key: ${primaryKey}`); core.info(`Cache saved with key: ${primaryKey}`);
} }

2
dist/save/index.js vendored
View file

@ -100265,7 +100265,7 @@ function saveImpl(stateProvider) {
const s3BucketName = core.getInput(constants_1.Inputs.AWSS3Bucket); const s3BucketName = core.getInput(constants_1.Inputs.AWSS3Bucket);
const s3config = utils.getInputS3ClientConfig(); const s3config = utils.getInputS3ClientConfig();
const enableCrossOsArchive = utils.getInputAsBool(constants_1.Inputs.EnableCrossOsArchive); const enableCrossOsArchive = utils.getInputAsBool(constants_1.Inputs.EnableCrossOsArchive);
cacheId = yield cache.saveCache(cachePaths, primaryKey, { uploadChunkSize: utils.getInputAsInt(constants_1.Inputs.UploadChunkSize) }, enableCrossOsArchive, s3config, s3BucketName); cacheId = yield cache.saveCache(cachePaths.slice(), primaryKey, { uploadChunkSize: utils.getInputAsInt(constants_1.Inputs.UploadChunkSize) }, enableCrossOsArchive, s3config, s3BucketName);
if (cacheId != -1) { if (cacheId != -1) {
core.info(`Cache saved with key: ${primaryKey}`); core.info(`Cache saved with key: ${primaryKey}`);
} }

View file

@ -45,7 +45,7 @@ export async function restoreImpl(
const lookupOnly = utils.getInputAsBool(Inputs.LookupOnly); const lookupOnly = utils.getInputAsBool(Inputs.LookupOnly);
const cacheKey = await cache.restoreCache( const cacheKey = await cache.restoreCache(
cachePaths, cachePaths.slice(),
primaryKey, primaryKey,
restoreKeys, restoreKeys,
{ lookupOnly: lookupOnly }, { lookupOnly: lookupOnly },

View file

@ -59,7 +59,7 @@ async function saveImpl(stateProvider: IStateProvider): Promise<number | void> {
); );
cacheId = await cache.saveCache( cacheId = await cache.saveCache(
cachePaths, cachePaths.slice(),
primaryKey, primaryKey,
{ uploadChunkSize: utils.getInputAsInt(Inputs.UploadChunkSize) }, { uploadChunkSize: utils.getInputAsInt(Inputs.UploadChunkSize) },
enableCrossOsArchive, enableCrossOsArchive,