actions-cache-s3
#開発メモ
頼む: https://github.com/actions/toolkit/issues/676 https://github.com/actions/cache/issues/354
要対応
Save (Upload)
大元: https://github.com/actions/cache/blob/72d1e4fdff0ff7b1b6e86b415f2d4f5941e5c006/src/save.ts#L51
code:save.ts
await cache.saveCache(cachePaths, primaryKey, {
uploadChunkSize: utils.getInputAsInt(Inputs.UploadChunkSize)
});
const cacheId = await cacheHttpClient.reserveCache(key, paths, {
cacheIdから resource url を生成してる
await cacheHttpClient.saveCache(cacheId, archivePath, options)
await uploadFile(httpClient, cacheId, archivePath, options)
これはまるっと差し換え
https://github.com/whywaita/sandbox/runs/5158955103?check_suite_focus=true
https://github.com/actions/toolkit/blob/fcb8c4ca798bd0d81a9b07e2f7dffee8397c4707/packages/cache/src/internal/cacheHttpClient.ts#L33
##[debug]Resource Url: https://artifactcache.actions.githubusercontent.com/ykxeiZ1cjH5fYnADVCqaFyAHDcKV9Iml4VhWBM3akgIw6afSGl/_apis/artifactcache/cache?keys=macOS-&version=e154b6bfe35625e0c918633dc35a401d67d4d234a38ac657cdc0826d204aed43
やる
createHttpClient()
uploadChunk()
commitCache()
Restore (Download)
大元: https://github.com/actions/cache/blob/72d1e4fdff0ff7b1b6e86b415f2d4f5941e5c006/src/restore.ts#L36
code:restore.ts
const cacheKey = await cache.restoreCache(
cachePaths,
primaryKey,
restoreKeys
);
if (!cacheKey) {
core.info(
`Cache not found for input keys: ${[
primaryKey,
...restoreKeys
].join(", ")}`
);
return;
}
await cacheHttpClient.downloadCache(
await downloadCacheStorageSDK(archiveLocation, archivePath, downloadOptions)
const result = await client.downloadToBuffer(