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

Turborepo Cache issue with .gitignore'd files #7821

Open
1 task done
bryansoftdev opened this issue Mar 22, 2024 · 2 comments
Open
1 task done

Turborepo Cache issue with .gitignore'd files #7821

bryansoftdev opened this issue Mar 22, 2024 · 2 comments
Assignees
Labels
kind: bug Something isn't working owned-by: turborepo

Comments

@bryansoftdev
Copy link

Verify canary release

  • I verified that the issue exists in the latest Turborepo canary release.

Link to code that reproduces this issue

https://github.com/bryansoftdev/turbo-gitignore-issue

What package manager are you using / does the bug impact?

pnpm

What operating system are you using?

Mac

Which canary version will you have in your reproduction?

1.13.0

Describe the Bug

  "pipeline": {
    "build": {
      "dependsOn": ["build-config-file"],
      "inputs": ["$TURBO_DEFAULT$", "config.json"]
    },
    "build-config-file": {
      "cache": false
    }
  },

When executing the build task that depends on the build-config-file task, the build task incorrectly receives a cache hit, even though the build-config-file task has dynamically generated a new and different config.json. This results in the build task using an outdated configuration, ignoring the changes made by the build-config-file task.

The issue appears to be caused by Turbo's inability to cache changes in .gitignore files.

Expected Behavior

The expected behavior is that the dependent task gets a cache miss whenever the upstream task generates a new config.json, even if this file is listed in .gitignore.

To Reproduce

  1. pnpm install
  2. pnpm exec turbo build
    • config.json is first created by build-config-file
  3. rm ./apps/app-1/config.json
    • simulate the repo's initial state
  4. pnpm exec turbo build
    • config.json recreated and has different file contents
    • turbo repo shows first config.json's contents even though config.json is listed in inputs & has changed.
      this should be a cache miss.

Additional context

For now, I removed build-config-file from my build task dependencies, so that I can run the tasks individually & the caching is working as expected.

pnpm exec turbo build-config-file
pnpm exec turbo build
@bryansoftdev bryansoftdev added kind: bug Something isn't working needs: triage New issues get this label. Remove it after triage owned-by: turborepo labels Mar 22, 2024
@arlyon
Copy link
Contributor

arlyon commented Apr 2, 2024

Hi! Thanks for the report. We're having a look at this now and will report back.

Thanks!

@arlyon arlyon added needs: reproduction and removed needs: triage New issues get this label. Remove it after triage labels Apr 2, 2024
@arlyon arlyon self-assigned this Apr 2, 2024
@tknickman
Copy link
Member

@bryansoftdev are you seeing the following for the cache hit on build?

cache hit (outputs already on disk)

Also, will your build task have outputs?

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

No branches or pull requests

3 participants