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

Sbt dependency cache key is calculated incorrectly, causing slowness & inconsistent run times #477

Closed
2 of 5 tasks
Dogacel opened this issue Apr 6, 2023 · 3 comments
Closed
2 of 5 tasks
Assignees
Labels
bug Something isn't working

Comments

@Dogacel
Copy link
Contributor

Dogacel commented Apr 6, 2023

Description:
Sbt dependency cache key is calculated incorrectly.

Task version:
v3.11.0

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Repro steps:
Run this workfile on some scala project, later modify some scala or sbt file under project/ and compare hashes.

name: Test Hashfiles
on: push

jobs:
  test:
    # Detect which parts of the application has changed. Such as API code, db migrations etc.
    name: Test
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v3
        with:
          # arbitrary number to fetch enough number of commits in a PR, instead of whole history.
          fetch-depth: 1000

      - name: Test Before
        shell: bash
        run: echo "${{ hashFiles('**/*.sbt', '**/project/build.properties', '**/project/**.{scala,sbt}') }}"

      - name: Test After
        shell: bash
        run: echo "${{ hashFiles('**/*.sbt', '**/project/build.properties', '**/project/**.scala', '**/project/**.sbt') }}"

In our case, before modification of api/project/Dependencies.scala:

Test Before: 09f3783957f7496e05c5b7618773c57281bfdf1f33f8cb10e94e88579c3e5308
Test After: 74c085d46b2d61ad084b24ff74f0a1f8252fc91a0b72c5aa6717c6639f1494fc

After modification:

Test Before: 09f3783957f7496e05c5b7618773c57281bfdf1f33f8cb10e94e88579c3e5308
Test After: cf44e926587b9345fe8347c6df516a5d6ef95346eb13731bd98634cedf122a4f

As you can see cache is calculated incorrectly.

Expected behavior:
When an sbt or scala file has changed under

Actual behavior:
All sbt and scala files are ignored under **/project/ and this is causing the cache to act slower / inconsistent. I also realized pruning cache was speeding up our CI runs a lot but they were slowing down by time and they were getting slower and slower almost every day.

@Dogacel Dogacel added bug Something isn't working needs triage labels Apr 6, 2023
@Dogacel Dogacel mentioned this issue Apr 6, 2023
2 tasks
@Dogacel
Copy link
Contributor Author

Dogacel commented Apr 6, 2023

Opened a PR here: #478

@IvanZosimov IvanZosimov self-assigned this Apr 7, 2023
@IvanZosimov
Copy link
Contributor

Hi, @Dogacel 👋 Thanks for the issue and PR, we will take a look!

@Dogacel
Copy link
Contributor Author

Dogacel commented Apr 10, 2023

As PR #478 is merged, I am closing the issue.

@Dogacel Dogacel closed this as completed Apr 10, 2023
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

2 participants