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

feat(dep-graph): introduce NX_DEPS_DIRECTORY env variable #10608

Closed
wants to merge 1 commit into from
Closed

feat(dep-graph): introduce NX_DEPS_DIRECTORY env variable #10608

wants to merge 1 commit into from

Conversation

minijus
Copy link
Contributor

@minijus minijus commented Jun 7, 2022

Current Behavior

nxdeps.json is always stored inside cache directory. This becomes an issues when cache directory is shared/mounted in CI environment. Multiple parallel CI runs start sharing (and updating) same nxdeps.json which in turn produces false results/erros.

Expected Behavior

It should be possible to store nxdeps.json outside cache directory, so it could be unique/isolated per workspace in CI environment.

Fixes #10000

@nx-cloud
Copy link

nx-cloud bot commented Jun 7, 2022

☁️ Nx Cloud Report

CI is running/has finished running commands for commit c3ec068. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 12 targets

Sent with 💌 from NxCloud.

@vercel
Copy link

vercel bot commented Jun 7, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
nx-dev ✅ Ready (Inspect) Visit Preview Jun 7, 2022 at 9:37AM (UTC)

@jonhamm
Copy link
Contributor

jonhamm commented Jun 10, 2022

You need to move Nx Daemon to use depsDir
Also need update of documentation
Need to make nx reset empty depsDir

I was developing this fix locally before seing your PR
It has these changes
Do you want a link to my PR to incorporate what you would find useful or should I just make another PR alongside yours?

@minijus
Copy link
Contributor Author

minijus commented Jun 10, 2022

@jonhamm let's work on this together!
I will not have a look at this PR earlier than Monday next week. If you intent to work during this time feel free to use what you see useful from this PR. Otherwise, I am glad to pull changes from your branch, just leave a link to it.

It would be really nice to get some feedback and general guidelines from Nx Team on this change before doing full implementation, cc @vsavkin @meeroslav @AgentEnder .

@FrozenPandaz
Copy link
Collaborator

FrozenPandaz commented Jun 10, 2022

Hey @minijus @jonhamm

Thank you for working on this! We discussed this and we're going to have an environment variable: $NX_PROJECT_GRAPH_CACHE_DIR that will override the existing cache dir. There will be no setting in nx.json for now and I think that's okay. Both the nxdeps.json and the daemon will go there.

I will take care of the implementation. I really appreciate the effort though. 🙏

Let me know what you think of the above.

EDIT: The environment variable will be NX_PROJECT_GRAPH_CACHE_DIRECTORY instead of previously mentioned NX_PROJECT_GRAPH_CACHE_DIR to match NX_CACHE_DIRECTORY.

@jonhamm
Copy link
Contributor

jonhamm commented Jun 12, 2022

@FrozenPandaz : thanks for the fix - it will be very helpful!
One note though: it would have been better with a config option or defaulting the project graph directory to something different from the cache directory which would lead to a zero-config in most situations as very few would want to move the project graph directory even if they move the cache directory
But that said, you solution will definitely work for us :-)

@github-actions
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Separate NxDaemon and NxCache to support use of shared cache - NX_CACHE_DIRECTORY
3 participants