mirror of
https://github.com/actions/cache.git
synced 2026-01-12 00:23:06 +08:00
Compare commits
3 Commits
6cb7f3794d
...
1d1d882763
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d1d882763 | ||
|
|
deb06177bb | ||
|
|
e0fdb976a2 |
28
dist/restore-only/index.js
vendored
28
dist/restore-only/index.js
vendored
@ -5944,8 +5944,8 @@ exports.isFeatureAvailable = isFeatureAvailable;
|
||||
* Restores cache from keys
|
||||
*
|
||||
* @param paths a list of file paths to restore from the cache
|
||||
* @param primaryKey an explicit key for restoring the cache
|
||||
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for key
|
||||
* @param primaryKey an explicit key for restoring the cache. Lookup is done with prefix matching.
|
||||
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for primaryKey
|
||||
* @param downloadOptions cache download options
|
||||
* @param enableCrossOsArchive an optional boolean enabled to restore on windows any cache created on any platform
|
||||
* @returns string returns the key for the cache hit, otherwise returns undefined
|
||||
@ -5969,10 +5969,10 @@ exports.restoreCache = restoreCache;
|
||||
* Restores cache using the legacy Cache Service
|
||||
*
|
||||
* @param paths a list of file paths to restore from the cache
|
||||
* @param primaryKey an explicit key for restoring the cache
|
||||
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for key
|
||||
* @param primaryKey an explicit key for restoring the cache. Lookup is done with prefix matching.
|
||||
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for primaryKey
|
||||
* @param options cache download options
|
||||
* @param enableCrossOsArchive an optional boolean enabled to restore on windows any cache created on any platform
|
||||
* @param enableCrossOsArchive an optional boolean enabled to restore on Windows any cache created on any platform
|
||||
* @returns string returns the key for the cache hit, otherwise returns undefined
|
||||
*/
|
||||
function restoreCacheV1(paths, primaryKey, restoreKeys, options, enableCrossOsArchive = false) {
|
||||
@ -6042,8 +6042,8 @@ function restoreCacheV1(paths, primaryKey, restoreKeys, options, enableCrossOsAr
|
||||
* Restores cache using Cache Service v2
|
||||
*
|
||||
* @param paths a list of file paths to restore from the cache
|
||||
* @param primaryKey an explicit key for restoring the cache
|
||||
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for key
|
||||
* @param primaryKey an explicit key for restoring the cache. Lookup is done with prefix matching
|
||||
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for primaryKey
|
||||
* @param downloadOptions cache download options
|
||||
* @param enableCrossOsArchive an optional boolean enabled to restore on windows any cache created on any platform
|
||||
* @returns string returns the key for the cache hit, otherwise returns undefined
|
||||
@ -6231,6 +6231,8 @@ function saveCacheV1(paths, key, options, enableCrossOsArchive = false) {
|
||||
function saveCacheV2(paths, key, options, enableCrossOsArchive = false) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Override UploadOptions to force the use of Azure
|
||||
// ...options goes first because we want to override the default values
|
||||
// set in UploadOptions with these specific figures
|
||||
options = Object.assign(Object.assign({}, options), { uploadChunkSize: 64 * 1024 * 1024, uploadConcurrency: 8, useAzureSdk: true });
|
||||
const compressionMethod = yield utils.getCompressionMethod();
|
||||
const twirpClient = cacheTwirpClient.internalCacheTwirpClient();
|
||||
@ -9909,6 +9911,7 @@ const core = __importStar(__nccwpck_require__(4850));
|
||||
* @param copy the original upload options
|
||||
*/
|
||||
function getUploadOptions(copy) {
|
||||
// Defaults if not overriden
|
||||
const result = {
|
||||
useAzureSdk: false,
|
||||
uploadConcurrency: 4,
|
||||
@ -9925,6 +9928,17 @@ function getUploadOptions(copy) {
|
||||
result.uploadChunkSize = copy.uploadChunkSize;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Add env var overrides
|
||||
*/
|
||||
// Cap the uploadConcurrency at 32
|
||||
result.uploadConcurrency = !isNaN(Number(process.env['CACHE_UPLOAD_CONCURRENCY']))
|
||||
? Math.min(32, Number(process.env['CACHE_UPLOAD_CONCURRENCY']))
|
||||
: result.uploadConcurrency;
|
||||
// Cap the uploadChunkSize at 128MiB
|
||||
result.uploadChunkSize = !isNaN(Number(process.env['CACHE_UPLOAD_CHUNK_SIZE']))
|
||||
? Math.min(128 * 1024 * 1024, Number(process.env['CACHE_UPLOAD_CHUNK_SIZE']) * 1024 * 1024)
|
||||
: result.uploadChunkSize;
|
||||
core.debug(`Use Azure SDK: ${result.useAzureSdk}`);
|
||||
core.debug(`Upload concurrency: ${result.uploadConcurrency}`);
|
||||
core.debug(`Upload chunk size: ${result.uploadChunkSize}`);
|
||||
|
||||
28
dist/restore/index.js
vendored
28
dist/restore/index.js
vendored
@ -5944,8 +5944,8 @@ exports.isFeatureAvailable = isFeatureAvailable;
|
||||
* Restores cache from keys
|
||||
*
|
||||
* @param paths a list of file paths to restore from the cache
|
||||
* @param primaryKey an explicit key for restoring the cache
|
||||
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for key
|
||||
* @param primaryKey an explicit key for restoring the cache. Lookup is done with prefix matching.
|
||||
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for primaryKey
|
||||
* @param downloadOptions cache download options
|
||||
* @param enableCrossOsArchive an optional boolean enabled to restore on windows any cache created on any platform
|
||||
* @returns string returns the key for the cache hit, otherwise returns undefined
|
||||
@ -5969,10 +5969,10 @@ exports.restoreCache = restoreCache;
|
||||
* Restores cache using the legacy Cache Service
|
||||
*
|
||||
* @param paths a list of file paths to restore from the cache
|
||||
* @param primaryKey an explicit key for restoring the cache
|
||||
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for key
|
||||
* @param primaryKey an explicit key for restoring the cache. Lookup is done with prefix matching.
|
||||
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for primaryKey
|
||||
* @param options cache download options
|
||||
* @param enableCrossOsArchive an optional boolean enabled to restore on windows any cache created on any platform
|
||||
* @param enableCrossOsArchive an optional boolean enabled to restore on Windows any cache created on any platform
|
||||
* @returns string returns the key for the cache hit, otherwise returns undefined
|
||||
*/
|
||||
function restoreCacheV1(paths, primaryKey, restoreKeys, options, enableCrossOsArchive = false) {
|
||||
@ -6042,8 +6042,8 @@ function restoreCacheV1(paths, primaryKey, restoreKeys, options, enableCrossOsAr
|
||||
* Restores cache using Cache Service v2
|
||||
*
|
||||
* @param paths a list of file paths to restore from the cache
|
||||
* @param primaryKey an explicit key for restoring the cache
|
||||
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for key
|
||||
* @param primaryKey an explicit key for restoring the cache. Lookup is done with prefix matching
|
||||
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for primaryKey
|
||||
* @param downloadOptions cache download options
|
||||
* @param enableCrossOsArchive an optional boolean enabled to restore on windows any cache created on any platform
|
||||
* @returns string returns the key for the cache hit, otherwise returns undefined
|
||||
@ -6231,6 +6231,8 @@ function saveCacheV1(paths, key, options, enableCrossOsArchive = false) {
|
||||
function saveCacheV2(paths, key, options, enableCrossOsArchive = false) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Override UploadOptions to force the use of Azure
|
||||
// ...options goes first because we want to override the default values
|
||||
// set in UploadOptions with these specific figures
|
||||
options = Object.assign(Object.assign({}, options), { uploadChunkSize: 64 * 1024 * 1024, uploadConcurrency: 8, useAzureSdk: true });
|
||||
const compressionMethod = yield utils.getCompressionMethod();
|
||||
const twirpClient = cacheTwirpClient.internalCacheTwirpClient();
|
||||
@ -9909,6 +9911,7 @@ const core = __importStar(__nccwpck_require__(4850));
|
||||
* @param copy the original upload options
|
||||
*/
|
||||
function getUploadOptions(copy) {
|
||||
// Defaults if not overriden
|
||||
const result = {
|
||||
useAzureSdk: false,
|
||||
uploadConcurrency: 4,
|
||||
@ -9925,6 +9928,17 @@ function getUploadOptions(copy) {
|
||||
result.uploadChunkSize = copy.uploadChunkSize;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Add env var overrides
|
||||
*/
|
||||
// Cap the uploadConcurrency at 32
|
||||
result.uploadConcurrency = !isNaN(Number(process.env['CACHE_UPLOAD_CONCURRENCY']))
|
||||
? Math.min(32, Number(process.env['CACHE_UPLOAD_CONCURRENCY']))
|
||||
: result.uploadConcurrency;
|
||||
// Cap the uploadChunkSize at 128MiB
|
||||
result.uploadChunkSize = !isNaN(Number(process.env['CACHE_UPLOAD_CHUNK_SIZE']))
|
||||
? Math.min(128 * 1024 * 1024, Number(process.env['CACHE_UPLOAD_CHUNK_SIZE']) * 1024 * 1024)
|
||||
: result.uploadChunkSize;
|
||||
core.debug(`Use Azure SDK: ${result.useAzureSdk}`);
|
||||
core.debug(`Upload concurrency: ${result.uploadConcurrency}`);
|
||||
core.debug(`Upload chunk size: ${result.uploadChunkSize}`);
|
||||
|
||||
28
dist/save-only/index.js
vendored
28
dist/save-only/index.js
vendored
@ -5944,8 +5944,8 @@ exports.isFeatureAvailable = isFeatureAvailable;
|
||||
* Restores cache from keys
|
||||
*
|
||||
* @param paths a list of file paths to restore from the cache
|
||||
* @param primaryKey an explicit key for restoring the cache
|
||||
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for key
|
||||
* @param primaryKey an explicit key for restoring the cache. Lookup is done with prefix matching.
|
||||
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for primaryKey
|
||||
* @param downloadOptions cache download options
|
||||
* @param enableCrossOsArchive an optional boolean enabled to restore on windows any cache created on any platform
|
||||
* @returns string returns the key for the cache hit, otherwise returns undefined
|
||||
@ -5969,10 +5969,10 @@ exports.restoreCache = restoreCache;
|
||||
* Restores cache using the legacy Cache Service
|
||||
*
|
||||
* @param paths a list of file paths to restore from the cache
|
||||
* @param primaryKey an explicit key for restoring the cache
|
||||
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for key
|
||||
* @param primaryKey an explicit key for restoring the cache. Lookup is done with prefix matching.
|
||||
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for primaryKey
|
||||
* @param options cache download options
|
||||
* @param enableCrossOsArchive an optional boolean enabled to restore on windows any cache created on any platform
|
||||
* @param enableCrossOsArchive an optional boolean enabled to restore on Windows any cache created on any platform
|
||||
* @returns string returns the key for the cache hit, otherwise returns undefined
|
||||
*/
|
||||
function restoreCacheV1(paths, primaryKey, restoreKeys, options, enableCrossOsArchive = false) {
|
||||
@ -6042,8 +6042,8 @@ function restoreCacheV1(paths, primaryKey, restoreKeys, options, enableCrossOsAr
|
||||
* Restores cache using Cache Service v2
|
||||
*
|
||||
* @param paths a list of file paths to restore from the cache
|
||||
* @param primaryKey an explicit key for restoring the cache
|
||||
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for key
|
||||
* @param primaryKey an explicit key for restoring the cache. Lookup is done with prefix matching
|
||||
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for primaryKey
|
||||
* @param downloadOptions cache download options
|
||||
* @param enableCrossOsArchive an optional boolean enabled to restore on windows any cache created on any platform
|
||||
* @returns string returns the key for the cache hit, otherwise returns undefined
|
||||
@ -6231,6 +6231,8 @@ function saveCacheV1(paths, key, options, enableCrossOsArchive = false) {
|
||||
function saveCacheV2(paths, key, options, enableCrossOsArchive = false) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Override UploadOptions to force the use of Azure
|
||||
// ...options goes first because we want to override the default values
|
||||
// set in UploadOptions with these specific figures
|
||||
options = Object.assign(Object.assign({}, options), { uploadChunkSize: 64 * 1024 * 1024, uploadConcurrency: 8, useAzureSdk: true });
|
||||
const compressionMethod = yield utils.getCompressionMethod();
|
||||
const twirpClient = cacheTwirpClient.internalCacheTwirpClient();
|
||||
@ -9909,6 +9911,7 @@ const core = __importStar(__nccwpck_require__(4850));
|
||||
* @param copy the original upload options
|
||||
*/
|
||||
function getUploadOptions(copy) {
|
||||
// Defaults if not overriden
|
||||
const result = {
|
||||
useAzureSdk: false,
|
||||
uploadConcurrency: 4,
|
||||
@ -9925,6 +9928,17 @@ function getUploadOptions(copy) {
|
||||
result.uploadChunkSize = copy.uploadChunkSize;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Add env var overrides
|
||||
*/
|
||||
// Cap the uploadConcurrency at 32
|
||||
result.uploadConcurrency = !isNaN(Number(process.env['CACHE_UPLOAD_CONCURRENCY']))
|
||||
? Math.min(32, Number(process.env['CACHE_UPLOAD_CONCURRENCY']))
|
||||
: result.uploadConcurrency;
|
||||
// Cap the uploadChunkSize at 128MiB
|
||||
result.uploadChunkSize = !isNaN(Number(process.env['CACHE_UPLOAD_CHUNK_SIZE']))
|
||||
? Math.min(128 * 1024 * 1024, Number(process.env['CACHE_UPLOAD_CHUNK_SIZE']) * 1024 * 1024)
|
||||
: result.uploadChunkSize;
|
||||
core.debug(`Use Azure SDK: ${result.useAzureSdk}`);
|
||||
core.debug(`Upload concurrency: ${result.uploadConcurrency}`);
|
||||
core.debug(`Upload chunk size: ${result.uploadChunkSize}`);
|
||||
|
||||
28
dist/save/index.js
vendored
28
dist/save/index.js
vendored
@ -5944,8 +5944,8 @@ exports.isFeatureAvailable = isFeatureAvailable;
|
||||
* Restores cache from keys
|
||||
*
|
||||
* @param paths a list of file paths to restore from the cache
|
||||
* @param primaryKey an explicit key for restoring the cache
|
||||
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for key
|
||||
* @param primaryKey an explicit key for restoring the cache. Lookup is done with prefix matching.
|
||||
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for primaryKey
|
||||
* @param downloadOptions cache download options
|
||||
* @param enableCrossOsArchive an optional boolean enabled to restore on windows any cache created on any platform
|
||||
* @returns string returns the key for the cache hit, otherwise returns undefined
|
||||
@ -5969,10 +5969,10 @@ exports.restoreCache = restoreCache;
|
||||
* Restores cache using the legacy Cache Service
|
||||
*
|
||||
* @param paths a list of file paths to restore from the cache
|
||||
* @param primaryKey an explicit key for restoring the cache
|
||||
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for key
|
||||
* @param primaryKey an explicit key for restoring the cache. Lookup is done with prefix matching.
|
||||
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for primaryKey
|
||||
* @param options cache download options
|
||||
* @param enableCrossOsArchive an optional boolean enabled to restore on windows any cache created on any platform
|
||||
* @param enableCrossOsArchive an optional boolean enabled to restore on Windows any cache created on any platform
|
||||
* @returns string returns the key for the cache hit, otherwise returns undefined
|
||||
*/
|
||||
function restoreCacheV1(paths, primaryKey, restoreKeys, options, enableCrossOsArchive = false) {
|
||||
@ -6042,8 +6042,8 @@ function restoreCacheV1(paths, primaryKey, restoreKeys, options, enableCrossOsAr
|
||||
* Restores cache using Cache Service v2
|
||||
*
|
||||
* @param paths a list of file paths to restore from the cache
|
||||
* @param primaryKey an explicit key for restoring the cache
|
||||
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for key
|
||||
* @param primaryKey an explicit key for restoring the cache. Lookup is done with prefix matching
|
||||
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for primaryKey
|
||||
* @param downloadOptions cache download options
|
||||
* @param enableCrossOsArchive an optional boolean enabled to restore on windows any cache created on any platform
|
||||
* @returns string returns the key for the cache hit, otherwise returns undefined
|
||||
@ -6231,6 +6231,8 @@ function saveCacheV1(paths, key, options, enableCrossOsArchive = false) {
|
||||
function saveCacheV2(paths, key, options, enableCrossOsArchive = false) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// Override UploadOptions to force the use of Azure
|
||||
// ...options goes first because we want to override the default values
|
||||
// set in UploadOptions with these specific figures
|
||||
options = Object.assign(Object.assign({}, options), { uploadChunkSize: 64 * 1024 * 1024, uploadConcurrency: 8, useAzureSdk: true });
|
||||
const compressionMethod = yield utils.getCompressionMethod();
|
||||
const twirpClient = cacheTwirpClient.internalCacheTwirpClient();
|
||||
@ -9909,6 +9911,7 @@ const core = __importStar(__nccwpck_require__(4850));
|
||||
* @param copy the original upload options
|
||||
*/
|
||||
function getUploadOptions(copy) {
|
||||
// Defaults if not overriden
|
||||
const result = {
|
||||
useAzureSdk: false,
|
||||
uploadConcurrency: 4,
|
||||
@ -9925,6 +9928,17 @@ function getUploadOptions(copy) {
|
||||
result.uploadChunkSize = copy.uploadChunkSize;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Add env var overrides
|
||||
*/
|
||||
// Cap the uploadConcurrency at 32
|
||||
result.uploadConcurrency = !isNaN(Number(process.env['CACHE_UPLOAD_CONCURRENCY']))
|
||||
? Math.min(32, Number(process.env['CACHE_UPLOAD_CONCURRENCY']))
|
||||
: result.uploadConcurrency;
|
||||
// Cap the uploadChunkSize at 128MiB
|
||||
result.uploadChunkSize = !isNaN(Number(process.env['CACHE_UPLOAD_CHUNK_SIZE']))
|
||||
? Math.min(128 * 1024 * 1024, Number(process.env['CACHE_UPLOAD_CHUNK_SIZE']) * 1024 * 1024)
|
||||
: result.uploadChunkSize;
|
||||
core.debug(`Use Azure SDK: ${result.useAzureSdk}`);
|
||||
core.debug(`Upload concurrency: ${result.uploadConcurrency}`);
|
||||
core.debug(`Upload chunk size: ${result.uploadChunkSize}`);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user