Repository navigation
Cache key conflict #826
Description
Activity
Hello @vnghia
Thank you for creating this issue. We will investigate it and get back to you as soon as we have some feedback.Reacted by vnghiaHello @vnghia 👋,
Thank you for your insightful observation. We will consider incorporating your suggestion about including the architecture in the final cache key in our future enhancements.
Meantime as a workaround architecture can be included in the cache key usingactions/cacheas shown below to get separate caches for different architectures.- name: Setup Python uses: actions/setup-python@v5 id: setup-python with: python-version: "3.11" architecture: ${{ matrix.target.architecture }} - name: Install Poetry run: | pipx install poetry echo "POETRY_CACHE_DIR=$(pip cache dir)" >> $GITHUB_ENV - name: Cache poetry uses: actions/cache@v3 with: path: ${{ env.POETRY_CACHE_DIR }} key: ${{ runner.os }}-poetry-${{ steps.setup-python.outputs.python-version }}-${{ matrix.target.architecture }}-${{ hashFiles('**/poetry.lock') }} restore-keys: | ${{ runner.os }}-poetry-${{ steps.setup-python.outputs.python-version }}-${{ matrix.target.architecture }}Your patience and your valuable contribution to the improvement is immensely appreciated!!
Reacted by vnghia and Tim Nunamaker- addedfeature requestNew feature or request to improve the current logicNew feature or request to improve the current logicand removedbugSomething isn't workingSomething isn't working
on Apr 3, 2024 +1 for this feature! Can I also suggest that this enhancement includes within the cache key the additional configurations to the matrix via
jobs.<job_id>.strategy.matrix.include?- added a commit that references this issue
on Jul 26, 2024 Hi @vnghia, Architecture was added to the cache key as part of this PR. However, the issue is still present because the architecture is taken from the runner. For example, the windows-latest runner is based on a x64 architecture, so even if you specify x86 in your workflow, the runner environment will still be x64. This can cause the architecture to default to x64 despite the x86 specification resulting in a cache key conflict. We acknowledge this limitation and are actively considering improvements to ensure the cache key accurately reflects the specified architecture in future updates.
Hi @vnghia,
Just a gentle reminder. Do you have any concerns or updates regarding the previous discussion?I don't have much to say. Thank you for working on this feature 👍
Hi @vnghia, Thank you for your response. We are closing this feature request as the architecture has already been incorporated into the cache key. Please feel free to reach out if you have any further questions or concerns.
Description:
When building with
python-versionandarchitecture, onlypython-versionis included in the final cache key, e.gsetup-python-Windows-python-3.11.8-poetry-...but notarchitecturewhich will cause theUnable to reserve cache with key setup-python-Windows-python-3.11.8-poetry-v2-..., another job may be creating this cache. More details: Cache already exists. Scope: refs/heads/mainAction version:
v5
Platform:
Runner type:
Tools version:
Repro steps:
Expected behavior:
Cache is cached for all architectures
Actual behavior:
Only one architecture is cached