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

Self-hosted runners cache not working when using service containers #1021

Open
omri-shilton opened this issue Jan 27, 2025 · 1 comment
Open
Assignees
Labels
bug Something isn't working

Comments

@omri-shilton
Copy link

Description:
Running on self hosted runner using the following: https://github.com/github-aws-runners/terraform-aws-github-runner
I have a workflow that has multiple jobs, some are regular and some have service containers ie:

  Job-A:
    runs-on: [self-hosted, linux, x64, ubuntu-latest]
    steps:
      - name: Check out repository code 🕵🏻‍♀️
        uses: actions/checkout@v4

      - uses: actions/setup-python@v4
        with:
          python-version: '3.10.10'
          cache: 'pip'

      - name: Run Mypy
        run: |
          pip install -r backend/requirements/linter-requirements.txt
          mypy --config backend/mypy.ini backend


  Job-B:
    runs-on: [self-hosted, linux, x64, ubuntu-latest]
    services:
      postgresql:
        image: somerepo/someimage:latest
        ports:
          - 5432:5432
        env:
          SOME_VAR: SOMEVAR
        credentials:
          username: someuser
          password: somepass
    steps:
      - name: Check out repository code 🕵🏻‍♀️
        uses: actions/checkout@v4

      - uses: actions/setup-python@v4
        with:
          python-version: '3.10.10'
          cache: 'pip'

      - name: Install newly added packages
        run: |
          pip install -r backend/requirements/requirements.txt
          pip install -r backend/requirements/dev-requirements.txt
          pip install psycopg2-binary==2.9.9

On the job that don't have service containers i'm getting these logs:
Image
you can see that the cache is found and then using the cached packages.

On the job that has service containers i'm getting these logs:
Image
you can see that the cache is found and then still downloading the packages instead of using the cache.

When I log into the machine that ran the second job i can see that .cache/pip/ folder has many packages.

Action version:
4

Platform:

  • Ubuntu

Runner type:

  • Self-hosted - version 2.322.0

Tools version:

3.10.10

Repro steps:
copy the workflow jobs that I listed and fill in some real data.

Expected behavior:
Cache to be used on both jobs.

Actual behavior:
cache is working only on jobs without service containers.

@omri-shilton omri-shilton added bug Something isn't working needs triage labels Jan 27, 2025
@mahabaleshwars
Copy link

Hi @omri-shilton,
Thank you for creating this issue. We will investigate it and provide feedback as soon as we have some updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants