Skip to content
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

Cache key conflict #826

Open
4 of 5 tasks
vnghia opened this issue Feb 29, 2024 · 2 comments
Open
4 of 5 tasks

Cache key conflict #826

vnghia opened this issue Feb 29, 2024 · 2 comments
Labels
feature request New feature or request to improve the current logic

Comments

@vnghia
Copy link

vnghia commented Feb 29, 2024

Description:
When building with python-version and architecture, only python-version is included in the final cache key, e.g setup-python-Windows-python-3.11.8-poetry-... but not architecture which will cause the Unable 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/main

Action version:
v5

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:

Repro steps:

jobs:
  build:
    strategy:
      fail-fast: false
      matrix:
        target:
          - os: "windows-latest"
            architecture: "x64"
          - os: "windows-latest"
            architecture: "x86"
    defaults:
      run:
        shell: bash
    runs-on: ${{ matrix.target.os }}

    steps:
      - uses: actions/checkout@v4
      - name: Install poetry
        run: pipx install poetry
      - name: Setup Python
        uses: actions/setup-python@v5
        id: setup-python
        with:
          python-version: "3.11"
          architecture: ${{ matrix.target.architecture }}
          cache: "poetry"

Expected behavior:
Cache is cached for all architectures

Actual behavior:
Only one architecture is cached

@vnghia vnghia added bug Something isn't working needs triage labels Feb 29, 2024
@HarithaVattikuti
Copy link
Contributor

Hello @vnghia
Thank you for creating this issue. We will investigate it and get back to you as soon as we have some feedback.

@priya-kinthali
Copy link
Contributor

Hello @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 using actions/cache as 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!!

@priya-kinthali priya-kinthali added feature request New feature or request to improve the current logic and removed bug Something isn't working labels Apr 3, 2024
@priya-kinthali priya-kinthali removed their assignment Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request to improve the current logic
Projects
None yet
Development

No branches or pull requests

3 participants