Fix Touch race condition on first run with parallel MSBuild nodes#168
Conversation
When multiple MSBuild nodes run concurrently on first checkout, the mutex losers skip the install but the Touch task still tried to create install.stamp in the not-yet-created .husky/_/ directory, causing MSB3371 errors. Fix: capture the ExitCode from the install Exec and condition Touch on both exit code 0 and the .husky/_/ directory existing. Losers skip Touch entirely - no premature stamp, no error.
PR Summary
|
|
/cc @alirezanet, I found a bug in the new target (sorry 😥). It's unlikely to impact many existing users, but given that we just shipped it, wanted to flag for fast follow up. Let me know if there's anything I can do to help. |
alirezanet
left a comment
There was a problem hiding this comment.
Thanks for testing it
LGTM, but now I'm thinking it might be hard for users to adjust the file paths correctly if they want to do it manually.
if you had time please investigate to see if there is anyway to reuese the WorkingDirectory somehow in other elements. what I'm thinking is to define the husky working directory once and reuse it for all of these paths. so we don't end up with multiple paths like ../../.husky/_
but yeah if you think is not possible or it is time consuming is better to merge this PR first and investigate later.
|
If it's ok with you, want to merge this and I'll follow up? The reason I didn't do it initially is because it's also in the Inputs and Outputs, so I can't define any base property inside the target to reuse. |
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [husky](https://redirect.github.com/alirezanet/husky.net) | `0.9.0` → `0.9.1` |  |  | --- ### Release Notes <details> <summary>alirezanet/husky.net (husky)</summary> ### [`v0.9.1`](https://redirect.github.com/alirezanet/Husky.Net/releases/tag/v0.9.1) [Compare Source](https://redirect.github.com/alirezanet/husky.net/compare/v0.9.0...v0.9.1) #### What's Changed - Fix install command race condition on first run with parallel MSBuild nodes by [@​MattKotsenas](https://redirect.github.com/MattKotsenas) in [alirezanet/Husky.Net#168](https://redirect.github.com/alirezanet/Husky.Net/pull/168) **Full Changelog**: <alirezanet/Husky.Net@v0.9.0...v0.9.1> </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/psimsa/github-actions-autoscaler). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My42Ni40IiwidXBkYXRlZEluVmVyIjoiNDMuNjYuNCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Description
When multiple MSBuild nodes run
dotnet husky installconcurrently on first checkout (e.g., viaDirectory.Build.targets), the mutex losers skip the install but theTouchtask still tries to createinstall.stampin the.husky/_/directory. Since that directory hasn't been created yet (the winner is still working), this fails with:Who's impacted:
Not impacted:
Fixes #155
Type of change
Checklist