Skip to content

Commit

Permalink
Call Yarn Install a second time if first one fails (#46965)
Browse files Browse the repository at this point in the history
* Call Yarn Install a second time if first one fails

* Update Npm.Common.targets

* Update Npm.Common.targets

* Update Npm.Common.targets

* More retries
  • Loading branch information
wtgodbe authored Mar 3, 2023
1 parent cd2907e commit a0373f2
Show file tree
Hide file tree
Showing 13 changed files with 59 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .azure/pipelines/components-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
displayName: Update submodules
- script: ./restore.sh
displayName: Run restore.sh
- script: yarn install --frozen-lockfile --cwd ./src/Components/test/E2ETest
- script: yarn install --frozen-lockfile --cwd ./src/Components/test/E2ETest || yarn install --frozen-lockfile --cwd ./src/Components/test/E2ETest
displayName: NPM install
- script: .dotnet/dotnet build ./src/Components/test/E2ETest -c $(BuildConfiguration) --no-restore
displayName: Build
Expand Down
12 changes: 11 additions & 1 deletion eng/targets/Npm.Common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,20 @@
<Target Name="Restore">
<Telemetry EventName="NETCORE_ENGINEERING_TELEMETRY" EventData="Category=Restore" />
<Message Importance="High" Text="Running yarn install on $(MSBuildProjectFullPath)" />
<!-- Add redundancy for yarn install - if first instance fails, try again -->
<Yarn Command="install --mutex network $(InstallArgs) --frozen-lockfile"
StandardOutputImportance="High"
StandardErrorImportance="High"
IgnoreStandardErrorWarningFormat="$(IgnoreYarnWarnings)" />
IgnoreStandardErrorWarningFormat="$(IgnoreYarnWarnings)"
IgnoreExitCode="true">
<Output TaskParameter="ExitCode" PropertyName="_YarnExitCode" />
</Yarn>
<Message Importance="High" Text="yarn install failed on $(MSBuildProjectFullPath), trying again" Condition="'$(_YarnExitCode)' != '0'" />
<Yarn Command="install --mutex network $(InstallArgs) --frozen-lockfile"
StandardOutputImportance="High"
StandardErrorImportance="High"
IgnoreStandardErrorWarningFormat="$(IgnoreYarnWarnings)"
Condition="'$(_YarnExitCode)' != '0'" />
</Target>

<Target Name="PrepareForBuild">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,17 @@
</Target>

<Target Name="CompileJs" Condition="'$(BuildNodeJS)' != 'false' AND '$(DesignTimeBuild)' != 'true'" Inputs="$(JsCompilationCacheFile)" Outputs="@(YarnOutputs)">
<Yarn Command="install --mutex network --frozen-lockfile" WorkingDirectory="$(YarnWorkingDir)" IgnoreStandardErrorWarningFormat="$(IgnoreYarnWarnings)" />
<!-- Retry yarn install if first one fails -->
<Yarn Command="install --mutex network $(InstallArgs) --frozen-lockfile"
WorkingDirectory="$(YarnWorkingDir)"
IgnoreStandardErrorWarningFormat="$(IgnoreYarnWarnings)"
IgnoreExitCode="true">
<Output TaskParameter="ExitCode" PropertyName="_LocalYarnExitCode" />
</Yarn>
<Yarn Command="install --mutex network $(InstallArgs) --frozen-lockfile"
WorkingDirectory="$(YarnWorkingDir)"
IgnoreStandardErrorWarningFormat="$(IgnoreYarnWarnings)"
Condition="'$(_LocalYarnExitCode)' != '0'" />
<Yarn Command="run build:production" WorkingDirectory="$(YarnWorkingDir)" Condition="'$(Configuration)' == 'Release'" IgnoreStandardErrorWarningFormat="$(IgnoreYarnWarnings)" />
<Yarn Command="run build:debug" WorkingDirectory="$(YarnWorkingDir)" Condition="'$(Configuration)' == 'Debug'" IgnoreStandardErrorWarningFormat="$(IgnoreYarnWarnings)" />

Expand Down
4 changes: 2 additions & 2 deletions src/Components/CustomElements/src/js/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"private": true,
"scripts": {
"preclean": "yarn install --mutex network --frozen-lockfile",
"preclean": "yarn install --mutex network --frozen-lockfile || yarn install --mutex network --frozen-lockfile",
"clean": "node node_modules/rimraf/bin.js ./dist/Debug ./dist/Release",
"prebuild": "yarn run clean && yarn install --mutex network --frozen-lockfile",
"prebuild": "yarn run clean && yarn install --mutex network --frozen-lockfile || yarn install --mutex network --frozen-lockfile",
"build": "yarn run build:debug && yarn run build:production",
"build:debug": "node node_modules/webpack-cli/bin/cli.js --mode development --config ./webpack.config.js",
"build:production": "node node_modules/webpack-cli/bin/cli.js --mode production --config ./webpack.config.js"
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Web.JS/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"MonoPlatform.*"
],
"scripts": {
"preclean": "yarn install --mutex network --frozen-lockfile",
"preclean": "yarn install --mutex network --frozen-lockfile || yarn install --mutex network --frozen-lockfile",
"clean": "node node_modules/rimraf/bin.js ./dist/Debug ./dist/Release",
"prebuild": "yarn run clean && yarn install --mutex network --frozen-lockfile",
"prebuild": "yarn run clean && yarn install --mutex network --frozen-lockfile || yarn install --mutex network --frozen-lockfile",
"lint": "eslint -c ./src/.eslintrc.js --ext .ts ./src",
"build": "yarn run build:debug && yarn run build:production",
"build:debug": "cd src && node ../node_modules/webpack-cli/bin/cli.js --mode development --config ./webpack.config.js",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"private": true,
"scripts": {
"preclean": "yarn install --mutex network --frozen-lockfile",
"preclean": "yarn install --mutex network --frozen-lockfile || yarn install --mutex network --frozen-lockfile",
"clean": "node node_modules/rimraf/bin.js ./dist/Debug ./dist/Release",
"prebuild": "yarn run clean && yarn install --mutex network --frozen-lockfile",
"prebuild": "yarn run clean && yarn install --mutex network --frozen-lockfile || yarn install --mutex network --frozen-lockfile",
"build": "yarn run build:debug && yarn run build:production",
"build:debug": "node node_modules/webpack-cli/bin/cli.js --mode development --config ./webpack.config.js",
"build:production": "node node_modules/webpack-cli/bin/cli.js --mode production --config ./webpack.config.js"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,17 @@
</Target>

<Target Name="CompileInterop" Condition="'$(BuildNodeJS)' != 'false' AND '$(DesignTimeBuild)' != 'true'" Inputs="$(InteropCompilationCacheFile)" Outputs="@(YarnOutputs)">
<Yarn Command="install --mutex network --frozen-lockfile" WorkingDirectory="$(YarnWorkingDir)" IgnoreStandardErrorWarningFormat="$(IgnoreYarnWarnings)" />
<!-- Retry yarn install if first one fails -->
<Yarn Command="install --mutex network $(InstallArgs) --frozen-lockfile"
WorkingDirectory="$(YarnWorkingDir)"
IgnoreStandardErrorWarningFormat="$(IgnoreYarnWarnings)"
IgnoreExitCode="true">
<Output TaskParameter="ExitCode" PropertyName="_LocalYarnExitCode" />
</Yarn>
<Yarn Command="install --mutex network $(InstallArgs) --frozen-lockfile"
WorkingDirectory="$(YarnWorkingDir)"
IgnoreStandardErrorWarningFormat="$(IgnoreYarnWarnings)"
Condition="'$(_LocalYarnExitCode)' != '0'" />
<Yarn Command="run build:production" WorkingDirectory="$(YarnWorkingDir)" Condition="'$(Configuration)' == 'Release'" IgnoreStandardErrorWarningFormat="$(IgnoreYarnWarnings)" />
<Yarn Command="run build:debug" WorkingDirectory="$(YarnWorkingDir)" Condition="'$(Configuration)' == 'Debug'" IgnoreStandardErrorWarningFormat="$(IgnoreYarnWarnings)" />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"private": true,
"scripts": {
"preclean": "yarn install --mutex network --frozen-lockfile",
"preclean": "yarn install --mutex network --frozen-lockfile || yarn install --mutex network --frozen-lockfile",
"clean": "node node_modules/rimraf/bin.js ./dist/Debug ./dist/Release",
"prebuild": "yarn run clean && yarn install --mutex network --frozen-lockfile",
"prebuild": "yarn run clean && yarn install --mutex network --frozen-lockfile || yarn install --mutex network --frozen-lockfile",
"build": "yarn run build:debug && yarn run build:production",
"build:debug": "node node_modules/webpack-cli/bin/cli.js --mode development --config ./webpack.config.js",
"build:production": "node node_modules/webpack-cli/bin/cli.js --mode production --config ./webpack.config.js"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,17 @@
</Target>

<Target Name="CompileInterop" Condition="'$(BuildNodeJS)' != 'false' AND '$(DesignTimeBuild)' != 'true'" Inputs="$(InteropCompilationCacheFile)" Outputs="@(YarnOutputs)">
<Yarn Command="install --mutex network --frozen-lockfile" WorkingDirectory="$(YarnWorkingDir)" IgnoreStandardErrorWarningFormat="$(IgnoreYarnWarnings)" />
<!-- Retry yarn install if first one fails -->
<Yarn Command="install --mutex network $(InstallArgs) --frozen-lockfile"
WorkingDirectory="$(YarnWorkingDir)"
IgnoreStandardErrorWarningFormat="$(IgnoreYarnWarnings)"
IgnoreExitCode="true">
<Output TaskParameter="ExitCode" PropertyName="_LocalYarnExitCode" />
</Yarn>
<Yarn Command="install --mutex network $(InstallArgs) --frozen-lockfile"
WorkingDirectory="$(YarnWorkingDir)"
IgnoreStandardErrorWarningFormat="$(IgnoreYarnWarnings)"
Condition="'$(_LocalYarnExitCode)' != '0'" />
<Yarn Command="run build:production" WorkingDirectory="$(YarnWorkingDir)" Condition="'$(Configuration)' == 'Release'" IgnoreStandardErrorWarningFormat="$(IgnoreYarnWarnings)" />
<Yarn Command="run build:debug" WorkingDirectory="$(YarnWorkingDir)" Condition="'$(Configuration)' == 'Debug'" IgnoreStandardErrorWarningFormat="$(IgnoreYarnWarnings)" />

Expand Down
2 changes: 1 addition & 1 deletion src/JSInterop/Microsoft.JSInterop.JS/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"types": "dist/Microsoft.JSInterop.d.ts",
"type": "module",
"scripts": {
"preclean": "yarn install --mutex network --frozen-lockfile",
"preclean": "yarn install --mutex network --frozen-lockfile || yarn install --mutex network --frozen-lockfile",
"clean": "node node_modules/rimraf/bin.js ./dist",
"build": "npm run clean && npm run build:esm",
"build:lint": "eslint -c .eslintrc.json --ext .ts ./src",
Expand Down
2 changes: 1 addition & 1 deletion src/SignalR/clients/ts/FunctionalTests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"scripts": {
"preclean": "cd .. && yarn run build",
"clean": "node ../common/node_modules/rimraf/bin.js ./wwwroot/dist ./obj/js",
"prebuild": "yarn run clean && yarn install --mutex network --frozen-lockfile",
"prebuild": "yarn run clean && yarn install --mutex network --frozen-lockfile || yarn install --mutex network --frozen-lockfile",
"build": "yarn run build:inner",
"build:inner": "yarn run build:lint && yarn run build:webpack",
"build:lint": "node ../common/node_modules/eslint/bin/eslint . --ext .ts --resolve-plugins-relative-to ../common",
Expand Down
4 changes: 2 additions & 2 deletions src/SignalR/clients/ts/signalr-protocol-msgpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
},
"sideEffects": false,
"scripts": {
"preclean": "cd ../common && yarn install --mutex network --frozen-lockfile",
"preclean": "cd ../common && yarn install --mutex network --frozen-lockfile || yarn install --mutex network --frozen-lockfile",
"clean": "node ../common/node_modules/rimraf/bin.js ./dist",
"prebuild": "yarn run clean && yarn install --mutex network --frozen-lockfile",
"prebuild": "yarn run clean && yarn install --mutex network --frozen-lockfile || yarn install --mutex network --frozen-lockfile",
"build": "yarn run build:lint && yarn run build:esm && yarn run build:cjs && yarn run build:browser && yarn run build:uglify",
"build:lint": "node ../common/node_modules/eslint/bin/eslint ./src --ext .ts --resolve-plugins-relative-to ../common",
"build:esm": "node ../common/node_modules/typescript/bin/tsc --project ./tsconfig.json --module es2015 --outDir ./dist/esm -d",
Expand Down
4 changes: 2 additions & 2 deletions src/SignalR/clients/ts/signalr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
},
"sideEffects": false,
"scripts": {
"preclean": "cd ../common && yarn install --mutex network --frozen-lockfile",
"preclean": "cd ../common && yarn install --mutex network --frozen-lockfile || yarn install --mutex network --frozen-lockfile",
"clean": "node ../common/node_modules/rimraf/bin.js ./dist",
"prebuild": "yarn run clean && yarn install --mutex network --frozen-lockfile",
"prebuild": "yarn run clean && yarn install --mutex network --frozen-lockfile || yarn install --mutex network --frozen-lockfile",
"build": "yarn run build:lint && yarn run build:esm && yarn run build:cjs && yarn run build:browser && yarn run build:webworker",
"build:lint": "node ../common/node_modules/eslint/bin/eslint ./src --ext .ts --resolve-plugins-relative-to ../common",
"build:esm": "node ../common/node_modules/typescript/bin/tsc --project ./tsconfig.json --module es2015 --outDir ./dist/esm -d && node ./build/process-dts.js",
Expand Down

0 comments on commit a0373f2

Please sign in to comment.