Skip to content

Commit da63002

Browse files
committed
Compile dist/
1 parent e6e98cd commit da63002

File tree

4 files changed

+41
-35
lines changed

4 files changed

+41
-35
lines changed

dist/main/index.js

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -672,20 +672,12 @@ function saveCacheV2(paths, key, options, enableCrossOsArchive = false) {
672672
key,
673673
version
674674
};
675-
let signedUploadUrl;
676-
try {
677-
const response = yield twirpClient.CreateCacheEntry(request);
678-
if (!response.ok) {
679-
throw new Error('Response was not ok');
680-
}
681-
signedUploadUrl = response.signedUploadUrl;
682-
}
683-
catch (error) {
684-
core.debug(`Failed to reserve cache: ${error}`);
675+
const response = yield twirpClient.CreateCacheEntry(request);
676+
if (!response.ok) {
685677
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
686678
}
687679
core.debug(`Attempting to upload cache located at: ${archivePath}`);
688-
yield cacheHttpClient.saveCache(cacheId, archivePath, signedUploadUrl, options);
680+
yield cacheHttpClient.saveCache(cacheId, archivePath, response.signedUploadUrl, options);
689681
const finalizeRequest = {
690682
key,
691683
version,
@@ -103217,7 +103209,7 @@ exports.visitAsync = visitAsync;
103217103209
/***/ ((module) => {
103218103210

103219103211
"use strict";
103220-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/cache","version":"4.0.2","preview":true,"description":"Actions cache lib","keywords":["github","actions","cache"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/cache","license":"MIT","main":"lib/cache.js","types":"lib/cache.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/cache"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"echo \\"Error: run tests from root\\" && exit 1","tsc":"tsc"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.11.1","@actions/exec":"^1.0.1","@actions/glob":"^0.1.0","@actions/http-client":"^2.1.1","@actions/io":"^1.0.1","@azure/abort-controller":"^1.1.0","@azure/ms-rest-js":"^2.6.0","@azure/storage-blob":"^12.13.0","@protobuf-ts/plugin":"^2.9.4","semver":"^6.3.1"},"devDependencies":{"@types/semver":"^6.0.0","typescript":"^5.2.2"}}');
103212+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/cache","version":"4.0.1","preview":true,"description":"Actions cache lib","keywords":["github","actions","cache"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/cache","license":"MIT","main":"lib/cache.js","types":"lib/cache.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/cache"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"echo \\"Error: run tests from root\\" && exit 1","tsc":"tsc"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.11.1","@actions/exec":"^1.0.1","@actions/glob":"^0.1.0","@actions/http-client":"^2.1.1","@actions/io":"^1.0.1","@azure/abort-controller":"^1.1.0","@azure/ms-rest-js":"^2.6.0","@azure/storage-blob":"^12.13.0","@protobuf-ts/plugin":"^2.9.4","semver":"^6.3.1"},"devDependencies":{"@types/semver":"^6.0.0","typescript":"^5.2.2"}}');
103221103213

103222103214
/***/ }),
103223103215

@@ -103304,7 +103296,7 @@ async function setupBazel() {
103304103296

103305103297
await setupBazelisk()
103306103298
await restoreCache(config.bazeliskCache)
103307-
await restoreCache(config.diskCache)
103299+
await restoreDiskCache(config.diskCache)
103308103300
await restoreCache(config.repositoryCache)
103309103301
await restoreExternalCaches(config.externalCache)
103310103302

@@ -103421,7 +103413,7 @@ async function restoreExternalCaches(cacheConfig) {
103421103413
}
103422103414
}
103423103415

103424-
async function restoreCache(cacheConfig) {
103416+
async function restoreCacheImpl(cacheConfig, primaryKey, restoreKeys, cacheHit) {
103425103417
if (!cacheConfig.enabled) {
103426103418
return
103427103419
}
@@ -103430,23 +103422,20 @@ async function restoreCache(cacheConfig) {
103430103422
await index_setTimeout(delay, async function () {
103431103423
core.startGroup(`Restore cache for ${cacheConfig.name}`)
103432103424

103433-
const hash = await glob.hashFiles(cacheConfig.files.join('\n'))
103434103425
const name = cacheConfig.name
103435103426
const paths = cacheConfig.paths
103436-
const restoreKey = `${config.baseCacheKey}-${name}-`
103437-
const key = `${restoreKey}${hash}`
103438103427

103439-
core.debug(`Attempting to restore ${name} cache from ${key}`)
103428+
core.debug(`Attempting to restore ${name} cache from ${primaryKey}`)
103440103429

103441103430
const restoredKey = await cache.restoreCache(
103442-
paths, key, [restoreKey],
103431+
paths, primaryKey, restoreKeys,
103443103432
{ segmentTimeoutInMs: 300000 } // 5 minutes
103444103433
)
103445103434

103446103435
if (restoredKey) {
103447103436
core.info(`Successfully restored cache from ${restoredKey}`)
103448103437

103449-
if (restoredKey === key) {
103438+
if (cacheHit(restoredKey)) {
103450103439
core.saveState(`${name}-cache-hit`, 'true')
103451103440
}
103452103441
} else {
@@ -103457,6 +103446,30 @@ async function restoreCache(cacheConfig) {
103457103446
}())
103458103447
}
103459103448

103449+
async function restoreCache(cacheConfig) {
103450+
const hash = await glob.hashFiles(cacheConfig.files.join('\n'))
103451+
const restoreKey = `${config.baseCacheKey}-${cacheConfig.name}-`
103452+
const key = `${restoreKey}${hash}`
103453+
await restoreCacheImpl(
103454+
cacheConfig, key, [restoreKey],
103455+
restoredKey => restoredKey === key
103456+
)
103457+
}
103458+
103459+
async function restoreDiskCache(cacheConfig) {
103460+
const hash = await glob.hashFiles(cacheConfig.files.join('\n'))
103461+
103462+
// Since disk caches get updated on any change, each run has a unique key.
103463+
// Therefore it can only be restored by prefix match, rather than exact key match.
103464+
// When multiple prefix matches exist, the most recent is selected.
103465+
const restoreKey = `${config.baseCacheKey}-${cacheConfig.name}-`
103466+
const hashedRestoreKey = `${restoreKey}${hash}-`
103467+
await restoreCacheImpl(
103468+
cacheConfig, hashedRestoreKey, [hashedRestoreKey, restoreKey],
103469+
restoredKey => restoredKey.startsWith(hashedRestoreKey)
103470+
)
103471+
}
103472+
103460103473
run()
103461103474

103462103475
module.exports = __webpack_exports__;

dist/main/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/post/index.js

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -672,20 +672,12 @@ function saveCacheV2(paths, key, options, enableCrossOsArchive = false) {
672672
key,
673673
version
674674
};
675-
let signedUploadUrl;
676-
try {
677-
const response = yield twirpClient.CreateCacheEntry(request);
678-
if (!response.ok) {
679-
throw new Error('Response was not ok');
680-
}
681-
signedUploadUrl = response.signedUploadUrl;
682-
}
683-
catch (error) {
684-
core.debug(`Failed to reserve cache: ${error}`);
675+
const response = yield twirpClient.CreateCacheEntry(request);
676+
if (!response.ok) {
685677
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
686678
}
687679
core.debug(`Attempting to upload cache located at: ${archivePath}`);
688-
yield cacheHttpClient.saveCache(cacheId, archivePath, signedUploadUrl, options);
680+
yield cacheHttpClient.saveCache(cacheId, archivePath, response.signedUploadUrl, options);
689681
const finalizeRequest = {
690682
key,
691683
version,
@@ -102364,7 +102356,7 @@ exports.visitAsync = visitAsync;
102364102356
/***/ ((module) => {
102365102357

102366102358
"use strict";
102367-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/cache","version":"4.0.2","preview":true,"description":"Actions cache lib","keywords":["github","actions","cache"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/cache","license":"MIT","main":"lib/cache.js","types":"lib/cache.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/cache"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"echo \\"Error: run tests from root\\" && exit 1","tsc":"tsc"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.11.1","@actions/exec":"^1.0.1","@actions/glob":"^0.1.0","@actions/http-client":"^2.1.1","@actions/io":"^1.0.1","@azure/abort-controller":"^1.1.0","@azure/ms-rest-js":"^2.6.0","@azure/storage-blob":"^12.13.0","@protobuf-ts/plugin":"^2.9.4","semver":"^6.3.1"},"devDependencies":{"@types/semver":"^6.0.0","typescript":"^5.2.2"}}');
102359+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/cache","version":"4.0.1","preview":true,"description":"Actions cache lib","keywords":["github","actions","cache"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/cache","license":"MIT","main":"lib/cache.js","types":"lib/cache.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/cache"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"echo \\"Error: run tests from root\\" && exit 1","tsc":"tsc"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.11.1","@actions/exec":"^1.0.1","@actions/glob":"^0.1.0","@actions/http-client":"^2.1.1","@actions/io":"^1.0.1","@azure/abort-controller":"^1.1.0","@azure/ms-rest-js":"^2.6.0","@azure/storage-blob":"^12.13.0","@protobuf-ts/plugin":"^2.9.4","semver":"^6.3.1"},"devDependencies":{"@types/semver":"^6.0.0","typescript":"^5.2.2"}}');
102368102360

102369102361
/***/ }),
102370102362

@@ -102427,6 +102419,7 @@ const fs = __nccwpck_require__(9896)
102427102419
const path = __nccwpck_require__(6928)
102428102420
const cache = __nccwpck_require__(5116)
102429102421
const core = __nccwpck_require__(7484)
102422+
const github = __nccwpck_require__(3228)
102430102423
const glob = __nccwpck_require__(7206)
102431102424
const config = __nccwpck_require__(700)
102432102425
const gc = __nccwpck_require__(1724)
@@ -102505,7 +102498,7 @@ async function saveDiskCache(cacheConfig) {
102505102498
// We don't want to follow symlinks as it's extremely slow on macOS.
102506102499
{ followSymbolicLinks: false }
102507102500
)
102508-
const key = `${config.baseCacheKey}-${cacheConfig.name}-${hash}`
102501+
const key = `${config.baseCacheKey}-${cacheConfig.name}-${hash}-${github.context.run_id}.${github.context.run_attempt}`
102509102502
core.debug(`Attempting to save ${paths} cache to ${key}`)
102510102503
await cache.saveCache(paths, key)
102511102504
core.info('Successfully saved cache')

dist/post/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)