mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-11-24 17:21:04 -05:00
Remove commas from workflow name
Commas are explicitly disallowed in cache keys, so remove any from workflow name when generating cache key.
This commit is contained in:
parent
6c3f1eadfe
commit
626d937994
8 changed files with 36 additions and 10 deletions
9
dist/dependency-graph-generate/index.js
vendored
9
dist/dependency-graph-generate/index.js
vendored
|
@ -71597,7 +71597,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.tryDelete = exports.handleCacheFailure = exports.cacheDebug = exports.saveCache = exports.restoreCache = exports.hashStrings = exports.hashFileNames = exports.getCacheKeyPrefix = exports.generateCacheKey = exports.CacheKey = exports.isCacheCleanupEnabled = exports.isCacheDebuggingEnabled = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
|
exports.tryDelete = exports.handleCacheFailure = exports.cacheDebug = exports.saveCache = exports.restoreCache = exports.hashStrings = exports.hashFileNames = exports.getCacheKeyForJob = exports.getCacheKeyPrefix = exports.generateCacheKey = exports.CacheKey = exports.isCacheCleanupEnabled = exports.isCacheDebuggingEnabled = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const cache = __importStar(__nccwpck_require__(7799));
|
const cache = __importStar(__nccwpck_require__(7799));
|
||||||
const github = __importStar(__nccwpck_require__(5438));
|
const github = __importStar(__nccwpck_require__(5438));
|
||||||
|
@ -71665,8 +71665,13 @@ function getCacheKeyEnvironment() {
|
||||||
return process.env[CACHE_KEY_OS_VAR] || runnerOs;
|
return process.env[CACHE_KEY_OS_VAR] || runnerOs;
|
||||||
}
|
}
|
||||||
function getCacheKeyJob() {
|
function getCacheKeyJob() {
|
||||||
return process.env[CACHE_KEY_JOB_VAR] || `${github.context.workflow}-${github.context.job}`;
|
return process.env[CACHE_KEY_JOB_VAR] || getCacheKeyForJob(github.context.workflow, github.context.job);
|
||||||
}
|
}
|
||||||
|
function getCacheKeyForJob(workflowName, jobId) {
|
||||||
|
const sanitizedWorkflow = workflowName.replace(/,/g, '').toLowerCase();
|
||||||
|
return `${sanitizedWorkflow}-${jobId}`;
|
||||||
|
}
|
||||||
|
exports.getCacheKeyForJob = getCacheKeyForJob;
|
||||||
function getCacheKeyJobInstance() {
|
function getCacheKeyJobInstance() {
|
||||||
const override = process.env[CACHE_KEY_JOB_INSTANCE_VAR];
|
const override = process.env[CACHE_KEY_JOB_INSTANCE_VAR];
|
||||||
if (override) {
|
if (override) {
|
||||||
|
|
2
dist/dependency-graph-generate/index.js.map
vendored
2
dist/dependency-graph-generate/index.js.map
vendored
File diff suppressed because one or more lines are too long
9
dist/main/index.js
vendored
9
dist/main/index.js
vendored
|
@ -64382,7 +64382,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.tryDelete = exports.handleCacheFailure = exports.cacheDebug = exports.saveCache = exports.restoreCache = exports.hashStrings = exports.hashFileNames = exports.getCacheKeyPrefix = exports.generateCacheKey = exports.CacheKey = exports.isCacheCleanupEnabled = exports.isCacheDebuggingEnabled = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
|
exports.tryDelete = exports.handleCacheFailure = exports.cacheDebug = exports.saveCache = exports.restoreCache = exports.hashStrings = exports.hashFileNames = exports.getCacheKeyForJob = exports.getCacheKeyPrefix = exports.generateCacheKey = exports.CacheKey = exports.isCacheCleanupEnabled = exports.isCacheDebuggingEnabled = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const cache = __importStar(__nccwpck_require__(7799));
|
const cache = __importStar(__nccwpck_require__(7799));
|
||||||
const github = __importStar(__nccwpck_require__(5438));
|
const github = __importStar(__nccwpck_require__(5438));
|
||||||
|
@ -64450,8 +64450,13 @@ function getCacheKeyEnvironment() {
|
||||||
return process.env[CACHE_KEY_OS_VAR] || runnerOs;
|
return process.env[CACHE_KEY_OS_VAR] || runnerOs;
|
||||||
}
|
}
|
||||||
function getCacheKeyJob() {
|
function getCacheKeyJob() {
|
||||||
return process.env[CACHE_KEY_JOB_VAR] || `${github.context.workflow}-${github.context.job}`;
|
return process.env[CACHE_KEY_JOB_VAR] || getCacheKeyForJob(github.context.workflow, github.context.job);
|
||||||
}
|
}
|
||||||
|
function getCacheKeyForJob(workflowName, jobId) {
|
||||||
|
const sanitizedWorkflow = workflowName.replace(/,/g, '').toLowerCase();
|
||||||
|
return `${sanitizedWorkflow}-${jobId}`;
|
||||||
|
}
|
||||||
|
exports.getCacheKeyForJob = getCacheKeyForJob;
|
||||||
function getCacheKeyJobInstance() {
|
function getCacheKeyJobInstance() {
|
||||||
const override = process.env[CACHE_KEY_JOB_INSTANCE_VAR];
|
const override = process.env[CACHE_KEY_JOB_INSTANCE_VAR];
|
||||||
if (override) {
|
if (override) {
|
||||||
|
|
2
dist/main/index.js.map
vendored
2
dist/main/index.js.map
vendored
File diff suppressed because one or more lines are too long
9
dist/post/index.js
vendored
9
dist/post/index.js
vendored
|
@ -63485,7 +63485,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.tryDelete = exports.handleCacheFailure = exports.cacheDebug = exports.saveCache = exports.restoreCache = exports.hashStrings = exports.hashFileNames = exports.getCacheKeyPrefix = exports.generateCacheKey = exports.CacheKey = exports.isCacheCleanupEnabled = exports.isCacheDebuggingEnabled = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
|
exports.tryDelete = exports.handleCacheFailure = exports.cacheDebug = exports.saveCache = exports.restoreCache = exports.hashStrings = exports.hashFileNames = exports.getCacheKeyForJob = exports.getCacheKeyPrefix = exports.generateCacheKey = exports.CacheKey = exports.isCacheCleanupEnabled = exports.isCacheDebuggingEnabled = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const cache = __importStar(__nccwpck_require__(7799));
|
const cache = __importStar(__nccwpck_require__(7799));
|
||||||
const github = __importStar(__nccwpck_require__(5438));
|
const github = __importStar(__nccwpck_require__(5438));
|
||||||
|
@ -63553,8 +63553,13 @@ function getCacheKeyEnvironment() {
|
||||||
return process.env[CACHE_KEY_OS_VAR] || runnerOs;
|
return process.env[CACHE_KEY_OS_VAR] || runnerOs;
|
||||||
}
|
}
|
||||||
function getCacheKeyJob() {
|
function getCacheKeyJob() {
|
||||||
return process.env[CACHE_KEY_JOB_VAR] || `${github.context.workflow}-${github.context.job}`;
|
return process.env[CACHE_KEY_JOB_VAR] || getCacheKeyForJob(github.context.workflow, github.context.job);
|
||||||
}
|
}
|
||||||
|
function getCacheKeyForJob(workflowName, jobId) {
|
||||||
|
const sanitizedWorkflow = workflowName.replace(/,/g, '').toLowerCase();
|
||||||
|
return `${sanitizedWorkflow}-${jobId}`;
|
||||||
|
}
|
||||||
|
exports.getCacheKeyForJob = getCacheKeyForJob;
|
||||||
function getCacheKeyJobInstance() {
|
function getCacheKeyJobInstance() {
|
||||||
const override = process.env[CACHE_KEY_JOB_INSTANCE_VAR];
|
const override = process.env[CACHE_KEY_JOB_INSTANCE_VAR];
|
||||||
if (override) {
|
if (override) {
|
||||||
|
|
2
dist/post/index.js.map
vendored
2
dist/post/index.js.map
vendored
File diff suppressed because one or more lines are too long
|
@ -109,7 +109,12 @@ function getCacheKeyEnvironment(): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCacheKeyJob(): string {
|
function getCacheKeyJob(): string {
|
||||||
return process.env[CACHE_KEY_JOB_VAR] || `${github.context.workflow}-${github.context.job}`
|
return process.env[CACHE_KEY_JOB_VAR] || getCacheKeyForJob(github.context.workflow, github.context.job)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getCacheKeyForJob(workflowName: string, jobId: string): string {
|
||||||
|
const sanitizedWorkflow = workflowName.replace(/,/g, '').toLowerCase()
|
||||||
|
return `${sanitizedWorkflow}-${jobId}`
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCacheKeyJobInstance(): string {
|
function getCacheKeyJobInstance(): string {
|
||||||
|
|
|
@ -17,4 +17,10 @@ describe('cacheUtils-utils', () => {
|
||||||
expect(posixHash).toBe(windowsHash)
|
expect(posixHash).toBe(windowsHash)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
describe('sanitizes workflow name in cache key', () => {
|
||||||
|
it('with comma', () => {
|
||||||
|
const cacheKey = cacheUtils.getCacheKeyForJob("Workflow, with,commas", "JOB_ID")
|
||||||
|
expect(cacheKey).toBe('workflow withcommas-JOB_ID')
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue