Skip to content

Commit 8863ebf

Browse files
authored
Add --mutex option to yarn commands (#9919)
Attempt to improve reliability of running yarn commands. Our project structure might cause yarn to be launched multiple times. According to yarn docs, this option should avoid conflicts between multiple instances of yarn https://yarnpkg.com/en/docs/cli/#toc-concurrency-and-mutex
1 parent 20d0497 commit 8863ebf

File tree

5 files changed

+4
-9
lines changed

5 files changed

+4
-9
lines changed

eng/targets/Npm.Common.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
<Target Name="Restore">
2020
<Message Importance="High" Text="Running yarn install on $(MSBuildProjectFullPath)" />
21-
<Yarn Command="install $(InstallArgs)" StandardOutputImportance="High" StandardErrorImportance="High" />
21+
<Yarn Command="install --mutex network $(InstallArgs)" StandardOutputImportance="High" StandardErrorImportance="High" />
2222
</Target>
2323

2424
<Target Name="PrepareForBuild">

src/Middleware/CORS/test/FunctionalTests/CORS.FunctionalTests.npmproj

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,5 @@
1212
<IsTestProject>false</IsTestProject>
1313
</PropertyGroup>
1414

15-
<Target Name="InstallPuppeteer" BeforeTargets="Restore">
16-
<!-- Explicitly install puppeteer. This will install the bundled Chromium as part of restore instead of as part of execution -->
17-
<Yarn Command="add puppeteer" />
18-
</Target>
19-
2015
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" />
2116
</Project>

src/Middleware/NodeServices/src/Microsoft.AspNetCore.NodeServices.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
<Target Name="YarnInstall">
2323
<Message Text="Running yarn install on $(MSBuildProjectFile)" Importance="High" />
24-
<Yarn Command="install" />
24+
<Yarn Command="install --mutex network" />
2525
</Target>
2626

2727
<Target Name="_IsCustomRestoreTargetSupported" Returns="@(CustomRestoreTargets)" Condition="'$(BuildNodeJs)' == 'true'">

src/Middleware/SpaServices/src/Microsoft.AspNetCore.SpaServices.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
<Target Name="YarnInstall">
2727
<Message Text="Running yarn install on $(MSBuildProjectFile)" Importance="High" />
28-
<Yarn Command="install" />
28+
<Yarn Command="install --mutex network" />
2929
</Target>
3030

3131
<Target Name="_IsCustomRestoreTargetSupported" Returns="@(CustomRestoreTargets)" Condition="'$(BuildNodeJs)' == 'true'">

src/Shared/E2ETesting/E2ETesting.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
Importance="High"
1212
Text="Prerequisites were not enforced at build time. Running Yarn or the E2E tests might fail as a result. Check /src/Shared/E2ETesting/Readme.md for instructions." />
1313

14-
<Yarn Command="install" />
14+
<Yarn Command="install --mutex network" />
1515
</Target>
1616

1717
<Target Name="_IsCustomRestoreTargetSupported" Returns="@(CustomRestoreTargets)" Condition="'$(BuildNodeJs)' == 'true'">

0 commit comments

Comments
 (0)