Merge pull request #90 from gradle/dd/windows-locks
Some checks failed
Test caching / seed-build (macos-latest) (push) Waiting to run
Test caching / seed-build (ubuntu-latest) (push) Waiting to run
Test caching / seed-build (windows-latest) (push) Waiting to run
Test caching / dependencies-cache (macos-latest) (push) Blocked by required conditions
Test caching / dependencies-cache (ubuntu-latest) (push) Blocked by required conditions
Test caching / dependencies-cache (windows-latest) (push) Blocked by required conditions
Test caching / build-cache (macos-latest) (push) Blocked by required conditions
Test caching / build-cache (ubuntu-latest) (push) Blocked by required conditions
Test caching / build-cache (windows-latest) (push) Blocked by required conditions
Test caching / configuration-cache (macos-latest) (push) Blocked by required conditions
Test caching / configuration-cache (ubuntu-latest) (push) Blocked by required conditions
Test caching / configuration-cache (windows-latest) (push) Blocked by required conditions
Test Gradle execution / gradle-execution (macos-latest) (push) Waiting to run
Test Gradle execution / gradle-execution (ubuntu-latest) (push) Waiting to run
Test Gradle execution / gradle-execution (windows-latest, .bat) (push) Waiting to run
Test Gradle execution / gradle-versions (macos-latest) (push) Waiting to run
Test Gradle execution / gradle-versions (ubuntu-latest) (push) Waiting to run
Test Gradle execution / gradle-versions (windows-latest, .bat) (push) Waiting to run
Test caching with a custom GRADLE_USER_HOME / seed-build (push) Waiting to run
Test caching with a custom GRADLE_USER_HOME / dependencies-cache (push) Blocked by required conditions
Test caching with a custom GRADLE_USER_HOME / build-cache (push) Blocked by required conditions
Test caching with Kotlin DSL / seed-build (push) Waiting to run
Test caching with Kotlin DSL / verify-build (push) Blocked by required conditions
Verify generated outputs / check (push) Has been cancelled
Some checks failed
Test caching / seed-build (macos-latest) (push) Waiting to run
Test caching / seed-build (ubuntu-latest) (push) Waiting to run
Test caching / seed-build (windows-latest) (push) Waiting to run
Test caching / dependencies-cache (macos-latest) (push) Blocked by required conditions
Test caching / dependencies-cache (ubuntu-latest) (push) Blocked by required conditions
Test caching / dependencies-cache (windows-latest) (push) Blocked by required conditions
Test caching / build-cache (macos-latest) (push) Blocked by required conditions
Test caching / build-cache (ubuntu-latest) (push) Blocked by required conditions
Test caching / build-cache (windows-latest) (push) Blocked by required conditions
Test caching / configuration-cache (macos-latest) (push) Blocked by required conditions
Test caching / configuration-cache (ubuntu-latest) (push) Blocked by required conditions
Test caching / configuration-cache (windows-latest) (push) Blocked by required conditions
Test Gradle execution / gradle-execution (macos-latest) (push) Waiting to run
Test Gradle execution / gradle-execution (ubuntu-latest) (push) Waiting to run
Test Gradle execution / gradle-execution (windows-latest, .bat) (push) Waiting to run
Test Gradle execution / gradle-versions (macos-latest) (push) Waiting to run
Test Gradle execution / gradle-versions (ubuntu-latest) (push) Waiting to run
Test Gradle execution / gradle-versions (windows-latest, .bat) (push) Waiting to run
Test caching with a custom GRADLE_USER_HOME / seed-build (push) Waiting to run
Test caching with a custom GRADLE_USER_HOME / dependencies-cache (push) Blocked by required conditions
Test caching with a custom GRADLE_USER_HOME / build-cache (push) Blocked by required conditions
Test caching with Kotlin DSL / seed-build (push) Waiting to run
Test caching with Kotlin DSL / verify-build (push) Blocked by required conditions
Verify generated outputs / check (push) Has been cancelled
Allow time for processes to delete file locks on windows
This commit is contained in:
commit
29894757f3
2
dist/main/index.js
vendored
2
dist/main/index.js
vendored
File diff suppressed because one or more lines are too long
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
2
dist/post/index.js
vendored
2
dist/post/index.js
vendored
File diff suppressed because one or more lines are too long
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
@ -5,7 +5,7 @@ import * as core from '@actions/core'
|
||||
import * as glob from '@actions/glob'
|
||||
import * as exec from '@actions/exec'
|
||||
|
||||
import {AbstractCache, hashFileNames} from './cache-utils'
|
||||
import {AbstractCache, hashFileNames, tryDelete} from './cache-utils'
|
||||
|
||||
// Which paths under Gradle User Home should be cached
|
||||
const CACHE_PATH = ['caches', 'notifications']
|
||||
@ -141,7 +141,7 @@ export class GradleUserHomeCache extends AbstractCache {
|
||||
if (commonArtifactFiles.length === 0) {
|
||||
this.debug(`No files found to cache for ${bundle}`)
|
||||
if (fs.existsSync(cacheMetaFile)) {
|
||||
fs.unlinkSync(cacheMetaFile)
|
||||
tryDelete(cacheMetaFile)
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -164,7 +164,7 @@ export class GradleUserHomeCache extends AbstractCache {
|
||||
}
|
||||
|
||||
for (const file of commonArtifactFiles) {
|
||||
fs.unlinkSync(file)
|
||||
tryDelete(file)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ import * as cache from '@actions/cache'
|
||||
import * as github from '@actions/github'
|
||||
import * as crypto from 'crypto'
|
||||
import * as path from 'path'
|
||||
import * as fs from 'fs'
|
||||
|
||||
export function isCacheDisabled(): boolean {
|
||||
return core.getBooleanInput('cache-disabled')
|
||||
@ -60,6 +61,29 @@ export function hashFileNames(fileNames: string[]): string {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to delete a file, waiting to allow locks to be released
|
||||
*/
|
||||
export async function tryDelete(file: string): Promise<void> {
|
||||
for (let count = 0; count < 3; count++) {
|
||||
try {
|
||||
fs.unlinkSync(file)
|
||||
return
|
||||
} catch (error) {
|
||||
if (count === 2) {
|
||||
throw error
|
||||
} else {
|
||||
core.warning(String(error))
|
||||
await delay(1000)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function delay(ms: number): Promise<void> {
|
||||
return new Promise(resolve => setTimeout(resolve, ms))
|
||||
}
|
||||
|
||||
class CacheKey {
|
||||
key: string
|
||||
restoreKeys: string[]
|
||||
|
Loading…
x
Reference in New Issue
Block a user