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

remoteCache enabled option set to true bypasses --force flag #9681

Closed
1 task done
leoperria opened this issue Jan 9, 2025 · 2 comments · Fixed by #9684
Closed
1 task done

remoteCache enabled option set to true bypasses --force flag #9681

leoperria opened this issue Jan 9, 2025 · 2 comments · Fixed by #9684
Labels
needs: triage New issues get this label. Remove it after triage

Comments

@leoperria
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/stelltec/turborepo-reproduce1

Which canary version will you have in your reproduction?

turbo 2.3.4-canary.6

Enviroment information

turbo 2.3.4-canary.6

CLI:
   Version: 2.3.4-canary.6
   Path to executable: /home/leonardo/repos/turbo-bug/my-turborepo/node_modules/.pnpm/turbo-linux-64@2.3.4-canary.6/node_modules/turbo-linux-64/bin/turbo
   Daemon status: Running
   Package manager: pnpm

Platform:
   Architecture: x86_64
   Operating system: linux
   WSL: false
   Available memory (MB): 22897
   Available CPU cores: 16

Environment:
   CI: None
   Terminal (TERM): xterm-256color
   Terminal program (TERM_PROGRAM): unknown
   Terminal program version (TERM_PROGRAM_VERSION): unknown
   Shell (SHELL): /usr/bin/zsh
   stdin: false

Expected behavior

If I enable remoteCache in root turbo.json

{

    "remoteCache": {
       "enabled": true
  }
}

I should be able to bypass caching and force rebuild using the --force flag

Actual behavior

Not sure if it's an expected behaviour but the --force flag is bypassed and there is no way to force rebuild:

$ turbo build --force                                                                                                                                                                                                                                                   ✔ 
turbo 2.3.4-canary.6

• Packages in scope: app-a, app-b, pkg-a, pkg-b, tooling-config
• Running build in 5 packages
• Remote caching enabled
pkg-b:prebuild: cache hit (outputs already on disk), replaying logs 5cbb619b78fa381a
pkg-b:prebuild: 
pkg-b:prebuild: 
pkg-b:prebuild: > pkg-b@ prebuild /home/leonardo/repos/turbo-bug/my-turborepo/packages/pkg-b
pkg-b:prebuild: > echo "Executing pre-build step..."
pkg-b:prebuild: 
pkg-b:prebuild: Executing pre-build step...
app-b:build: cache hit (outputs already on disk), replaying logs 1242af90bedccc6c
app-b:build: 
app-b:build: 
app-b:build: > app-b@ build /home/leonardo/repos/turbo-bug/my-turborepo/apps/app-b
app-b:build: > mkdir -p dist && echo "Your application output!" > dist/app-output.txt && echo "Application B is built!"
app-b:build: 
app-b:build: Application B is built!
pkg-a:build: cache hit (outputs already on disk), replaying logs 1ccc2498ba66d1b1
pkg-a:build: 
pkg-a:build: 
pkg-a:build: > pkg-a@ build /home/leonardo/repos/turbo-bug/my-turborepo/packages/pkg-a
pkg-a:build: > echo "Building at the speed of Turbo." > output-file.txt && cat output-file.txt
pkg-a:build: 
pkg-a:build: Building at the speed of Turbo.
pkg-b:build: cache hit (outputs already on disk), replaying logs 21609796f74b5216
pkg-b:build: 
pkg-b:build: 
pkg-b:build: > pkg-b@ prebuild /home/leonardo/repos/turbo-bug/my-turborepo/packages/pkg-b
pkg-b:build: > echo "Executing pre-build step..."
pkg-b:build: 
pkg-b:build: Executing pre-build step...
pkg-b:build: 
pkg-b:build: > pkg-b@ build /home/leonardo/repos/turbo-bug/my-turborepo/packages/pkg-b
pkg-b:build: > echo "Welcome to the Turboverse." > output-file.txt && cat output-file.txt
pkg-b:build: 
pkg-b:build: Welcome to the Turboverse.
app-a:build: cache hit (outputs already on disk), replaying logs de52d0fccb16d6cc
app-a:build: 
app-a:build: 
app-a:build: > app-a@ build /home/leonardo/repos/turbo-bug/my-turborepo/apps/app-a
app-a:build: > mkdir -p dist && echo "Your application output!" > dist/app-output.txt && echo "Application A is built!"
app-a:build: 
app-a:build: Application A is built!

 Tasks:    5 successful, 5 total
