-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
setup-ocaml@v3: uses cache from wrong runner OS! #839
Comments
I think this is a regression caused by 9dc6d97.
Although the information still seems to be there in the hash (it is just now harder to debug because we can't see what goes into the hash), maybe the runner OS version was missing all along? |
This is a bug in setup-ocaml@v3 ocaml/setup-ocaml#839 Work it around by defining our own cache prefix key as suggested in EXAMPLES.md Signed-off-by: Edwin Török <edwin.torok@cloud.com>
FWIW using |
This is a bug in setup-ocaml@v3 ocaml/setup-ocaml#839 Work it around by defining our own cache prefix key as suggested in EXAMPLES.md Signed-off-by: Edwin Török <edwin.torok@cloud.com>
This is a bug in setup-ocaml@v3 ocaml/setup-ocaml#839 Work it around by defining our own cache prefix key as suggested in EXAMPLES.md Signed-off-by: Edwin Török <edwin.torok@cloud.com>
This is a bug in setup-ocaml@v3 ocaml/setup-ocaml#839 Work it around by defining our own cache prefix key as suggested in EXAMPLES.md Signed-off-by: Edwin Török <edwin.torok@cloud.com>
This is a bug in setup-ocaml@v3 ocaml/setup-ocaml#839 Work it around by defining our own cache prefix key as suggested in EXAMPLES.md Signed-off-by: Edwin Török <edwin.torok@cloud.com>
This is a bug in setup-ocaml@v3 ocaml/setup-ocaml#839 Work it around by defining our own cache prefix based on runner OS version. Unfortunately the version itself doesn't seem to be available as a variable in GH actions. There is 'runner.os', but that is just a generic Linux, there is 'matrix.os', but that is only present when using a matrix, and there is '..container' which is only present when containers are used. Signed-off-by: Edwin Török <edwin.torok@cloud.com>
This is a bug in setup-ocaml@v3 ocaml/setup-ocaml#839 Work it around by defining our own cache prefix based on runner OS version. Unfortunately the version itself doesn't seem to be available as a variable in GH actions. There is 'runner.os', but that is just a generic Linux, there is 'matrix.os', but that is only present when using a matrix, and there is '..container' which is only present when containers are used. Signed-off-by: Edwin Török <edwin.torok@cloud.com>
This is a bug in setup-ocaml@v3 ocaml/setup-ocaml#839 Work it around by defining our own cache prefix based on runner OS version. Unfortunately the version itself doesn't seem to be available as a variable in GH actions. There is 'runner.os', but that is just a generic Linux, there is 'matrix.os', but that is only present when using a matrix, and there is '..container' which is only present when containers are used. Signed-off-by: Edwin Török <edwin.torok@cloud.com>
The cache key should not actually contain less information. |
This is a bug in setup-ocaml@v3 ocaml/setup-ocaml#839 Work it around by defining our own cache prefix based on runner OS version. Unfortunately the version itself doesn't seem to be available as a variable in GH actions. There is 'runner.os', but that is just a generic Linux, there is 'matrix.os', but that is only present when using a matrix, and there is '..container' which is only present when containers are used. Signed-off-by: Edwin Török <edwin.torok@cloud.com>
This is a bug in setup-ocaml@v3 ocaml/setup-ocaml#839 Work it around by defining our own cache prefix based on runner OS version. Unfortunately the version itself doesn't seem to be available as a variable in GH actions. There is 'runner.os', but that is just a generic Linux, there is 'matrix.os', but that is only present when using a matrix, and there is '..container' which is only present when containers are used. Signed-off-by: Edwin Török <edwin.torok@cloud.com>
This is a bug in setup-ocaml@v3 ocaml/setup-ocaml#839 Work it around by defining our own cache prefix based on runner OS version. Unfortunately the version itself doesn't seem to be available as a variable in GH actions. There is 'runner.os', but that is just a generic Linux, there is 'matrix.os', but that is only present when using a matrix, and there is '..container' which is only present when containers are used. Use another GH action to determine the version, and now the cache-prefix looks like this: ``` cache-prefix: v3-Ubuntu-22.04 ``` Signed-off-by: Edwin Török <edwin.torok@cloud.com>
Hmm maybe this information was wrong before too, and it is just a timing issue (the new v3 action is quicker because pinning can be avoided). As a workaround I used this https://github.com/marketplace/actions/github-actions-runner-os-system-information actions and composed a cache prefix that included name and release, that relies on the Perhaps setup-ocaml could call this function internally to figure out the runner's OS version? |
I have been considering about making it a little more strict. Let me try it. |
(Of course, the v3 tag is already moved. Just restarting the job should be enough!) |
Thanks for the quick fix. Although I think the dune cache key should also include the OS, I'm not sure whether dune would hash the system binaries when calculating its input hash, so there is still a chance we might end up copying a binary compiled on a different OS. But even if Dune does that the cache will likely won't be effective if we mix different OS versions. |
If my "guess" is correct, I believe the dune cache should be OS independent. Does it actually depend on the OS and / or OS version? @rgrinberg @mefyl |
the If dune doesn't hash ocamlopt (and just looks at its PATH which will be identical across OSes) and reuses the dune cache from another (newer) OS version then the output can potentially be wrong and won't run, because different OS -> same source input hash -> same binaries retrieved from the cache. You can share the dune cache between different workspaces/opam switches on the same OS though. |
Indeed, AFAICT the dune cache cannot be shared between different OSes, it entirely relies on dune's decision to rebuild or not something. Sharing the cache between two machines is similar to copying a build tree from one machine to the other. If you do this between two different architecture, and if dune doesn't think it should rebuild the artifact and thus tries to reuse invalid compiled files, then the cache will suffer the same problem. One could argue this is a misfeature :) |
I haven't seen this failure on setup-ocaml@v2, but ever since we switched to setup-ocaml@v3 we started getting these failures:
https://github.com/xapi-project/xen-api/actions/runs/10248744378/job/28350652648?pr=5910
We have a mix of ubuntu-22.04 and ubuntu-latest in our github workflows (by accident rather than intentionally) and it looks like they overwrite each-other's opam cache.
(we can fix the mix of runners on 'master', but that won't help with open PRs which will still have a mix).
The runner's OS should probably be included in the cache key.
The text was updated successfully, but these errors were encountered: