mirror of
https://github.com/gradle/actions.git
synced 2025-12-08 17:15:46 +08:00
Cache validated checksums for later executions
The most common case for validation will be that the wrapper jars are unchanged from a previous workflow run. In this case, we cache the validated wrapper checksums to minimise the work required on a subsequent run. Fixes #172
This commit is contained in:
@@ -8,6 +8,7 @@ export async function findInvalidWrapperJars(
|
||||
minWrapperCount: number,
|
||||
allowSnapshots: boolean,
|
||||
allowedChecksums: string[],
|
||||
previouslyValidatedChecksums: string[] = [],
|
||||
knownValidChecksums: checksums.WrapperChecksums = checksums.KNOWN_CHECKSUMS
|
||||
): Promise<ValidationResult> {
|
||||
const wrapperJars = await find.findWrapperJars(gitRepoRoot)
|
||||
@@ -21,7 +22,11 @@ export async function findInvalidWrapperJars(
|
||||
const notYetValidatedWrappers = []
|
||||
for (const wrapperJar of wrapperJars) {
|
||||
const sha = await hash.sha256File(resolve(gitRepoRoot, wrapperJar))
|
||||
if (allowedChecksums.includes(sha) || knownValidChecksums.checksums.has(sha)) {
|
||||
if (
|
||||
allowedChecksums.includes(sha) ||
|
||||
previouslyValidatedChecksums.includes(sha) ||
|
||||
knownValidChecksums.checksums.has(sha)
|
||||
) {
|
||||
result.valid.push(new WrapperJar(wrapperJar, sha))
|
||||
} else {
|
||||
notYetValidatedWrappers.push(new WrapperJar(wrapperJar, sha))
|
||||
|
||||
Reference in New Issue
Block a user