Skip to content

Cache keys are treated as case-sensitive, but case is not preserved in all environments #659

Open
@BytewaveMLP

Description

@BytewaveMLP

Ensure the following before filing this issue

  • I verified it reproduces with the latest version with - uses: ruby/setup-ruby@v1 (see Versioning policy)

  • I tried to reproduce the issue locally by following the workflow steps (including all commands done by ruby/setup-ruby, except for Downloading Ruby & Extracting Ruby),
    and it did not reproduce locally (if it does reproduce locally, it's not a ruby/setup-ruby issue)

Are you running on a GitHub-hosted runner or a self-hosted runner?

self-hosted runner

Link to the failed workflow job (must be a public workflow job, so the necessary information is available)

https://gist.github.com/BytewaveMLP/d747b0378456c975d5ad122740a7ae1c

Any other notes?

The attached log is a Gist as the workflow run is in a private repo, however the bug is illustrated regardless.

I'd like to preface this by saying this isn't a bug when running on GitHub Actions, but rather on the popular act runner. So by some measure, this bug should also be reported there as well. However, GitHub Actions caching infrastructure does seem to recognize keys of differing case as being identical, so I think there's a case for it being fixed here.

I'm working on setting up a CI runner on an install of Gitea, using their act_runner fork of act designed to emulate GitHub Actions. However, I seem to be running into issues where setup-ruby is finding and restoring from a matching cache key successfully, but still creating and uploading a new cache artifact every run (see the attached log). If my debugging is correct, this comes down to the fact that the returned cache key name from cache.restoreCache (captured here) does not reflect the same case as it was created with. This seems to in turn be due to a conscious choice within act to normalize cache keys to lowercase prior to storing and looking up. This deviates from the GitHub Actions behavior, which seems to be to perform lookups case-insensitively, but return input as-is.

As best as I can tell, due to the semantics of GitHub Actions' cache keys, it should be safe to normalize them to lowercase, both upon receiving them from cache.restoreCache and before populating the cache with cache.saveCache. This should not affect existing usages of setup-ruby, and should allow for the cache to function properly on Gitea act_runner instances without requiring significant changes to the latter.

Also reported to act: nektos/act#2497

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions