From 052d0b41734edd57b9e04262ecfc1ac36714b2d5 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Mon, 25 Sep 2023 14:48:54 -0700 Subject: [PATCH] Add retries to Node and Rush install tasks (#2483) - Partially fixes Azure/typespec-azure#3630 --- eng/pipelines/jobs/pull-request-consistency.yml | 8 +------- eng/pipelines/pr-tryit.yml | 8 +------- eng/pipelines/templates/install.yml | 5 ++++- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/eng/pipelines/jobs/pull-request-consistency.yml b/eng/pipelines/jobs/pull-request-consistency.yml index bf6cae5d3e..6d8dfd335b 100644 --- a/eng/pipelines/jobs/pull-request-consistency.yml +++ b/eng/pipelines/jobs/pull-request-consistency.yml @@ -2,13 +2,7 @@ steps: - checkout: self submodules: true - - task: NodeTool@0 - inputs: - versionSpec: "16.x" - displayName: Install Node.js - - - script: node common/scripts/install-run-rush.js install --max-install-attempts 3 - displayName: Install JavaScript Dependencies + - template: ../templates/install.yml - script: node common/scripts/install-run-rush.js change -v condition: and(succeeded(), not(or(startsWith(variables['System.PullRequest.SourceBranch'], 'publish/'), startsWith(variables['System.PullRequest.SourceBranch'], 'backmerge/')))) diff --git a/eng/pipelines/pr-tryit.yml b/eng/pipelines/pr-tryit.yml index 4266c99e27..6f04662bc1 100644 --- a/eng/pipelines/pr-tryit.yml +++ b/eng/pipelines/pr-tryit.yml @@ -15,13 +15,7 @@ jobs: - checkout: self persistCredentials: true - - task: NodeTool@0 - inputs: - versionSpec: 16.x - displayName: Install Node.js - - - script: node common/scripts/install-run-rush.js install --max-install-attempts 3 - displayName: Install JavaScript Dependencies + - template: ./templates/install.yml - template: ./templates/build.yml diff --git a/eng/pipelines/templates/install.yml b/eng/pipelines/templates/install.yml index 9dfd5bbc2c..3e158078cb 100644 --- a/eng/pipelines/templates/install.yml +++ b/eng/pipelines/templates/install.yml @@ -9,6 +9,7 @@ steps: inputs: versionSpec: ${{ parameters.nodeVersion }} displayName: Install Node.js + retryCountOnTaskFailure: 3 - task: UseDotNet@2 inputs: @@ -23,8 +24,10 @@ steps: dotnet --version displayName: "Log tool versions used" - - script: node common/scripts/install-run-rush.js install --max-install-attempts 3 + # purge before install to ensure a clean state between retries + - script: node common/scripts/install-run-rush.js install --purge displayName: Install JavaScript Dependencies + retryCountOnTaskFailure: 3 - script: dotnet restore displayName: Restore .NET Dependencies