jaxxstorm / action-install-gh-release

GitHub Action to install the Github Release binaries
Apache License 2.0
75 stars 32 forks source link

Fix errors from concurrent builds with cache: enable #24

Closed t0yv0 closed 2 years ago

t0yv0 commented 2 years ago

When test-driving cache: enable at scale, https://github.com/pulumi/pulumi/pull/9628 - it seems to work and result in cache hits, but sometimes there is a race with an exception on a cache miss:

Error: Unable to reserve cache with key action-install-gh-release/pulumi/pulumictl/v0.0.31/linux-x64, another job may be creating this cache. More details: Cache already exists. Scope: refs/pull/9628/merge, Key: action-install-gh-release/pulumi/pulumictl/v0.0.31/linux-x64, Version: b7e495078f01e0ba3aac532b3e4b5eb2809dcb6b5752b5d432363c38c69bce7a

I'm borrowing some error-handling code here found in actions/cache repo https://github.com/actions/cache/blob/d55d005ab0cbd9310b447311bcd1661be90843f5/src/save.ts#L47

It should be OK to downgrade this to a warning; in the case of a race, the first-write-wins is fine. The key of the cache uniquely determines the binary version.