Cached:    5 cached, 5 total
  Time:    35ms >>> FULL TURBO

To Reproduce

  1. Start test remote cache with docker-compose:
$ docker-compose up
  1. Configure test remote cache env vars
export TURBO_API=http://localhost:3333
export TURBO_TEAM="test"
export TURBO_TOKEN="test"
  1. Build with --force flag
$ turbo build --force  

Additional context

As per docs, enabled:true is the default. So I've found that this config:

{
   "remoteCache": {
   }
}

actually works:

$ turbo build --force                                                                                                                                                                                                                                                   ✔ 
turbo 2.3.4-canary.6

• Packages in scope: app-a, app-b, pkg-a, pkg-b, tooling-config
• Running build in 5 packages
• Remote caching enabled
pkg-b:prebuild: cache bypass, force executing 5cbb619b78fa381a
pkg-b:prebuild: 
app-b:build: cache bypass, force executing 1242af90bedccc6c
app-b:build: 
pkg-a:build: cache bypass, force executing 1ccc2498ba66d1b1
pkg-a:build: 
pkg-a:build: 
pkg-a:build: > pkg-a@ build /home/leonardo/repos/turbo-bug/my-turborepo/packages/pkg-a
pkg-a:build: > echo "Building at the speed of Turbo." > output-file.txt && cat output-file.txt
pkg-a:build: 
pkg-b:prebuild: 
pkg-b:prebuild: > pkg-b@ prebuild /home/leonardo/repos/turbo-bug/my-turborepo/packages/pkg-b
pkg-b:prebuild: > echo "Executing pre-build step..."
pkg-b:prebuild: 
app-b:build: 
app-b:build: > app-b@ build /home/leonardo/repos/turbo-bug/my-turborepo/apps/app-b
app-b:build: > mkdir -p dist && echo "Your application output!" > dist/app-output.txt && echo "Application B is built!"
app-b:build: 
pkg-a:build: Building at the speed of Turbo.
pkg-b:prebuild: Executing pre-build step...
app-b:build: Application B is built!
pkg-b:build: cache bypass, force executing 21609796f74b5216
pkg-b:build: 
app-a:build: cache bypass, force executing de52d0fccb16d6cc
app-a:build: 
pkg-b:build: 
pkg-b:build: > pkg-b@ prebuild /home/leonardo/repos/turbo-bug/my-turborepo/packages/pkg-b
pkg-b:build: > echo "Executing pre-build step..."
pkg-b:build: 
app-a:build: 
app-a:build: > app-a@ build /home/leonardo/repos/turbo-bug/my-turborepo/apps/app-a
app-a:build: > mkdir -p dist && echo "Your application output!" > dist/app-output.txt && echo "Application A is built!"
app-a:build: 
pkg-b:build: Executing pre-build step...
pkg-b:build: 
pkg-b:build: > pkg-b@ build /home/leonardo/repos/turbo-bug/my-turborepo/packages/pkg-b
pkg-b:build: > echo "Welcome to the Turboverse." > output-file.txt && cat output-file.txt
pkg-b:build: 
app-a:build: Application A is built!
pkg-b:build: Welcome to the Turboverse.

 Tasks:    5 successful, 5 total
Cached:    0 cached, 5 total
  Time:    829ms 
@leoperria leoperria added kind: bug Something isn't working needs: triage New issues get this label. Remove it after triage labels Jan 9, 2025
@chris-olszewski chris-olszewski removed the kind: bug Something isn't working label Jan 10, 2025
@chris-olszewski
Copy link
Member

Thanks for the report. #9684 should fix this

@leoperria
Copy link
Author

Hey thanks! Appreciated :)

chris-olszewski added a commit that referenced this issue Jan 13, 2025
### Description

Fixes #9681

We were setting remote cache items to whatever the value of
`remoteCache.enable` was. This incorrectly re-enabled parts of the cache
that had previously been disabled. The fix is to only care if users
explicitly disable remote caching, this works since if
`remoteCache.enable` isn't specified it is assumed to be `true`.

### Testing Instructions

Added failing unit test in first commit, it passes after the second
commit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: triage New issues get this label. Remove it after triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants