1
0
Fork 0
mirror of https://code.forgejo.org/actions/cache.git synced 2024-11-23 20:19:16 +01:00

Formatting and stylistic cleanup

This commit is contained in:
Bassem Dghaidi 2024-11-14 03:24:27 -08:00 committed by GitHub
parent d2ae025c8f
commit 3f69ac8572
4 changed files with 48 additions and 40 deletions

View file

@ -12641,9 +12641,9 @@ function restoreCache(paths, primaryKey, restoreKeys, options, enableCrossOsArch
const cacheServiceVersion = config.getCacheServiceVersion(); const cacheServiceVersion = config.getCacheServiceVersion();
console.debug(`Cache service version: ${cacheServiceVersion}`); console.debug(`Cache service version: ${cacheServiceVersion}`);
switch (cacheServiceVersion) { switch (cacheServiceVersion) {
case "v2": case 'v2':
return yield restoreCachev2(paths, primaryKey, restoreKeys, options, enableCrossOsArchive); return yield restoreCachev2(paths, primaryKey, restoreKeys, options, enableCrossOsArchive);
case "v1": case 'v1':
default: default:
return yield restoreCachev1(paths, primaryKey, restoreKeys, options, enableCrossOsArchive); return yield restoreCachev1(paths, primaryKey, restoreKeys, options, enableCrossOsArchive);
} }
@ -12755,7 +12755,7 @@ function restoreCachev2(paths, primaryKey, restoreKeys, options, enableCrossOsAr
workflowJobRunBackendId: backendIds.workflowJobRunBackendId, workflowJobRunBackendId: backendIds.workflowJobRunBackendId,
key: primaryKey, key: primaryKey,
restoreKeys: restoreKeys, restoreKeys: restoreKeys,
version: utils.getCacheVersion(paths, compressionMethod, enableCrossOsArchive), version: utils.getCacheVersion(paths, compressionMethod, enableCrossOsArchive)
}; };
core.debug(`GetCacheEntryDownloadURLRequest: ${JSON.stringify(twirpClient)}`); core.debug(`GetCacheEntryDownloadURLRequest: ${JSON.stringify(twirpClient)}`);
const response = yield twirpClient.GetCacheEntryDownloadURL(request); const response = yield twirpClient.GetCacheEntryDownloadURL(request);
@ -12812,9 +12812,9 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
const cacheServiceVersion = config.getCacheServiceVersion(); const cacheServiceVersion = config.getCacheServiceVersion();
console.debug(`Cache Service Version: ${cacheServiceVersion}`); console.debug(`Cache Service Version: ${cacheServiceVersion}`);
switch (cacheServiceVersion) { switch (cacheServiceVersion) {
case "v2": case 'v2':
return yield saveCachev2(paths, key, options, enableCrossOsArchive); return yield saveCachev2(paths, key, options, enableCrossOsArchive);
case "v1": case 'v1':
default: default:
return yield saveCachev1(paths, key, options, enableCrossOsArchive); return yield saveCachev1(paths, key, options, enableCrossOsArchive);
} }
@ -12953,7 +12953,7 @@ function saveCachev2(paths, key, options, enableCrossOsArchive = false) {
workflowJobRunBackendId: backendIds.workflowJobRunBackendId, workflowJobRunBackendId: backendIds.workflowJobRunBackendId,
key: key, key: key,
version: version, version: version,
sizeBytes: `${archiveFileSize}`, sizeBytes: `${archiveFileSize}`
}; };
const finalizeResponse = yield twirpClient.FinalizeCacheEntryUpload(finalizeRequest); const finalizeResponse = yield twirpClient.FinalizeCacheEntryUpload(finalizeRequest);
core.debug(`FinalizeCacheEntryUploadResponse: ${JSON.stringify(finalizeResponse)}`); core.debug(`FinalizeCacheEntryUploadResponse: ${JSON.stringify(finalizeResponse)}`);
@ -14734,7 +14734,7 @@ const storage_blob_1 = __nccwpck_require__(3864);
function DownloadCacheFile(signedUploadURL, archivePath) { function DownloadCacheFile(signedUploadURL, archivePath) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const downloadOptions = { const downloadOptions = {
maxRetryRequests: 5, maxRetryRequests: 5
}; };
// TODO: tighten the configuration and pass the appropriate user-agent // TODO: tighten the configuration and pass the appropriate user-agent
const blobClient = new storage_blob_1.BlobClient(signedUploadURL); const blobClient = new storage_blob_1.BlobClient(signedUploadURL);
@ -14797,7 +14797,7 @@ function UploadCacheFile(signedUploadURL, archivePath) {
const uploadOptions = { const uploadOptions = {
blockSize: 4 * 1024 * 1024, blockSize: 4 * 1024 * 1024,
concurrency: 4, concurrency: 4,
maxSingleShotSize: 8 * 1024 * 1024, // 8 MiB initial transfer size maxSingleShotSize: 8 * 1024 * 1024 // 8 MiB initial transfer size
}; };
const blobClient = new storage_blob_1.BlobClient(signedUploadURL); const blobClient = new storage_blob_1.BlobClient(signedUploadURL);
const blockBlobClient = blobClient.getBlockBlobClient(); const blockBlobClient = blobClient.getBlockBlobClient();
@ -15368,9 +15368,11 @@ function getCacheServiceURL() {
const version = getCacheServiceVersion(); const version = getCacheServiceVersion();
switch (version) { switch (version) {
case 'v1': case 'v1':
return process.env['ACTIONS_CACHE_URL'] || process.env['ACTIONS_RESULTS_URL'] || ""; return (process.env['ACTIONS_CACHE_URL'] ||
process.env['ACTIONS_RESULTS_URL'] ||
'');
case 'v2': case 'v2':
return process.env['ACTIONS_RESULTS_URL'] || ""; return process.env['ACTIONS_RESULTS_URL'] || '';
default: default:
throw new Error(`Unsupported cache service version: ${version}`); throw new Error(`Unsupported cache service version: ${version}`);
} }

22
dist/restore/index.js vendored
View file

@ -12641,9 +12641,9 @@ function restoreCache(paths, primaryKey, restoreKeys, options, enableCrossOsArch
const cacheServiceVersion = config.getCacheServiceVersion(); const cacheServiceVersion = config.getCacheServiceVersion();
console.debug(`Cache service version: ${cacheServiceVersion}`); console.debug(`Cache service version: ${cacheServiceVersion}`);
switch (cacheServiceVersion) { switch (cacheServiceVersion) {
case "v2": case 'v2':
return yield restoreCachev2(paths, primaryKey, restoreKeys, options, enableCrossOsArchive); return yield restoreCachev2(paths, primaryKey, restoreKeys, options, enableCrossOsArchive);
case "v1": case 'v1':
default: default:
return yield restoreCachev1(paths, primaryKey, restoreKeys, options, enableCrossOsArchive); return yield restoreCachev1(paths, primaryKey, restoreKeys, options, enableCrossOsArchive);
} }
@ -12755,7 +12755,7 @@ function restoreCachev2(paths, primaryKey, restoreKeys, options, enableCrossOsAr
workflowJobRunBackendId: backendIds.workflowJobRunBackendId, workflowJobRunBackendId: backendIds.workflowJobRunBackendId,
key: primaryKey, key: primaryKey,
restoreKeys: restoreKeys, restoreKeys: restoreKeys,
version: utils.getCacheVersion(paths, compressionMethod, enableCrossOsArchive), version: utils.getCacheVersion(paths, compressionMethod, enableCrossOsArchive)
}; };
core.debug(`GetCacheEntryDownloadURLRequest: ${JSON.stringify(twirpClient)}`); core.debug(`GetCacheEntryDownloadURLRequest: ${JSON.stringify(twirpClient)}`);
const response = yield twirpClient.GetCacheEntryDownloadURL(request); const response = yield twirpClient.GetCacheEntryDownloadURL(request);
@ -12812,9 +12812,9 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
const cacheServiceVersion = config.getCacheServiceVersion(); const cacheServiceVersion = config.getCacheServiceVersion();
console.debug(`Cache Service Version: ${cacheServiceVersion}`); console.debug(`Cache Service Version: ${cacheServiceVersion}`);
switch (cacheServiceVersion) { switch (cacheServiceVersion) {
case "v2": case 'v2':
return yield saveCachev2(paths, key, options, enableCrossOsArchive); return yield saveCachev2(paths, key, options, enableCrossOsArchive);
case "v1": case 'v1':
default: default:
return yield saveCachev1(paths, key, options, enableCrossOsArchive); return yield saveCachev1(paths, key, options, enableCrossOsArchive);
} }
@ -12953,7 +12953,7 @@ function saveCachev2(paths, key, options, enableCrossOsArchive = false) {
workflowJobRunBackendId: backendIds.workflowJobRunBackendId, workflowJobRunBackendId: backendIds.workflowJobRunBackendId,
key: key, key: key,
version: version, version: version,
sizeBytes: `${archiveFileSize}`, sizeBytes: `${archiveFileSize}`
}; };
const finalizeResponse = yield twirpClient.FinalizeCacheEntryUpload(finalizeRequest); const finalizeResponse = yield twirpClient.FinalizeCacheEntryUpload(finalizeRequest);
core.debug(`FinalizeCacheEntryUploadResponse: ${JSON.stringify(finalizeResponse)}`); core.debug(`FinalizeCacheEntryUploadResponse: ${JSON.stringify(finalizeResponse)}`);
@ -14734,7 +14734,7 @@ const storage_blob_1 = __nccwpck_require__(3864);
function DownloadCacheFile(signedUploadURL, archivePath) { function DownloadCacheFile(signedUploadURL, archivePath) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const downloadOptions = { const downloadOptions = {
maxRetryRequests: 5, maxRetryRequests: 5
}; };
// TODO: tighten the configuration and pass the appropriate user-agent // TODO: tighten the configuration and pass the appropriate user-agent
const blobClient = new storage_blob_1.BlobClient(signedUploadURL); const blobClient = new storage_blob_1.BlobClient(signedUploadURL);
@ -14797,7 +14797,7 @@ function UploadCacheFile(signedUploadURL, archivePath) {
const uploadOptions = { const uploadOptions = {
blockSize: 4 * 1024 * 1024, blockSize: 4 * 1024 * 1024,
concurrency: 4, concurrency: 4,
maxSingleShotSize: 8 * 1024 * 1024, // 8 MiB initial transfer size maxSingleShotSize: 8 * 1024 * 1024 // 8 MiB initial transfer size
}; };
const blobClient = new storage_blob_1.BlobClient(signedUploadURL); const blobClient = new storage_blob_1.BlobClient(signedUploadURL);
const blockBlobClient = blobClient.getBlockBlobClient(); const blockBlobClient = blobClient.getBlockBlobClient();
@ -15368,9 +15368,11 @@ function getCacheServiceURL() {
const version = getCacheServiceVersion(); const version = getCacheServiceVersion();
switch (version) { switch (version) {
case 'v1': case 'v1':
return process.env['ACTIONS_CACHE_URL'] || process.env['ACTIONS_RESULTS_URL'] || ""; return (process.env['ACTIONS_CACHE_URL'] ||
process.env['ACTIONS_RESULTS_URL'] ||
'');
case 'v2': case 'v2':
return process.env['ACTIONS_RESULTS_URL'] || ""; return process.env['ACTIONS_RESULTS_URL'] || '';
default: default:
throw new Error(`Unsupported cache service version: ${version}`); throw new Error(`Unsupported cache service version: ${version}`);
} }

View file

@ -12641,9 +12641,9 @@ function restoreCache(paths, primaryKey, restoreKeys, options, enableCrossOsArch
const cacheServiceVersion = config.getCacheServiceVersion(); const cacheServiceVersion = config.getCacheServiceVersion();
console.debug(`Cache service version: ${cacheServiceVersion}`); console.debug(`Cache service version: ${cacheServiceVersion}`);
switch (cacheServiceVersion) { switch (cacheServiceVersion) {
case "v2": case 'v2':
return yield restoreCachev2(paths, primaryKey, restoreKeys, options, enableCrossOsArchive); return yield restoreCachev2(paths, primaryKey, restoreKeys, options, enableCrossOsArchive);
case "v1": case 'v1':
default: default:
return yield restoreCachev1(paths, primaryKey, restoreKeys, options, enableCrossOsArchive); return yield restoreCachev1(paths, primaryKey, restoreKeys, options, enableCrossOsArchive);
} }
@ -12755,7 +12755,7 @@ function restoreCachev2(paths, primaryKey, restoreKeys, options, enableCrossOsAr
workflowJobRunBackendId: backendIds.workflowJobRunBackendId, workflowJobRunBackendId: backendIds.workflowJobRunBackendId,
key: primaryKey, key: primaryKey,
restoreKeys: restoreKeys, restoreKeys: restoreKeys,
version: utils.getCacheVersion(paths, compressionMethod, enableCrossOsArchive), version: utils.getCacheVersion(paths, compressionMethod, enableCrossOsArchive)
}; };
core.debug(`GetCacheEntryDownloadURLRequest: ${JSON.stringify(twirpClient)}`); core.debug(`GetCacheEntryDownloadURLRequest: ${JSON.stringify(twirpClient)}`);
const response = yield twirpClient.GetCacheEntryDownloadURL(request); const response = yield twirpClient.GetCacheEntryDownloadURL(request);
@ -12812,9 +12812,9 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
const cacheServiceVersion = config.getCacheServiceVersion(); const cacheServiceVersion = config.getCacheServiceVersion();
console.debug(`Cache Service Version: ${cacheServiceVersion}`); console.debug(`Cache Service Version: ${cacheServiceVersion}`);
switch (cacheServiceVersion) { switch (cacheServiceVersion) {
case "v2": case 'v2':
return yield saveCachev2(paths, key, options, enableCrossOsArchive); return yield saveCachev2(paths, key, options, enableCrossOsArchive);
case "v1": case 'v1':
default: default:
return yield saveCachev1(paths, key, options, enableCrossOsArchive); return yield saveCachev1(paths, key, options, enableCrossOsArchive);
} }
@ -12953,7 +12953,7 @@ function saveCachev2(paths, key, options, enableCrossOsArchive = false) {
workflowJobRunBackendId: backendIds.workflowJobRunBackendId, workflowJobRunBackendId: backendIds.workflowJobRunBackendId,
key: key, key: key,
version: version, version: version,
sizeBytes: `${archiveFileSize}`, sizeBytes: `${archiveFileSize}`
}; };
const finalizeResponse = yield twirpClient.FinalizeCacheEntryUpload(finalizeRequest); const finalizeResponse = yield twirpClient.FinalizeCacheEntryUpload(finalizeRequest);
core.debug(`FinalizeCacheEntryUploadResponse: ${JSON.stringify(finalizeResponse)}`); core.debug(`FinalizeCacheEntryUploadResponse: ${JSON.stringify(finalizeResponse)}`);
@ -14734,7 +14734,7 @@ const storage_blob_1 = __nccwpck_require__(3864);
function DownloadCacheFile(signedUploadURL, archivePath) { function DownloadCacheFile(signedUploadURL, archivePath) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const downloadOptions = { const downloadOptions = {
maxRetryRequests: 5, maxRetryRequests: 5
}; };
// TODO: tighten the configuration and pass the appropriate user-agent // TODO: tighten the configuration and pass the appropriate user-agent
const blobClient = new storage_blob_1.BlobClient(signedUploadURL); const blobClient = new storage_blob_1.BlobClient(signedUploadURL);
@ -14797,7 +14797,7 @@ function UploadCacheFile(signedUploadURL, archivePath) {
const uploadOptions = { const uploadOptions = {
blockSize: 4 * 1024 * 1024, blockSize: 4 * 1024 * 1024,
concurrency: 4, concurrency: 4,
maxSingleShotSize: 8 * 1024 * 1024, // 8 MiB initial transfer size maxSingleShotSize: 8 * 1024 * 1024 // 8 MiB initial transfer size
}; };
const blobClient = new storage_blob_1.BlobClient(signedUploadURL); const blobClient = new storage_blob_1.BlobClient(signedUploadURL);
const blockBlobClient = blobClient.getBlockBlobClient(); const blockBlobClient = blobClient.getBlockBlobClient();
@ -15368,9 +15368,11 @@ function getCacheServiceURL() {
const version = getCacheServiceVersion(); const version = getCacheServiceVersion();
switch (version) { switch (version) {
case 'v1': case 'v1':
return process.env['ACTIONS_CACHE_URL'] || process.env['ACTIONS_RESULTS_URL'] || ""; return (process.env['ACTIONS_CACHE_URL'] ||
process.env['ACTIONS_RESULTS_URL'] ||
'');
case 'v2': case 'v2':
return process.env['ACTIONS_RESULTS_URL'] || ""; return process.env['ACTIONS_RESULTS_URL'] || '';
default: default:
throw new Error(`Unsupported cache service version: ${version}`); throw new Error(`Unsupported cache service version: ${version}`);
} }

22
dist/save/index.js vendored
View file

@ -12641,9 +12641,9 @@ function restoreCache(paths, primaryKey, restoreKeys, options, enableCrossOsArch
const cacheServiceVersion = config.getCacheServiceVersion(); const cacheServiceVersion = config.getCacheServiceVersion();
console.debug(`Cache service version: ${cacheServiceVersion}`); console.debug(`Cache service version: ${cacheServiceVersion}`);
switch (cacheServiceVersion) { switch (cacheServiceVersion) {
case "v2": case 'v2':
return yield restoreCachev2(paths, primaryKey, restoreKeys, options, enableCrossOsArchive); return yield restoreCachev2(paths, primaryKey, restoreKeys, options, enableCrossOsArchive);
case "v1": case 'v1':
default: default:
return yield restoreCachev1(paths, primaryKey, restoreKeys, options, enableCrossOsArchive); return yield restoreCachev1(paths, primaryKey, restoreKeys, options, enableCrossOsArchive);
} }
@ -12755,7 +12755,7 @@ function restoreCachev2(paths, primaryKey, restoreKeys, options, enableCrossOsAr
workflowJobRunBackendId: backendIds.workflowJobRunBackendId, workflowJobRunBackendId: backendIds.workflowJobRunBackendId,
key: primaryKey, key: primaryKey,
restoreKeys: restoreKeys, restoreKeys: restoreKeys,
version: utils.getCacheVersion(paths, compressionMethod, enableCrossOsArchive), version: utils.getCacheVersion(paths, compressionMethod, enableCrossOsArchive)
}; };
core.debug(`GetCacheEntryDownloadURLRequest: ${JSON.stringify(twirpClient)}`); core.debug(`GetCacheEntryDownloadURLRequest: ${JSON.stringify(twirpClient)}`);
const response = yield twirpClient.GetCacheEntryDownloadURL(request); const response = yield twirpClient.GetCacheEntryDownloadURL(request);
@ -12812,9 +12812,9 @@ function saveCache(paths, key, options, enableCrossOsArchive = false) {
const cacheServiceVersion = config.getCacheServiceVersion(); const cacheServiceVersion = config.getCacheServiceVersion();
console.debug(`Cache Service Version: ${cacheServiceVersion}`); console.debug(`Cache Service Version: ${cacheServiceVersion}`);
switch (cacheServiceVersion) { switch (cacheServiceVersion) {
case "v2": case 'v2':
return yield saveCachev2(paths, key, options, enableCrossOsArchive); return yield saveCachev2(paths, key, options, enableCrossOsArchive);
case "v1": case 'v1':
default: default:
return yield saveCachev1(paths, key, options, enableCrossOsArchive); return yield saveCachev1(paths, key, options, enableCrossOsArchive);
} }
@ -12953,7 +12953,7 @@ function saveCachev2(paths, key, options, enableCrossOsArchive = false) {
workflowJobRunBackendId: backendIds.workflowJobRunBackendId, workflowJobRunBackendId: backendIds.workflowJobRunBackendId,
key: key, key: key,
version: version, version: version,
sizeBytes: `${archiveFileSize}`, sizeBytes: `${archiveFileSize}`
}; };
const finalizeResponse = yield twirpClient.FinalizeCacheEntryUpload(finalizeRequest); const finalizeResponse = yield twirpClient.FinalizeCacheEntryUpload(finalizeRequest);
core.debug(`FinalizeCacheEntryUploadResponse: ${JSON.stringify(finalizeResponse)}`); core.debug(`FinalizeCacheEntryUploadResponse: ${JSON.stringify(finalizeResponse)}`);
@ -14734,7 +14734,7 @@ const storage_blob_1 = __nccwpck_require__(3864);
function DownloadCacheFile(signedUploadURL, archivePath) { function DownloadCacheFile(signedUploadURL, archivePath) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const downloadOptions = { const downloadOptions = {
maxRetryRequests: 5, maxRetryRequests: 5
}; };
// TODO: tighten the configuration and pass the appropriate user-agent // TODO: tighten the configuration and pass the appropriate user-agent
const blobClient = new storage_blob_1.BlobClient(signedUploadURL); const blobClient = new storage_blob_1.BlobClient(signedUploadURL);
@ -14797,7 +14797,7 @@ function UploadCacheFile(signedUploadURL, archivePath) {
const uploadOptions = { const uploadOptions = {
blockSize: 4 * 1024 * 1024, blockSize: 4 * 1024 * 1024,
concurrency: 4, concurrency: 4,
maxSingleShotSize: 8 * 1024 * 1024, // 8 MiB initial transfer size maxSingleShotSize: 8 * 1024 * 1024 // 8 MiB initial transfer size
}; };
const blobClient = new storage_blob_1.BlobClient(signedUploadURL); const blobClient = new storage_blob_1.BlobClient(signedUploadURL);
const blockBlobClient = blobClient.getBlockBlobClient(); const blockBlobClient = blobClient.getBlockBlobClient();
@ -15368,9 +15368,11 @@ function getCacheServiceURL() {
const version = getCacheServiceVersion(); const version = getCacheServiceVersion();
switch (version) { switch (version) {
case 'v1': case 'v1':
return process.env['ACTIONS_CACHE_URL'] || process.env['ACTIONS_RESULTS_URL'] || ""; return (process.env['ACTIONS_CACHE_URL'] ||
process.env['ACTIONS_RESULTS_URL'] ||
'');
case 'v2': case 'v2':
return process.env['ACTIONS_RESULTS_URL'] || ""; return process.env['ACTIONS_RESULTS_URL'] || '';
default: default:
throw new Error(`Unsupported cache service version: ${version}`); throw new Error(`Unsupported cache service version: ${version}`);
} }