1
0
Fork 0

Minor refactoring

pull/1882/head
Bassem Dghaidi 2024-12-02 04:08:21 -08:00 committed by GitHub
parent d89855bb90
commit a762876d6d
2 changed files with 24 additions and 15 deletions

View File

@ -106,12 +106,12 @@ export async function restoreCache(
/** /**
* Restores cache using the legacy Cache Service * Restores cache using the legacy Cache Service
* *
* @param paths * @param paths a list of file paths to restore from the cache
* @param primaryKey * @param primaryKey an explicit key for restoring the cache
* @param restoreKeys * @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for key
* @param options * @param options cache download options
* @param enableCrossOsArchive * @param enableCrossOsArchive an optional boolean enabled to restore on windows any cache created on any platform
* @returns * @returns string returns the key for the cache hit, otherwise returns undefined
*/ */
async function restoreCacheV1( async function restoreCacheV1(
paths: string[], paths: string[],
@ -202,7 +202,7 @@ async function restoreCacheV1(
} }
/** /**
* Restores cache using the new Cache Service * Restores cache using Cache Service v2
* *
* @param paths a list of file paths to restore from the cache * @param paths a list of file paths to restore from the cache
* @param primaryKey an explicit key for restoring the cache * @param primaryKey an explicit key for restoring the cache
@ -448,12 +448,12 @@ async function saveCacheV1(
} }
/** /**
* Save cache using the new Cache Service * Save cache using Cache Service v2
* *
* @param paths * @param paths a list of file paths to restore from the cache
* @param key * @param key an explicit key for restoring the cache
* @param options * @param options cache upload options
* @param enableCrossOsArchive * @param enableCrossOsArchive an optional boolean enabled to save cache on windows which could be restored on any platform
* @returns * @returns
*/ */
async function saveCacheV2( async function saveCacheV2(
@ -509,8 +509,7 @@ async function saveCacheV2(
) )
} }
// Set the archive size in the options, will be used to display the upload // Set the archive size in the options, will be used to display the upload progress
// progress
options.archiveSizeBytes = archiveFileSize options.archiveSizeBytes = archiveFileSize
core.debug('Reserving Cache') core.debug('Reserving Cache')

View File

@ -119,6 +119,16 @@ export class UploadProgress {
} }
} }
/**
* Uploads a cache archive directly to Azure Blob Storage using the Azure SDK.
* This function will display progress information to the console. Concurrency of the
* upload is determined by the calling functions.
*
* @param signedUploadURL
* @param archivePath
* @param options
* @returns
*/
export async function uploadCacheArchiveSDK( export async function uploadCacheArchiveSDK(
signedUploadURL: string, signedUploadURL: string,
archivePath: string, archivePath: string,
@ -151,7 +161,7 @@ export async function uploadCacheArchiveSDK(
// TODO: better management of non-retryable errors // TODO: better management of non-retryable errors
if (response._response.status >= 400) { if (response._response.status >= 400) {
throw new InvalidResponseError( throw new InvalidResponseError(
`Upload failed with status code ${response._response.status}` `uploadCacheArchiveSDK: upload failed with status code ${response._response.status}`
) )
} }