mirror of
https://github.com/gradle/actions.git
synced 2026-10-16 19:57:12 +08:00
Merge pull request #142 from gradle/strict-cache-match
Improves logging for caching, and adds 2 experimental cache options: - `gradle-home-cache-strict-match`: Avoid re-using a Gradle Home cache entry written by a different job. Only cache entries written by the current Job will be used. - `cache-write-only`: Do not restore existing cache entries, but still save cache entries in post-action. Fixes #141.
This commit is contained in:
11 files changed
+125
-56
No files matched your search
@@ -101,3 +101,42 @@ jobs:
|
||||
with:
|
||||
script: |
|
||||
core.setFailed('No build scan detected')
|
||||
|
||||
# Test seed the cache with cache-write-only and verify with cache-read-only
|
||||
seed-build-write-only:
|
||||
env:
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-write-only-
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup Gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-write-only: true
|
||||
- name: Build using Gradle wrapper
|
||||
working-directory: __tests__/samples/groovy-dsl
|
||||
run: ./gradlew test
|
||||
|
||||
verify-write-only-build:
|
||||
env:
|
||||
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: ${{github.workflow}}#${{github.run_number}}:${{github.run_attempt}}-write-only-
|
||||
needs: seed-build-write-only
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup Gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: true
|
||||
- name: Execute Gradle build with --offline
|
||||
working-directory: __tests__/samples/groovy-dsl
|
||||
run: ./gradlew test --offline
|
||||
|
||||
+9
-1
@@ -48,8 +48,16 @@ inputs:
|
||||
|
||||
# EXPERIMENTAL & INTERNAL ACTION INPUTS
|
||||
# The following action properties allow fine-grained tweaking of the action caching behaviour.
|
||||
# These properties are not designed for production use, and may change without notice in a subsequent release of `gradle-build-action`.
|
||||
# These properties are experimental and not (yet) designed for production use, and may change without notice in a subsequent release of `gradle-build-action`.
|
||||
# Use at your own risk!
|
||||
cache-write-only:
|
||||
description: When 'true', entries will not be restored from the cache but will be saved at the end of the Job. This allows a 'clean' cache entry to be written.
|
||||
required: false
|
||||
default: false
|
||||
gradle-home-cache-strict-match:
|
||||
description: When 'true', the action will not attempt to restore the Gradle User Home entries from other Jobs.
|
||||
required: false
|
||||
default: false
|
||||
workflow-job-context:
|
||||
description: Used to uniquely identify the current job invocation. Defaults to the matrix values for this job; this should not be overridden by users (INTERNAL).
|
||||
required: false
|
||||
|
||||
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
||||
require('./sourcemap-register.js');module.exports=function(e,t){"use strict";var a={};function __webpack_require__(t){if(a[t]){return a[t].exports}var i=a[t]={i:t,l:false,exports:{}};var n=true;try{e[t].call(i.exports,i,i.exports,__webpack_require__);n=false}finally{if(n)delete a[t]}i.l=true;return i.exports}__webpack_require__.ab=__dirname+"/";function startup(){return __webpack_require__(131)}return startup()}([function(e,t,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,a,i){if(i===undefined)i=a;Object.defineProperty(e,i,{enumerable:true,get:function(){return t[a]}})}:function(e,t,a,i){if(i===undefined)i=a;e[i]=t[a]});var n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a))i(t,e,a);n(t,e);return t};var s=this&&this.__awaiter||function(e,t,a,i){function adopt(e){return e instanceof a?e:new a(function(t){t(e)})}return new(a||(a=Promise))(function(a,n){function fulfilled(e){try{step(i.next(e))}catch(e){n(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){n(e)}}function step(e){e.done?a(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,t||[])).next())})};var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.ConfigurationCacheEntryExtractor=t.GradleHomeEntryExtractor=void 0;const p=r(a(622));const l=r(a(747));const c=o(a(470));const d=o(a(281));const u=a(101);const m=a(452);const f="GRADLE_BUILD_ACTION_SKIP_RESTORE";class ExtractedCacheEntry{constructor(e,t,a){this.artifactType=e;this.pattern=t;this.cacheKey=a}}class ExtractedCacheEntryMetadata{constructor(){this.entries=[]}}class ExtractedCacheEntryDefinition{constructor(e,t,a){this.uniqueFileNames=true;this.artifactType=e;this.pattern=t;this.bundle=a}withNonUniqueFileNames(){this.uniqueFileNames=false;return this}}class AbstractEntryExtractor{constructor(e,t){this.gradleUserHome=e;this.extractorName=t}restore(e){return s(this,void 0,void 0,function*(){const t=this.loadExtractedCacheEntries();const a=[];for(const i of t){const t=i.artifactType;const n=e.entry(i.pattern);const o=process.env[f]||"";if(o.includes(t)){c.info(`Not restoring extracted cache entry for ${t}`);n.markRequested("SKIP_RESTORE")}else{a.push(this.awaitForDebugging(this.restoreExtractedCacheEntry(t,i.cacheKey,i.pattern,n)))}}this.saveMetadataForCacheResults(yield Promise.all(a))})}restoreExtractedCacheEntry(e,t,a,i){return s(this,void 0,void 0,function*(){i.markRequested(t);const n=yield(0,m.restoreCache)([a],t);if(n){c.info(`Restored ${e} with key ${t} to ${a}`);i.markRestored(n.key,n.size);return new ExtractedCacheEntry(e,a,t)}else{c.info(`Did not restore ${e} with key ${t} to ${a}`);return new ExtractedCacheEntry(e,a,undefined)}})}extract(e){return s(this,void 0,void 0,function*(){const t=this.getExtractedCacheEntryDefinitions();(0,m.cacheDebug)(`Extracting cache entries for ${this.extractorName}: ${JSON.stringify(t,null,2)}`);const a=this.loadExtractedCacheEntries();const i=[];for(const n of t){const t=n.artifactType;const o=n.pattern;const s=yield d.create(o,{implicitDescendants:false,followSymbolicLinks:false});const r=yield s.glob();if(r.length===0){(0,m.cacheDebug)(`No files found to cache for ${t}`);continue}if(n.bundle){i.push(this.awaitForDebugging(this.saveExtractedCacheEntry(r,t,o,n.uniqueFileNames,a,e.entry(o))))}else{for(const o of r){i.push(this.awaitForDebugging(this.saveExtractedCacheEntry([o],t,o,n.uniqueFileNames,a,e.entry(o))))}}}this.saveMetadataForCacheResults(yield Promise.all(i))})}saveExtractedCacheEntry(e,t,a,i,n,o){var r;return s(this,void 0,void 0,function*(){const s=i?this.createCacheKeyFromFileNames(t,e):yield this.createCacheKeyFromFileContents(t,a);const p=(r=n.find(e=>e.artifactType===t&&e.pattern===a))===null||r===void 0?void 0:r.cacheKey;if(p===s){(0,m.cacheDebug)(`No change to previously restored ${t}. Not saving.`)}else{c.info(`Caching ${t} with path '${a}' and cache key: ${s}`);const e=yield(0,m.saveCache)([a],s);if(e!==undefined){o.markSaved(e.key,e.size)}}for(const t of e){(0,m.tryDelete)(t)}return new ExtractedCacheEntry(t,a,s)})}createCacheKeyFromFileNames(e,t){const a=(0,m.getCacheKeyPrefix)();const i=t.map(e=>p.default.relative(this.gradleUserHome,e));const n=(0,m.hashFileNames)(i);(0,m.cacheDebug)(`Generating cache key for ${e} from file names: ${i}`);return`${a}${e}-${n}`}createCacheKeyFromFileContents(e,t){return s(this,void 0,void 0,function*(){const a=(0,m.getCacheKeyPrefix)();const i=yield d.hashFiles(t);(0,m.cacheDebug)(`Generating cache key for ${e} from files matching: ${t}`);return`${a}${e}-${i}`})}awaitForDebugging(e){return s(this,void 0,void 0,function*(){if((0,m.isCacheDebuggingEnabled)()){yield e}return e})}loadExtractedCacheEntrieLine truncated
|
||||
require('./sourcemap-register.js');module.exports=function(e,t){"use strict";var a={};function __webpack_require__(t){if(a[t]){return a[t].exports}var i=a[t]={i:t,l:false,exports:{}};var n=true;try{e[t].call(i.exports,i,i.exports,__webpack_require__);n=false}finally{if(n)delete a[t]}i.l=true;return i.exports}__webpack_require__.ab=__dirname+"/";function startup(){return __webpack_require__(131)}return startup()}([function(e,t,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,a,i){if(i===undefined)i=a;Object.defineProperty(e,i,{enumerable:true,get:function(){return t[a]}})}:function(e,t,a,i){if(i===undefined)i=a;e[i]=t[a]});var n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a))i(t,e,a);n(t,e);return t};var s=this&&this.__awaiter||function(e,t,a,i){function adopt(e){return e instanceof a?e:new a(function(t){t(e)})}return new(a||(a=Promise))(function(a,n){function fulfilled(e){try{step(i.next(e))}catch(e){n(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){n(e)}}function step(e){e.done?a(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,t||[])).next())})};var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.ConfigurationCacheEntryExtractor=t.GradleHomeEntryExtractor=void 0;const p=r(a(622));const l=r(a(747));const c=o(a(470));const d=o(a(281));const u=a(101);const m=a(452);const f="GRADLE_BUILD_ACTION_SKIP_RESTORE";class ExtractedCacheEntry{constructor(e,t,a){this.artifactType=e;this.pattern=t;this.cacheKey=a}}class ExtractedCacheEntryMetadata{constructor(){this.entries=[]}}class ExtractedCacheEntryDefinition{constructor(e,t,a){this.uniqueFileNames=true;this.artifactType=e;this.pattern=t;this.bundle=a}withNonUniqueFileNames(){this.uniqueFileNames=false;return this}}class AbstractEntryExtractor{constructor(e,t){this.gradleUserHome=e;this.extractorName=t}restore(e){return s(this,void 0,void 0,function*(){const t=this.loadExtractedCacheEntries();const a=[];for(const i of t){const t=i.artifactType;const n=e.entry(i.pattern);const o=process.env[f]||"";if(o.includes(t)){c.info(`Not restoring extracted cache entry for ${t}`);n.markRequested("SKIP_RESTORE")}else{a.push(this.awaitForDebugging(this.restoreExtractedCacheEntry(t,i.cacheKey,i.pattern,n)))}}this.saveMetadataForCacheResults(yield Promise.all(a))})}restoreExtractedCacheEntry(e,t,a,i){return s(this,void 0,void 0,function*(){const n=yield(0,m.restoreCache)([a],t,[],i);if(n){c.info(`Restored ${e} with key ${t} to ${a}`);return new ExtractedCacheEntry(e,a,t)}else{c.info(`Did not restore ${e} with key ${t} to ${a}`);return new ExtractedCacheEntry(e,a,undefined)}})}extract(e){return s(this,void 0,void 0,function*(){const t=this.getExtractedCacheEntryDefinitions();(0,m.cacheDebug)(`Extracting cache entries for ${this.extractorName}: ${JSON.stringify(t,null,2)}`);const a=this.loadExtractedCacheEntries();const i=[];for(const n of t){const t=n.artifactType;const o=n.pattern;const s=yield d.create(o,{implicitDescendants:false,followSymbolicLinks:false});const r=yield s.glob();if(r.length===0){(0,m.cacheDebug)(`No files found to cache for ${t}`);continue}if(n.bundle){i.push(this.awaitForDebugging(this.saveExtractedCacheEntry(r,t,o,n.uniqueFileNames,a,e.entry(o))))}else{for(const o of r){i.push(this.awaitForDebugging(this.saveExtractedCacheEntry([o],t,o,n.uniqueFileNames,a,e.entry(o))))}}}this.saveMetadataForCacheResults(yield Promise.all(i))})}saveExtractedCacheEntry(e,t,a,i,n,o){var r;return s(this,void 0,void 0,function*(){const s=i?this.createCacheKeyFromFileNames(t,e):yield this.createCacheKeyFromFileContents(t,a);const p=(r=n.find(e=>e.artifactType===t&&e.pattern===a))===null||r===void 0?void 0:r.cacheKey;if(p===s){(0,m.cacheDebug)(`No change to previously restored ${t}. Not saving.`)}else{c.info(`Caching ${t} with path '${a}' and cache key: ${s}`);yield(0,m.saveCache)([a],s,o)}for(const t of e){(0,m.tryDelete)(t)}return new ExtractedCacheEntry(t,a,s)})}createCacheKeyFromFileNames(e,t){const a=(0,m.getCacheKeyPrefix)();const i=t.map(e=>p.default.relative(this.gradleUserHome,e));const n=(0,m.hashFileNames)(i);(0,m.cacheDebug)(`Generating cache key for ${e} from file names: ${i}`);return`${a}${e}-${n}`}createCacheKeyFromFileContents(e,t){return s(this,void 0,void 0,function*(){const a=(0,m.getCacheKeyPrefix)();const i=yield d.hashFiles(t);(0,m.cacheDebug)(`Generating cache key for ${e} from files matching: ${t}`);return`${a}${e}-${i}`})}awaitForDebugging(e){return s(this,void 0,void 0,function*(){if((0,m.isCacheDebuggingEnabled)()){yield e}return e})}loadExtractedCacheEntries(){const e=this.getCacheMetadataFile();if(!l.default.existsSync(e)){return[]}const t=l.defaulLine truncated
|
||||
//# sourceMappingURL=index.js.map
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["/webpack/bootstrap","../src/cache-extract-entries.ts","../node_modules/@actions/io/lib/io.js","../node_modules/@actions/exec/lib/toolrunner.js","../node_modules/wrappy/wrappy.js","../node_modules/@actions/cache/lib/internal/cacheUtils.js","../external \"tls\"","../(webpack)/ncc/@@notfound.js","../node_modules/xmlbuilder/lib/XMLDTDNotation.js","../node_modules/@opentelemetry/api/build/src/api/propagation.js","../node_modules/@azure/core-http/node_modules/uuid/dist/nil.js","../node_modules/@actions/tool-cache/lib/manifest.js","../node_modules/once/once.js","../node_modules/xmlbuilder/lib/DocumentPosition.js","../node_modules/node-fetch/node_modules/whatwg-url/lib/public-api.js","../node_modules/@azure/core-asynciterator-polyfill/dist-esm/index.js","../node_modules/@actions/core/lib/utils.js","../node_modules/uuid/v1.js","../external \"os\"","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/permuteDomain.js","../node_modules/@azure/core-http/node_modules/uuid/dist/v5.js","../node_modules/asynckit/serial.js","../node_modules/minimatch/minimatch.js","../node_modules/@opentelemetry/api/build/src/trace/link.js","../node_modules/@actions/cache/node_modules/@actions/glob/lib/internal-pattern-helper.js","../src/cache-base.ts","../node_modules/@actions/core/lib/file-command.js","../node_modules/@azure/core-http/node_modules/uuid/dist/version.js","../node_modules/@azure/abort-controller/dist/index.js","../node_modules/@opentelemetry/api/build/src/baggage/utils.js","../node_modules/@actions/cache/lib/internal/cacheHttpClient.js","../node_modules/@opentelemetry/api/build/src/api/diag.js","../node_modules/@actions/github/lib/internal/utils.js","../external \"child_process\"","../src/main.ts","../node_modules/@opentelemetry/api/build/src/context/context.js","../node_modules/uuid/lib/rng.js","../node_modules/tunnel/lib/tunnel.js","../node_modules/@opentelemetry/api/build/src/platform/node/globalThis.js","../node_modules/universalify/index.js","../node_modules/node-fetch/node_modules/webidl-conversions/lib/index.js","../node_modules/@opentelemetry/api/build/src/trace/NoopTracer.js","../node_modules/delayed-stream/lib/delayed_stream.js","../node_modules/asynckit/lib/iterate.js","../node_modules/@opentelemetry/api/build/src/common/Time.js","../node_modules/@opentelemetry/api/build/src/trace/NoopTracerProvider.js","../src/execution.ts","../node_modules/@azure/core-http/node_modules/uuid/dist/v1.js","../node_modules/@azure/core-http/node_modules/uuid/dist/parse.js","../node_modules/@opentelemetry/api/build/src/trace/trace_state.js","../node_modules/xml2js/lib/bom.js","../external \"https\"","../external \"timers\"","../node_modules/@opentelemetry/api/build/src/trace/SpanOptions.js","../node_modules/@actions/http-client/auth.js","../node_modules/@azure/core-auth/dist/index.js","../node_modules/@opentelemetry/api/build/src/diag/consoleLogger.js","../node_modules/@azure/core-http/node_modules/uuid/dist/regex.js","../node_modules/@azure/core-http/node_modules/uuid/dist/v35.js","../node_modules/@azure/core-http/node_modules/uuid/dist/md5.js","../node_modules/@actions/cache/node_modules/@actions/glob/lib/internal-pattern.js","../node_modules/@actions/cache/lib/internal/downloadUtils.js","../node_modules/node-fetch/node_modules/whatwg-url/lib/URL-impl.js","../node_modules/xmlbuilder/lib/XMLNode.js","../node_modules/@actions/github/lib/context.js","../node_modules/@azure/core-tracing/dist/index.js","../src/cache-reporting.ts","../node_modules/xmlbuilder/lib/XMLNodeList.js","../node_modules/semver/semver.js","../node_modules/@actions/glob/lib/glob.js","../src/provision.ts","../node_modules/@actions/cache/node_modules/@actions/glob/lib/internal-glob-options-helper.js","../node_modules/@opentelemetry/api/build/src/common/Exception.js","../external \"buffer\"","../node_modules/@octokit/plugin-paginate-rest/dist-node/index.js","../node_modules/@actions/glob/lib/internal-globber.js","../node_modules/@azure/core-http/node_modules/uuid/dist/v3.js","../node_modules/@actions/cache/node_modules/@actions/glob/lib/glob.js","../external \"string_decoder\"","../node_modules/brace-expansion/index.js","../node_modules/xmlbuilder/lib/index.js","../src/gradlew.ts","../node_modules/@actions/glob/lib/internal-match-kind.js","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/memstore.js","../node_modules/asynckit/index.js","../src/caches.ts","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/store.js","../node_modules/@opentelemetry/api/build/src/trace/SamplingResult.js","../node_modules/xmlbuilder/lib/XMLStringWriter.js","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/pathMatch.js","../node_modules/xml2js/lib/processors.js","../node_modules/is-plain-object/dist/is-plain-object.js","../external \"assert\"","../node_modules/@opentelemetry/api/build/src/diag/ComponentLogger.js","../node_modules/before-after-hook/lib/register.js","../node_modules/@azure/storage-blob/dist/index.js"Line truncated
|
||||
{"version":3,"sources":["/webpack/bootstrap","../src/cache-extract-entries.ts","../node_modules/@actions/io/lib/io.js","../node_modules/@actions/exec/lib/toolrunner.js","../node_modules/wrappy/wrappy.js","../node_modules/@actions/cache/lib/internal/cacheUtils.js","../external \"tls\"","../(webpack)/ncc/@@notfound.js","../node_modules/xmlbuilder/lib/XMLDTDNotation.js","../node_modules/@opentelemetry/api/build/src/api/propagation.js","../node_modules/@azure/core-http/node_modules/uuid/dist/nil.js","../node_modules/@actions/tool-cache/lib/manifest.js","../node_modules/once/once.js","../node_modules/xmlbuilder/lib/DocumentPosition.js","../node_modules/node-fetch/node_modules/whatwg-url/lib/public-api.js","../node_modules/@azure/core-asynciterator-polyfill/dist-esm/index.js","../node_modules/@actions/core/lib/utils.js","../node_modules/uuid/v1.js","../external \"os\"","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/permuteDomain.js","../node_modules/@azure/core-http/node_modules/uuid/dist/v5.js","../node_modules/asynckit/serial.js","../node_modules/minimatch/minimatch.js","../node_modules/@opentelemetry/api/build/src/trace/link.js","../node_modules/@actions/cache/node_modules/@actions/glob/lib/internal-pattern-helper.js","../src/cache-base.ts","../node_modules/@actions/core/lib/file-command.js","../node_modules/@azure/core-http/node_modules/uuid/dist/version.js","../node_modules/@azure/abort-controller/dist/index.js","../node_modules/@opentelemetry/api/build/src/baggage/utils.js","../node_modules/@actions/cache/lib/internal/cacheHttpClient.js","../node_modules/@opentelemetry/api/build/src/api/diag.js","../node_modules/@actions/github/lib/internal/utils.js","../external \"child_process\"","../src/main.ts","../node_modules/@opentelemetry/api/build/src/context/context.js","../node_modules/uuid/lib/rng.js","../node_modules/tunnel/lib/tunnel.js","../node_modules/@opentelemetry/api/build/src/platform/node/globalThis.js","../node_modules/universalify/index.js","../node_modules/node-fetch/node_modules/webidl-conversions/lib/index.js","../node_modules/@opentelemetry/api/build/src/trace/NoopTracer.js","../node_modules/delayed-stream/lib/delayed_stream.js","../node_modules/asynckit/lib/iterate.js","../node_modules/@opentelemetry/api/build/src/common/Time.js","../node_modules/@opentelemetry/api/build/src/trace/NoopTracerProvider.js","../src/execution.ts","../node_modules/@azure/core-http/node_modules/uuid/dist/v1.js","../node_modules/@azure/core-http/node_modules/uuid/dist/parse.js","../node_modules/@opentelemetry/api/build/src/trace/trace_state.js","../node_modules/xml2js/lib/bom.js","../external \"https\"","../external \"timers\"","../node_modules/@opentelemetry/api/build/src/trace/SpanOptions.js","../node_modules/@actions/http-client/auth.js","../node_modules/@azure/core-auth/dist/index.js","../node_modules/@opentelemetry/api/build/src/diag/consoleLogger.js","../node_modules/@azure/core-http/node_modules/uuid/dist/regex.js","../node_modules/@azure/core-http/node_modules/uuid/dist/v35.js","../node_modules/@azure/core-http/node_modules/uuid/dist/md5.js","../node_modules/@actions/cache/node_modules/@actions/glob/lib/internal-pattern.js","../node_modules/@actions/cache/lib/internal/downloadUtils.js","../node_modules/node-fetch/node_modules/whatwg-url/lib/URL-impl.js","../node_modules/xmlbuilder/lib/XMLNode.js","../node_modules/@actions/github/lib/context.js","../node_modules/@azure/core-tracing/dist/index.js","../src/cache-reporting.ts","../node_modules/xmlbuilder/lib/XMLNodeList.js","../node_modules/semver/semver.js","../node_modules/@actions/glob/lib/glob.js","../src/provision.ts","../node_modules/@actions/cache/node_modules/@actions/glob/lib/internal-glob-options-helper.js","../node_modules/@opentelemetry/api/build/src/common/Exception.js","../external \"buffer\"","../node_modules/@octokit/plugin-paginate-rest/dist-node/index.js","../node_modules/@actions/glob/lib/internal-globber.js","../node_modules/@azure/core-http/node_modules/uuid/dist/v3.js","../node_modules/@actions/cache/node_modules/@actions/glob/lib/glob.js","../external \"string_decoder\"","../node_modules/brace-expansion/index.js","../node_modules/xmlbuilder/lib/index.js","../src/gradlew.ts","../node_modules/@actions/glob/lib/internal-match-kind.js","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/memstore.js","../node_modules/asynckit/index.js","../src/caches.ts","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/store.js","../node_modules/@opentelemetry/api/build/src/trace/SamplingResult.js","../node_modules/xmlbuilder/lib/XMLStringWriter.js","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/pathMatch.js","../node_modules/xml2js/lib/processors.js","../node_modules/is-plain-object/dist/is-plain-object.js","../external \"assert\"","../node_modules/@opentelemetry/api/build/src/diag/ComponentLogger.js","../node_modules/before-after-hook/lib/register.js","../node_modules/@azure/storage-blob/dist/index.js"Line truncated
|
||||
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
||||
require('./sourcemap-register.js');module.exports=function(e,t){"use strict";var a={};function __webpack_require__(t){if(a[t]){return a[t].exports}var i=a[t]={i:t,l:false,exports:{}};var n=true;try{e[t].call(i.exports,i,i.exports,__webpack_require__);n=false}finally{if(n)delete a[t]}i.l=true;return i.exports}__webpack_require__.ab=__dirname+"/";function startup(){return __webpack_require__(878)}return startup()}([function(e,t,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,a,i){if(i===undefined)i=a;Object.defineProperty(e,i,{enumerable:true,get:function(){return t[a]}})}:function(e,t,a,i){if(i===undefined)i=a;e[i]=t[a]});var n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a))i(t,e,a);n(t,e);return t};var s=this&&this.__awaiter||function(e,t,a,i){function adopt(e){return e instanceof a?e:new a(function(t){t(e)})}return new(a||(a=Promise))(function(a,n){function fulfilled(e){try{step(i.next(e))}catch(e){n(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){n(e)}}function step(e){e.done?a(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,t||[])).next())})};var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.ConfigurationCacheEntryExtractor=t.GradleHomeEntryExtractor=void 0;const p=r(a(622));const l=r(a(747));const c=o(a(470));const d=o(a(281));const u=a(101);const m=a(452);const f="GRADLE_BUILD_ACTION_SKIP_RESTORE";class ExtractedCacheEntry{constructor(e,t,a){this.artifactType=e;this.pattern=t;this.cacheKey=a}}class ExtractedCacheEntryMetadata{constructor(){this.entries=[]}}class ExtractedCacheEntryDefinition{constructor(e,t,a){this.uniqueFileNames=true;this.artifactType=e;this.pattern=t;this.bundle=a}withNonUniqueFileNames(){this.uniqueFileNames=false;return this}}class AbstractEntryExtractor{constructor(e,t){this.gradleUserHome=e;this.extractorName=t}restore(e){return s(this,void 0,void 0,function*(){const t=this.loadExtractedCacheEntries();const a=[];for(const i of t){const t=i.artifactType;const n=e.entry(i.pattern);const o=process.env[f]||"";if(o.includes(t)){c.info(`Not restoring extracted cache entry for ${t}`);n.markRequested("SKIP_RESTORE")}else{a.push(this.awaitForDebugging(this.restoreExtractedCacheEntry(t,i.cacheKey,i.pattern,n)))}}this.saveMetadataForCacheResults(yield Promise.all(a))})}restoreExtractedCacheEntry(e,t,a,i){return s(this,void 0,void 0,function*(){i.markRequested(t);const n=yield(0,m.restoreCache)([a],t);if(n){c.info(`Restored ${e} with key ${t} to ${a}`);i.markRestored(n.key,n.size);return new ExtractedCacheEntry(e,a,t)}else{c.info(`Did not restore ${e} with key ${t} to ${a}`);return new ExtractedCacheEntry(e,a,undefined)}})}extract(e){return s(this,void 0,void 0,function*(){const t=this.getExtractedCacheEntryDefinitions();(0,m.cacheDebug)(`Extracting cache entries for ${this.extractorName}: ${JSON.stringify(t,null,2)}`);const a=this.loadExtractedCacheEntries();const i=[];for(const n of t){const t=n.artifactType;const o=n.pattern;const s=yield d.create(o,{implicitDescendants:false,followSymbolicLinks:false});const r=yield s.glob();if(r.length===0){(0,m.cacheDebug)(`No files found to cache for ${t}`);continue}if(n.bundle){i.push(this.awaitForDebugging(this.saveExtractedCacheEntry(r,t,o,n.uniqueFileNames,a,e.entry(o))))}else{for(const o of r){i.push(this.awaitForDebugging(this.saveExtractedCacheEntry([o],t,o,n.uniqueFileNames,a,e.entry(o))))}}}this.saveMetadataForCacheResults(yield Promise.all(i))})}saveExtractedCacheEntry(e,t,a,i,n,o){var r;return s(this,void 0,void 0,function*(){const s=i?this.createCacheKeyFromFileNames(t,e):yield this.createCacheKeyFromFileContents(t,a);const p=(r=n.find(e=>e.artifactType===t&&e.pattern===a))===null||r===void 0?void 0:r.cacheKey;if(p===s){(0,m.cacheDebug)(`No change to previously restored ${t}. Not saving.`)}else{c.info(`Caching ${t} with path '${a}' and cache key: ${s}`);const e=yield(0,m.saveCache)([a],s);if(e!==undefined){o.markSaved(e.key,e.size)}}for(const t of e){(0,m.tryDelete)(t)}return new ExtractedCacheEntry(t,a,s)})}createCacheKeyFromFileNames(e,t){const a=(0,m.getCacheKeyPrefix)();const i=t.map(e=>p.default.relative(this.gradleUserHome,e));const n=(0,m.hashFileNames)(i);(0,m.cacheDebug)(`Generating cache key for ${e} from file names: ${i}`);return`${a}${e}-${n}`}createCacheKeyFromFileContents(e,t){return s(this,void 0,void 0,function*(){const a=(0,m.getCacheKeyPrefix)();const i=yield d.hashFiles(t);(0,m.cacheDebug)(`Generating cache key for ${e} from files matching: ${t}`);return`${a}${e}-${i}`})}awaitForDebugging(e){return s(this,void 0,void 0,function*(){if((0,m.isCacheDebuggingEnabled)()){yield e}return e})}loadExtractedCacheEntrieLine truncated
|
||||
require('./sourcemap-register.js');module.exports=function(e,t){"use strict";var a={};function __webpack_require__(t){if(a[t]){return a[t].exports}var i=a[t]={i:t,l:false,exports:{}};var n=true;try{e[t].call(i.exports,i,i.exports,__webpack_require__);n=false}finally{if(n)delete a[t]}i.l=true;return i.exports}__webpack_require__.ab=__dirname+"/";function startup(){return __webpack_require__(878)}return startup()}([function(e,t,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,a,i){if(i===undefined)i=a;Object.defineProperty(e,i,{enumerable:true,get:function(){return t[a]}})}:function(e,t,a,i){if(i===undefined)i=a;e[i]=t[a]});var n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a))i(t,e,a);n(t,e);return t};var s=this&&this.__awaiter||function(e,t,a,i){function adopt(e){return e instanceof a?e:new a(function(t){t(e)})}return new(a||(a=Promise))(function(a,n){function fulfilled(e){try{step(i.next(e))}catch(e){n(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){n(e)}}function step(e){e.done?a(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,t||[])).next())})};var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.ConfigurationCacheEntryExtractor=t.GradleHomeEntryExtractor=void 0;const p=r(a(622));const l=r(a(747));const c=o(a(470));const d=o(a(281));const u=a(101);const m=a(452);const f="GRADLE_BUILD_ACTION_SKIP_RESTORE";class ExtractedCacheEntry{constructor(e,t,a){this.artifactType=e;this.pattern=t;this.cacheKey=a}}class ExtractedCacheEntryMetadata{constructor(){this.entries=[]}}class ExtractedCacheEntryDefinition{constructor(e,t,a){this.uniqueFileNames=true;this.artifactType=e;this.pattern=t;this.bundle=a}withNonUniqueFileNames(){this.uniqueFileNames=false;return this}}class AbstractEntryExtractor{constructor(e,t){this.gradleUserHome=e;this.extractorName=t}restore(e){return s(this,void 0,void 0,function*(){const t=this.loadExtractedCacheEntries();const a=[];for(const i of t){const t=i.artifactType;const n=e.entry(i.pattern);const o=process.env[f]||"";if(o.includes(t)){c.info(`Not restoring extracted cache entry for ${t}`);n.markRequested("SKIP_RESTORE")}else{a.push(this.awaitForDebugging(this.restoreExtractedCacheEntry(t,i.cacheKey,i.pattern,n)))}}this.saveMetadataForCacheResults(yield Promise.all(a))})}restoreExtractedCacheEntry(e,t,a,i){return s(this,void 0,void 0,function*(){const n=yield(0,m.restoreCache)([a],t,[],i);if(n){c.info(`Restored ${e} with key ${t} to ${a}`);return new ExtractedCacheEntry(e,a,t)}else{c.info(`Did not restore ${e} with key ${t} to ${a}`);return new ExtractedCacheEntry(e,a,undefined)}})}extract(e){return s(this,void 0,void 0,function*(){const t=this.getExtractedCacheEntryDefinitions();(0,m.cacheDebug)(`Extracting cache entries for ${this.extractorName}: ${JSON.stringify(t,null,2)}`);const a=this.loadExtractedCacheEntries();const i=[];for(const n of t){const t=n.artifactType;const o=n.pattern;const s=yield d.create(o,{implicitDescendants:false,followSymbolicLinks:false});const r=yield s.glob();if(r.length===0){(0,m.cacheDebug)(`No files found to cache for ${t}`);continue}if(n.bundle){i.push(this.awaitForDebugging(this.saveExtractedCacheEntry(r,t,o,n.uniqueFileNames,a,e.entry(o))))}else{for(const o of r){i.push(this.awaitForDebugging(this.saveExtractedCacheEntry([o],t,o,n.uniqueFileNames,a,e.entry(o))))}}}this.saveMetadataForCacheResults(yield Promise.all(i))})}saveExtractedCacheEntry(e,t,a,i,n,o){var r;return s(this,void 0,void 0,function*(){const s=i?this.createCacheKeyFromFileNames(t,e):yield this.createCacheKeyFromFileContents(t,a);const p=(r=n.find(e=>e.artifactType===t&&e.pattern===a))===null||r===void 0?void 0:r.cacheKey;if(p===s){(0,m.cacheDebug)(`No change to previously restored ${t}. Not saving.`)}else{c.info(`Caching ${t} with path '${a}' and cache key: ${s}`);yield(0,m.saveCache)([a],s,o)}for(const t of e){(0,m.tryDelete)(t)}return new ExtractedCacheEntry(t,a,s)})}createCacheKeyFromFileNames(e,t){const a=(0,m.getCacheKeyPrefix)();const i=t.map(e=>p.default.relative(this.gradleUserHome,e));const n=(0,m.hashFileNames)(i);(0,m.cacheDebug)(`Generating cache key for ${e} from file names: ${i}`);return`${a}${e}-${n}`}createCacheKeyFromFileContents(e,t){return s(this,void 0,void 0,function*(){const a=(0,m.getCacheKeyPrefix)();const i=yield d.hashFiles(t);(0,m.cacheDebug)(`Generating cache key for ${e} from files matching: ${t}`);return`${a}${e}-${i}`})}awaitForDebugging(e){return s(this,void 0,void 0,function*(){if((0,m.isCacheDebuggingEnabled)()){yield e}return e})}loadExtractedCacheEntries(){const e=this.getCacheMetadataFile();if(!l.default.existsSync(e)){return[]}const t=l.defaulLine truncated
|
||||
//# sourceMappingURL=index.js.map
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["/webpack/bootstrap","../src/cache-extract-entries.ts","../node_modules/@actions/io/lib/io.js","../node_modules/@actions/exec/lib/toolrunner.js","../node_modules/wrappy/wrappy.js","../node_modules/@actions/cache/lib/internal/cacheUtils.js","../external \"tls\"","../(webpack)/ncc/@@notfound.js","../node_modules/xmlbuilder/lib/XMLDTDNotation.js","../node_modules/@opentelemetry/api/build/src/api/propagation.js","../node_modules/@azure/core-http/node_modules/uuid/dist/nil.js","../node_modules/once/once.js","../node_modules/xmlbuilder/lib/DocumentPosition.js","../node_modules/node-fetch/node_modules/whatwg-url/lib/public-api.js","../node_modules/@azure/core-asynciterator-polyfill/dist-esm/index.js","../node_modules/@actions/core/lib/utils.js","../node_modules/uuid/v1.js","../external \"os\"","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/permuteDomain.js","../node_modules/@azure/core-http/node_modules/uuid/dist/v5.js","../node_modules/asynckit/serial.js","../node_modules/minimatch/minimatch.js","../node_modules/@opentelemetry/api/build/src/trace/link.js","../node_modules/@actions/cache/node_modules/@actions/glob/lib/internal-pattern-helper.js","../src/cache-base.ts","../node_modules/@actions/core/lib/file-command.js","../node_modules/@azure/core-http/node_modules/uuid/dist/version.js","../node_modules/@azure/abort-controller/dist/index.js","../node_modules/@opentelemetry/api/build/src/baggage/utils.js","../node_modules/@actions/cache/lib/internal/cacheHttpClient.js","../node_modules/@opentelemetry/api/build/src/api/diag.js","../node_modules/@actions/github/lib/internal/utils.js","../external \"child_process\"","../node_modules/@opentelemetry/api/build/src/context/context.js","../node_modules/uuid/lib/rng.js","../node_modules/tunnel/lib/tunnel.js","../node_modules/@opentelemetry/api/build/src/platform/node/globalThis.js","../node_modules/universalify/index.js","../node_modules/node-fetch/node_modules/webidl-conversions/lib/index.js","../node_modules/@opentelemetry/api/build/src/trace/NoopTracer.js","../node_modules/delayed-stream/lib/delayed_stream.js","../node_modules/asynckit/lib/iterate.js","../node_modules/@opentelemetry/api/build/src/common/Time.js","../node_modules/@opentelemetry/api/build/src/trace/NoopTracerProvider.js","../node_modules/@azure/core-http/node_modules/uuid/dist/v1.js","../node_modules/@azure/core-http/node_modules/uuid/dist/parse.js","../node_modules/@opentelemetry/api/build/src/trace/trace_state.js","../node_modules/xml2js/lib/bom.js","../external \"https\"","../external \"timers\"","../node_modules/@opentelemetry/api/build/src/trace/SpanOptions.js","../node_modules/@actions/http-client/auth.js","../node_modules/@azure/core-auth/dist/index.js","../node_modules/@opentelemetry/api/build/src/diag/consoleLogger.js","../node_modules/@azure/core-http/node_modules/uuid/dist/regex.js","../node_modules/@azure/core-http/node_modules/uuid/dist/v35.js","../node_modules/@azure/core-http/node_modules/uuid/dist/md5.js","../node_modules/@actions/cache/lib/internal/downloadUtils.js","../node_modules/node-fetch/node_modules/whatwg-url/lib/URL-impl.js","../node_modules/xmlbuilder/lib/XMLNode.js","../node_modules/@actions/github/lib/context.js","../node_modules/@azure/core-tracing/dist/index.js","../src/cache-reporting.ts","../node_modules/xmlbuilder/lib/XMLNodeList.js","../node_modules/semver/semver.js","../node_modules/@actions/glob/lib/glob.js","../node_modules/@actions/cache/node_modules/@actions/glob/lib/internal-glob-options-helper.js","../node_modules/@opentelemetry/api/build/src/common/Exception.js","../external \"buffer\"","../node_modules/@octokit/plugin-paginate-rest/dist-node/index.js","../node_modules/@actions/glob/lib/internal-globber.js","../node_modules/@azure/core-http/node_modules/uuid/dist/v3.js","../node_modules/@actions/cache/node_modules/@actions/glob/lib/glob.js","../external \"string_decoder\"","../node_modules/brace-expansion/index.js","../node_modules/xmlbuilder/lib/index.js","../node_modules/@actions/glob/lib/internal-match-kind.js","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/memstore.js","../node_modules/asynckit/index.js","../src/caches.ts","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/store.js","../node_modules/@opentelemetry/api/build/src/trace/SamplingResult.js","../node_modules/xmlbuilder/lib/XMLStringWriter.js","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/pathMatch.js","../node_modules/xml2js/lib/processors.js","../node_modules/is-plain-object/dist/is-plain-object.js","../external \"assert\"","../node_modules/@opentelemetry/api/build/src/diag/ComponentLogger.js","../node_modules/before-after-hook/lib/register.js","../node_modules/@azure/storage-blob/dist/index.js","../node_modules/@actions/glob/lib/internal-path.js","../node_modules/@actions/cache/node_modules/@actions/glob/lib/internal-search-state.js","../node_modules/@octokit/endpoint/dist-node/index.js","../node_modules/@azuLine truncated
|
||||
{"version":3,"sources":["/webpack/bootstrap","../src/cache-extract-entries.ts","../node_modules/@actions/io/lib/io.js","../node_modules/@actions/exec/lib/toolrunner.js","../node_modules/wrappy/wrappy.js","../node_modules/@actions/cache/lib/internal/cacheUtils.js","../external \"tls\"","../(webpack)/ncc/@@notfound.js","../node_modules/xmlbuilder/lib/XMLDTDNotation.js","../node_modules/@opentelemetry/api/build/src/api/propagation.js","../node_modules/@azure/core-http/node_modules/uuid/dist/nil.js","../node_modules/once/once.js","../node_modules/xmlbuilder/lib/DocumentPosition.js","../node_modules/node-fetch/node_modules/whatwg-url/lib/public-api.js","../node_modules/@azure/core-asynciterator-polyfill/dist-esm/index.js","../node_modules/@actions/core/lib/utils.js","../node_modules/uuid/v1.js","../external \"os\"","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/permuteDomain.js","../node_modules/@azure/core-http/node_modules/uuid/dist/v5.js","../node_modules/asynckit/serial.js","../node_modules/minimatch/minimatch.js","../node_modules/@opentelemetry/api/build/src/trace/link.js","../node_modules/@actions/cache/node_modules/@actions/glob/lib/internal-pattern-helper.js","../src/cache-base.ts","../node_modules/@actions/core/lib/file-command.js","../node_modules/@azure/core-http/node_modules/uuid/dist/version.js","../node_modules/@azure/abort-controller/dist/index.js","../node_modules/@opentelemetry/api/build/src/baggage/utils.js","../node_modules/@actions/cache/lib/internal/cacheHttpClient.js","../node_modules/@opentelemetry/api/build/src/api/diag.js","../node_modules/@actions/github/lib/internal/utils.js","../external \"child_process\"","../node_modules/@opentelemetry/api/build/src/context/context.js","../node_modules/uuid/lib/rng.js","../node_modules/tunnel/lib/tunnel.js","../node_modules/@opentelemetry/api/build/src/platform/node/globalThis.js","../node_modules/universalify/index.js","../node_modules/node-fetch/node_modules/webidl-conversions/lib/index.js","../node_modules/@opentelemetry/api/build/src/trace/NoopTracer.js","../node_modules/delayed-stream/lib/delayed_stream.js","../node_modules/asynckit/lib/iterate.js","../node_modules/@opentelemetry/api/build/src/common/Time.js","../node_modules/@opentelemetry/api/build/src/trace/NoopTracerProvider.js","../node_modules/@azure/core-http/node_modules/uuid/dist/v1.js","../node_modules/@azure/core-http/node_modules/uuid/dist/parse.js","../node_modules/@opentelemetry/api/build/src/trace/trace_state.js","../node_modules/xml2js/lib/bom.js","../external \"https\"","../external \"timers\"","../node_modules/@opentelemetry/api/build/src/trace/SpanOptions.js","../node_modules/@actions/http-client/auth.js","../node_modules/@azure/core-auth/dist/index.js","../node_modules/@opentelemetry/api/build/src/diag/consoleLogger.js","../node_modules/@azure/core-http/node_modules/uuid/dist/regex.js","../node_modules/@azure/core-http/node_modules/uuid/dist/v35.js","../node_modules/@azure/core-http/node_modules/uuid/dist/md5.js","../node_modules/@actions/cache/lib/internal/downloadUtils.js","../node_modules/node-fetch/node_modules/whatwg-url/lib/URL-impl.js","../node_modules/xmlbuilder/lib/XMLNode.js","../node_modules/@actions/github/lib/context.js","../node_modules/@azure/core-tracing/dist/index.js","../src/cache-reporting.ts","../node_modules/xmlbuilder/lib/XMLNodeList.js","../node_modules/semver/semver.js","../node_modules/@actions/glob/lib/glob.js","../node_modules/@actions/cache/node_modules/@actions/glob/lib/internal-glob-options-helper.js","../node_modules/@opentelemetry/api/build/src/common/Exception.js","../external \"buffer\"","../node_modules/@octokit/plugin-paginate-rest/dist-node/index.js","../node_modules/@actions/glob/lib/internal-globber.js","../node_modules/@azure/core-http/node_modules/uuid/dist/v3.js","../node_modules/@actions/cache/node_modules/@actions/glob/lib/glob.js","../external \"string_decoder\"","../node_modules/brace-expansion/index.js","../node_modules/xmlbuilder/lib/index.js","../node_modules/@actions/glob/lib/internal-match-kind.js","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/memstore.js","../node_modules/asynckit/index.js","../src/caches.ts","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/store.js","../node_modules/@opentelemetry/api/build/src/trace/SamplingResult.js","../node_modules/xmlbuilder/lib/XMLStringWriter.js","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/pathMatch.js","../node_modules/xml2js/lib/processors.js","../node_modules/is-plain-object/dist/is-plain-object.js","../external \"assert\"","../node_modules/@opentelemetry/api/build/src/diag/ComponentLogger.js","../node_modules/before-after-hook/lib/register.js","../node_modules/@azure/storage-blob/dist/index.js","../node_modules/@actions/glob/lib/internal-path.js","../node_modules/@actions/cache/node_modules/@actions/glob/lib/internal-search-state.js","../node_modules/@octokit/endpoint/dist-node/index.js","../node_modules/@azuLine truncated
|
||||
+23
-26
@@ -15,12 +15,14 @@ import {
|
||||
} from './cache-utils'
|
||||
import {ConfigurationCacheEntryExtractor, GradleHomeEntryExtractor} from './cache-extract-entries'
|
||||
|
||||
const CACHE_PROTOCOL_VERSION = 'v5-'
|
||||
const CACHE_PROTOCOL_VERSION = 'v6-'
|
||||
const RESTORED_CACHE_KEY_KEY = 'restored-cache-key'
|
||||
|
||||
export const META_FILE_DIR = '.gradle-build-action'
|
||||
export const PROJECT_ROOTS_FILE = 'project-roots.txt'
|
||||
const INCLUDE_PATHS_PARAMETER = 'gradle-home-cache-includes'
|
||||
const EXCLUDE_PATHS_PARAMETER = 'gradle-home-cache-excludes'
|
||||
const STRICT_CACHE_MATCH_PARAMETER = 'gradle-home-cache-strict-match'
|
||||
|
||||
/**
|
||||
* Represents a key used to restore a cache entry.
|
||||
@@ -70,14 +72,16 @@ function generateCacheKey(cacheName: string): CacheKey {
|
||||
// Exact match on Git SHA
|
||||
const cacheKey = `${cacheKeyForJobContext}-${github.context.sha}`
|
||||
|
||||
if (core.getBooleanInput(STRICT_CACHE_MATCH_PARAMETER)) {
|
||||
return new CacheKey(cacheKey, [cacheKeyForJobContext])
|
||||
}
|
||||
|
||||
return new CacheKey(cacheKey, [cacheKeyForJobContext, cacheKeyForJob, cacheKeyForOs])
|
||||
}
|
||||
|
||||
export class GradleStateCache {
|
||||
private cacheName: string
|
||||
private cacheDescription: string
|
||||
private cacheKeyStateKey: string
|
||||
private cacheResultStateKey: string
|
||||
|
||||
protected readonly gradleUserHome: string
|
||||
|
||||
@@ -85,8 +89,6 @@ export class GradleStateCache {
|
||||
this.gradleUserHome = gradleUserHome
|
||||
this.cacheName = 'gradle'
|
||||
this.cacheDescription = 'Gradle User Home'
|
||||
this.cacheKeyStateKey = `CACHE_KEY_gradle`
|
||||
this.cacheResultStateKey = `CACHE_RESULT_gradle`
|
||||
}
|
||||
|
||||
init(): void {
|
||||
@@ -117,7 +119,6 @@ export class GradleStateCache {
|
||||
const entryListener = listener.entry(this.cacheDescription)
|
||||
|
||||
const cacheKey = generateCacheKey(this.cacheName)
|
||||
core.saveState(this.cacheKeyStateKey, cacheKey.key)
|
||||
|
||||
cacheDebug(
|
||||
`Requesting ${this.cacheDescription} with
|
||||
@@ -125,16 +126,13 @@ export class GradleStateCache {
|
||||
restoreKeys:[${cacheKey.restoreKeys}]`
|
||||
)
|
||||
|
||||
const cacheResult = await restoreCache(this.getCachePath(), cacheKey.key, cacheKey.restoreKeys)
|
||||
entryListener.markRequested(cacheKey.key, cacheKey.restoreKeys)
|
||||
|
||||
const cacheResult = await restoreCache(this.getCachePath(), cacheKey.key, cacheKey.restoreKeys, entryListener)
|
||||
if (!cacheResult) {
|
||||
core.info(`${this.cacheDescription} cache not found. Will initialize empty.`)
|
||||
return
|
||||
}
|
||||
|
||||
core.saveState(this.cacheResultStateKey, cacheResult.key)
|
||||
entryListener.markRestored(cacheResult.key, cacheResult.size)
|
||||
core.saveState(RESTORED_CACHE_KEY_KEY, cacheResult.key)
|
||||
|
||||
core.info(`Restored ${this.cacheDescription} from cache key: ${cacheResult.key}`)
|
||||
|
||||
@@ -163,12 +161,11 @@ export class GradleStateCache {
|
||||
* it is saved with the exact key.
|
||||
*/
|
||||
async save(listener: CacheListener): Promise<void> {
|
||||
// Retrieve the state set in the previous 'restore' step.
|
||||
const cacheKeyFromRestore = core.getState(this.cacheKeyStateKey)
|
||||
const cacheResultFromRestore = core.getState(this.cacheResultStateKey)
|
||||
const cacheKey = generateCacheKey(this.cacheName).key
|
||||
const restoredCacheKey = core.getState(RESTORED_CACHE_KEY_KEY)
|
||||
|
||||
if (cacheResultFromRestore && cacheKeyFromRestore === cacheResultFromRestore) {
|
||||
core.info(`Cache hit occurred on the cache key ${cacheKeyFromRestore}, not saving cache.`)
|
||||
if (restoredCacheKey && cacheKey === restoredCacheKey) {
|
||||
core.info(`Cache hit occurred on the cache key ${cacheKey}, not saving cache.`)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -179,13 +176,10 @@ export class GradleStateCache {
|
||||
return
|
||||
}
|
||||
|
||||
core.info(`Caching ${this.cacheDescription} with cache key: ${cacheKeyFromRestore}`)
|
||||
core.info(`Caching ${this.cacheDescription} with cache key: ${cacheKey}`)
|
||||
const cachePath = this.getCachePath()
|
||||
const savedEntry = await saveCache(cachePath, cacheKeyFromRestore)
|
||||
|
||||
if (savedEntry) {
|
||||
listener.entry(this.cacheDescription).markSaved(savedEntry.key, savedEntry.size)
|
||||
}
|
||||
const entryListener = listener.entry(this.cacheDescription)
|
||||
await saveCache(cachePath, cacheKey, entryListener)
|
||||
|
||||
return
|
||||
}
|
||||
@@ -272,11 +266,11 @@ if (isTopLevelBuild) {
|
||||
|
||||
def registerCallbacks(buildScanExtension, rootProjectName) {
|
||||
buildScanExtension.with {
|
||||
def buildOutcome = ""
|
||||
def scanFile = new File("gradle-build-scan.txt")
|
||||
def buildFailed = false
|
||||
|
||||
buildFinished { result ->
|
||||
buildOutcome = result.failure == null ? " succeeded" : " failed"
|
||||
buildFailed = (result.failure != null)
|
||||
}
|
||||
|
||||
buildScanPublished { buildScan ->
|
||||
@@ -284,8 +278,11 @@ def registerCallbacks(buildScanExtension, rootProjectName) {
|
||||
|
||||
// Send commands directly to GitHub Actions via STDOUT.
|
||||
def gradleCommand = rootProjectName + " " + gradle.startParameter.taskNames.join(" ")
|
||||
def message = "Gradle build '\${gradleCommand}'\${buildOutcome} - \${buildScan.buildScanUri}"
|
||||
println("::notice ::\${message}")
|
||||
if (buildFailed) {
|
||||
println("::warning ::Gradle build '\${gradleCommand}' FAILED - \${buildScan.buildScanUri}")
|
||||
} else {
|
||||
println("::notice ::Gradle build '\${gradleCommand}' - \${buildScan.buildScanUri}")
|
||||
}
|
||||
println("::set-output name=build-scan-url::\${buildScan.buildScanUri}")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,12 +118,9 @@ abstract class AbstractEntryExtractor {
|
||||
pattern: string,
|
||||
listener: CacheEntryListener
|
||||
): Promise<ExtractedCacheEntry> {
|
||||
listener.markRequested(cacheKey)
|
||||
|
||||
const restoredEntry = await restoreCache([pattern], cacheKey)
|
||||
const restoredEntry = await restoreCache([pattern], cacheKey, [], listener)
|
||||
if (restoredEntry) {
|
||||
core.info(`Restored ${artifactType} with key ${cacheKey} to ${pattern}`)
|
||||
listener.markRestored(restoredEntry.key, restoredEntry.size)
|
||||
return new ExtractedCacheEntry(artifactType, pattern, cacheKey)
|
||||
} else {
|
||||
core.info(`Did not restore ${artifactType} with key ${cacheKey} to ${pattern}`)
|
||||
@@ -217,10 +214,7 @@ abstract class AbstractEntryExtractor {
|
||||
cacheDebug(`No change to previously restored ${artifactType}. Not saving.`)
|
||||
} else {
|
||||
core.info(`Caching ${artifactType} with path '${pattern}' and cache key: ${cacheKey}`)
|
||||
const savedEntry = await saveCache([pattern], cacheKey)
|
||||
if (savedEntry !== undefined) {
|
||||
entryListener.markSaved(savedEntry.key, savedEntry.size)
|
||||
}
|
||||
await saveCache([pattern], cacheKey, entryListener)
|
||||
}
|
||||
|
||||
for (const file of matchingFiles) {
|
||||
|
||||
+16
-1
@@ -28,6 +28,9 @@ export class CacheListener {
|
||||
}
|
||||
|
||||
static rehydrate(stringRep: string): CacheListener {
|
||||
if (stringRep === '') {
|
||||
return new CacheListener()
|
||||
}
|
||||
const rehydrated: CacheListener = Object.assign(new CacheListener(), JSON.parse(stringRep))
|
||||
const entries = rehydrated.cacheEntries
|
||||
for (let index = 0; index < entries.length; index++) {
|
||||
@@ -76,6 +79,12 @@ export class CacheEntryListener {
|
||||
this.savedSize = size
|
||||
return this
|
||||
}
|
||||
|
||||
markAlreadyExists(key: string): CacheEntryListener {
|
||||
this.savedKey = key
|
||||
this.savedSize = 0
|
||||
return this
|
||||
}
|
||||
}
|
||||
|
||||
export function logCachingReport(listener: CacheListener): void {
|
||||
@@ -112,12 +121,18 @@ function getSum(
|
||||
cacheEntries: CacheEntryListener[],
|
||||
predicate: (value: CacheEntryListener) => number | undefined
|
||||
): string {
|
||||
if (cacheEntries.length === 0) {
|
||||
return '0'
|
||||
}
|
||||
return formatSize(cacheEntries.map(e => predicate(e) ?? 0).reduce((p, v) => p + v, 0))
|
||||
}
|
||||
|
||||
function formatSize(bytes: number | undefined): string {
|
||||
if (bytes === undefined || bytes === 0) {
|
||||
if (bytes === undefined) {
|
||||
return ''
|
||||
}
|
||||
if (bytes === 0) {
|
||||
return '0 (Entry already exists)'
|
||||
}
|
||||
return `${Math.round(bytes / (1024 * 1024))} MB (${bytes} B)`
|
||||
}
|
||||
+22
-10
@@ -4,9 +4,12 @@ import * as crypto from 'crypto'
|
||||
import * as path from 'path'
|
||||
import * as fs from 'fs'
|
||||
|
||||
import {CacheEntryListener} from './cache-reporting'
|
||||
|
||||
const JOB_CONTEXT_PARAMETER = 'workflow-job-context'
|
||||
const CACHE_DISABLED_PARAMETER = 'cache-disabled'
|
||||
const CACHE_READONLY_PARAMETER = 'cache-read-only'
|
||||
const CACHE_WRITEONLY_PARAMETER = 'cache-write-only'
|
||||
const CACHE_DEBUG_VAR = 'GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED'
|
||||
const CACHE_PREFIX_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX'
|
||||
|
||||
@@ -18,6 +21,10 @@ export function isCacheReadOnly(): boolean {
|
||||
return core.getBooleanInput(CACHE_READONLY_PARAMETER)
|
||||
}
|
||||
|
||||
export function isCacheWriteOnly(): boolean {
|
||||
return core.getBooleanInput(CACHE_WRITEONLY_PARAMETER)
|
||||
}
|
||||
|
||||
export function isCacheDebuggingEnabled(): boolean {
|
||||
return process.env[CACHE_DEBUG_VAR] ? true : false
|
||||
}
|
||||
@@ -49,23 +56,32 @@ export function hashStrings(values: string[]): string {
|
||||
export async function restoreCache(
|
||||
cachePath: string[],
|
||||
cacheKey: string,
|
||||
cacheRestoreKeys: string[] = []
|
||||
cacheRestoreKeys: string[],
|
||||
listener: CacheEntryListener
|
||||
): Promise<cache.CacheEntry | undefined> {
|
||||
listener.markRequested(cacheKey, cacheRestoreKeys)
|
||||
try {
|
||||
return await cache.restoreCache(cachePath, cacheKey, cacheRestoreKeys)
|
||||
const restoredEntry = await cache.restoreCache(cachePath, cacheKey, cacheRestoreKeys)
|
||||
if (restoredEntry !== undefined) {
|
||||
listener.markRestored(restoredEntry.key, restoredEntry.size)
|
||||
}
|
||||
return restoredEntry
|
||||
} catch (error) {
|
||||
handleCacheFailure(error, `Failed to restore ${cacheKey}`)
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
export async function saveCache(cachePath: string[], cacheKey: string): Promise<cache.CacheEntry | undefined> {
|
||||
export async function saveCache(cachePath: string[], cacheKey: string, listener: CacheEntryListener): Promise<void> {
|
||||
try {
|
||||
return await cache.saveCache(cachePath, cacheKey)
|
||||
const savedEntry = await cache.saveCache(cachePath, cacheKey)
|
||||
listener.markSaved(savedEntry.key, savedEntry.size)
|
||||
} catch (error) {
|
||||
if (error instanceof cache.ReserveCacheError) {
|
||||
listener.markAlreadyExists(cacheKey)
|
||||
}
|
||||
handleCacheFailure(error, `Failed to save cache entry ${cacheKey}`)
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
export function cacheDebug(message: string): void {
|
||||
@@ -83,11 +99,7 @@ export function handleCacheFailure(error: unknown, message: string): void {
|
||||
}
|
||||
if (error instanceof cache.ReserveCacheError) {
|
||||
// Reserve cache errors are expected if the artifact has been previously cached
|
||||
if (isCacheDebuggingEnabled()) {
|
||||
core.info(`${message}: ${error}`)
|
||||
} else {
|
||||
core.debug(`${message}: ${error}`)
|
||||
}
|
||||
core.info(`${message}: ${error}`)
|
||||
} else {
|
||||
// Warn on all other errors
|
||||
core.warning(`${message}: ${error}`)
|
||||
|
||||
+10
-6
@@ -1,5 +1,5 @@
|
||||
import * as core from '@actions/core'
|
||||
import {isCacheDisabled, isCacheReadOnly} from './cache-utils'
|
||||
import {isCacheDisabled, isCacheReadOnly, isCacheWriteOnly} from './cache-utils'
|
||||
import {logCachingReport, CacheListener} from './cache-reporting'
|
||||
import {GradleStateCache} from './cache-base'
|
||||
|
||||
@@ -32,18 +32,22 @@ export async function restore(gradleUserHome: string): Promise<void> {
|
||||
}
|
||||
|
||||
gradleStateCache.init()
|
||||
// Mark the state as restored so that post-action will perform save.
|
||||
core.saveState(CACHE_RESTORED_VAR, true)
|
||||
// Save the Gradle User Home for the post-action step.
|
||||
core.saveState(GRADLE_USER_HOME, gradleUserHome)
|
||||
|
||||
if (isCacheWriteOnly()) {
|
||||
core.info('Cache is write-only: will not restore from cache.')
|
||||
return
|
||||
}
|
||||
|
||||
await core.group('Restore Gradle state from cache', async () => {
|
||||
core.saveState(GRADLE_USER_HOME, gradleUserHome)
|
||||
|
||||
const cacheListener = new CacheListener()
|
||||
await gradleStateCache.restore(cacheListener)
|
||||
|
||||
core.saveState(CACHE_LISTENER, cacheListener.stringify())
|
||||
})
|
||||
|
||||
// Export state that is detected in corresponding post-action step
|
||||
core.saveState(CACHE_RESTORED_VAR, true)
|
||||
}
|
||||
|
||||
export async function save(): Promise<void> {
|
||||
|
||||
Reference in new issue
Block a user