-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat(core): support cwd specific hashes #33879
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
base: master
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
✅ Deploy Preview for nx-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
View your CI Pipeline Execution ↗ for commit 259132e
☁️ Nx Cloud last updated this comment at |
Coly010
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should react have needed changes? What changed that this wasn’t an issue before?
@Coly010 i think this is the first time wece updated these typing since we moved to ts project refs and its exposing places where the typing were pulling in the wrong version of nx. |
4aea3a8 to
e876db3
Compare
8926ab6 to
89b5eb5
Compare
39bb82f to
f47568c
Compare
| The `workingDirectory` input accepts two values: | ||
|
|
||
| - `"relative"` - Hashes the relative path from the workspace root to the current working directory. This is useful when tasks should be invalidated when run from different subdirectories within the workspace. | ||
| - `"absolute"` - Hashes the full absolute path of the current working directory. This is useful when tasks depend on the exact location on the filesystem. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should mention that this will invalidate the cache if the repo is checked out to different locations such as local vs CI... or even developer 1 vs developer 2
| } | ||
| HashInstruction::Cwd(mode) => { | ||
| let workspace_root = std::path::Path::new(&self.workspace_root); | ||
| let cwd = std::env::current_dir().unwrap_or_default(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can't use the process cwd... because this might be on the daemon...when it should be the one from the main nx command.
759d911 to
a5a32b1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ The fix from Nx Cloud was applied
These changes fix the formatting failure in the astro-docs:format task by running Prettier on the inputs.mdoc file. The formatting issue was caused by the documentation changes for the new workingDirectory input feature, which added a JSON example that needed a trailing comma to comply with Prettier's style rules.
We had verified this fix by re-running astro-docs:format.
Suggested Fix changes
diff --git a/astro-docs/src/content/docs/reference/inputs.mdoc b/astro-docs/src/content/docs/reference/inputs.mdoc
index 49a48aaa66..bf8413216f 100644
--- a/astro-docs/src/content/docs/reference/inputs.mdoc
+++ b/astro-docs/src/content/docs/reference/inputs.mdoc
@@ -95,8 +95,8 @@ Some tasks may behave differently depending on which directory they are run from
```jsonc
{
"inputs": [
- { "workingDirectory": "relative" } // Hash the path relative to workspace root
- ]
+ { "workingDirectory": "relative" }, // Hash the path relative to workspace root
+ ],
}
```
This fix was applied by Craigory Coppola
🎓 Learn more about Self-Healing CI on nx.dev
fix(dotnet): include cwd in target hash Fixes #33684 fix(repo): ensure appropriate typings are present fix(repo): ensure appropriate typings are present Co-authored-by: AgentEnder <AgentEnder@users.noreply.github.com> fix(core): add workingDirectory to input validation check Co-authored-by: AgentEnder <AgentEnder@users.noreply.github.com> fix(core): add workingDirectory to input validation check Co-authored-by: AgentEnder <AgentEnder@users.noreply.github.com> [Self-Healing CI Rerun] fix(core): pass client cwd to daemon for task hashing The daemon process runs from a fixed location (workspace root), so using std::env::current_dir() in the native task hasher would always return the daemon's cwd rather than where the user invoked the command. This fix passes the client's actual cwd through the daemon IPC to ensure the workingDirectory input hashes correctly based on where commands are executed from.
1c4a2f2 to
259132e
Compare
| let hash_time = std::time::Instant::now(); | ||
|
|
||
| let hashes: NapiDashMap<String, HashDetails> = NapiDashMap::new(); | ||
| let cwd_path = std::path::Path::new(&cwd); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this have to be fully qualiffied?
Current Behavior
There is no straight-forward way to use the cwd as part of a tasks hash
Expected Behavior
You can use
{workingDirectory: 'absolute'}to factor the working directory into the hashRelated Issue(s)
Fixes #33684