vercel / turborepo

Build system optimized for JavaScript and TypeScript, written in Rust
https://turbo.build/repo/docs
MIT License
26.21k stars 1.81k forks source link

CICD check wipes out parts of the config #1508

Closed StevenMatchett closed 2 years ago

StevenMatchett commented 2 years ago

What version of Turborepo are you using?

1.2.14

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

Yarn v2/v3 (node_modules linker only)

What operating system are you using?

Linux

Describe the Bug

I have set up my project to use remote-caching using vercel. When running turbo commands locally I get a cache hit and can see my assets uploaded to my dashboard in vercel. I have tested that it is receiving the assets from the remote cache, by deleting my local cache rm -rf ./node_modules/.cache/turbo.

I am using alpine node-lts in my docker build. When docker runs the build commands I do not see • Remote computation caching enabled (experimental) in the console like I do when running locally. I assume that I am missing something in my docker container to get it to work. I do not see any specified things needed in the documentation of external dependencies for remote caching to work

Expected Behavior

Remote caching to work during a docker build

To Reproduce

Clone this repo

https://github.com/StevenMatchett/turbo-repo-issue

npx turbo login npx turbo link yarn build docker build .

Docker will not use remote cache files

StevenMatchett commented 2 years ago

I have noticed that in linux the config parser isn't working as intended. I am fairly new to golang (installed it a few hours ago) so I am not really sure where to look, but I noticed that my .turbo/config.js file isn't being applied the same as on my macbook. Certain flags that are set for teamId and teamSlug are coming back being an empty string in docker unless I add the flag to the cli. `turbo run build --team=\"team-123\" But I do not see a flag for teamId which if not set doesn't seem to work.

I know this isn't the right fix, but when I added this line along side in the if statement caching was working on linux.

partialConfig.TeamId = arg[len("--team="):]

https://github.com/vercel/turborepo/blob/main/cli/internal/config/config.go#L172

StevenMatchett commented 2 years ago

Fix for issue. Seems this logic is a little flawed

https://github.com/vercel/turborepo/pull/1527