mirror of
https://github.com/gradle/actions.git
synced 2026-04-19 18:12:58 +08:00
Add GRADLE_ACTIONS_CACHE_USE_VENDORED env var for test configuration
Add env var that forces the vendored caching module when set to 'true', decoupling module selection from the Develocity access key. Set it centrally in init-integ-test so all tests use the vendored module by default. Add a dedicated legacy caching integration test that overrides the env var to 'false' to verify the legacy module works correctly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -59,7 +59,7 @@ export async function getCacheService(cacheConfig: CacheConfig): Promise<CacheSe
|
||||
return new NoOpCacheService()
|
||||
}
|
||||
|
||||
if (cacheConfig.isCacheLicenseAccepted()) {
|
||||
if (useVendoredCacheModule() || cacheConfig.isCacheLicenseAccepted()) {
|
||||
const vendoredService = await loadVendoredCacheService()
|
||||
return new LoggingCacheService(vendoredService, VENDORED_CACHE_LOG_MESSAGE, VENDORED_CACHE_REPORT_NOTICE)
|
||||
}
|
||||
@@ -68,6 +68,10 @@ export async function getCacheService(cacheConfig: CacheConfig): Promise<CacheSe
|
||||
return new LoggingCacheService(legacyService, LEGACY_CACHE_LOG_MESSAGE, LEGACY_CACHE_REPORT_NOTICE)
|
||||
}
|
||||
|
||||
function useVendoredCacheModule(): boolean {
|
||||
return process.env['GRADLE_ACTIONS_CACHE_USE_VENDORED'] === 'true'
|
||||
}
|
||||
|
||||
export async function loadVendoredCacheService(): Promise<CacheService> {
|
||||
const vendoredLibraryPath = findLibraryPath('sources/vendor/gradle-actions-caching/index.js')
|
||||
const moduleUrl = pathToFileURL(vendoredLibraryPath).href
|
||||
|
||||
Reference in New Issue
Block a user