Skip to content

Commit ba91a81

Browse files
authored
Always patch the npm registry in yarn.lock files and compute the node modules cache key after having patched them (microsoft#164795)
1 parent 0f2285c commit ba91a81

9 files changed

+48
-49
lines changed

build/azure-pipelines/darwin/product-build-darwin-sign.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,13 @@ steps:
3535
git pull --no-rebase https://github.com/$(VSCODE_MIXIN_REPO).git $(node -p "require('./package.json').distro")
3636
displayName: Merge distro
3737
38+
- script: node build/setup-npm-registry.js $NPM_REGISTRY
39+
condition: and(succeeded(), ne(variables['NPM_REGISTRY'], 'none'))
40+
displayName: Setup NPM Registry
41+
3842
- script: |
3943
mkdir -p .build
40-
node build/azure-pipelines/common/computeNodeModulesCacheKey.js x64 $NPM_REGISTRY > .build/yarnlockhash
44+
node build/azure-pipelines/common/computeNodeModulesCacheKey.js x64 > .build/yarnlockhash
4145
node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash
4246
displayName: Prepare yarn cache flags
4347
@@ -81,10 +85,6 @@ steps:
8185
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
8286
displayName: Setup NPM Authentication
8387

84-
- script: node build/setup-npm-registry.js $NPM_REGISTRY
85-
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
86-
displayName: Setup NPM Registry
87-
8888
- script: |
8989
set -e
9090
export npm_config_arch=$(VSCODE_ARCH)

build/azure-pipelines/darwin/product-build-darwin-universal.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,13 @@ steps:
3535
git pull --no-rebase https://github.com/$(VSCODE_MIXIN_REPO).git $(node -p "require('./package.json').distro")
3636
displayName: Merge distro
3737
38+
- script: node build/setup-npm-registry.js $NPM_REGISTRY
39+
condition: and(succeeded(), ne(variables['NPM_REGISTRY'], 'none'))
40+
displayName: Setup NPM Registry
41+
3842
- script: |
3943
mkdir -p .build
40-
node build/azure-pipelines/common/computeNodeModulesCacheKey.js x64 $NPM_REGISTRY > .build/yarnlockhash
44+
node build/azure-pipelines/common/computeNodeModulesCacheKey.js x64 > .build/yarnlockhash
4145
node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash
4246
displayName: Prepare yarn cache flags
4347
@@ -81,10 +85,6 @@ steps:
8185
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
8286
displayName: Setup NPM Authentication
8387

84-
- script: node build/setup-npm-registry.js $NPM_REGISTRY
85-
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
86-
displayName: Setup NPM Registry
87-
8888
- script: |
8989
set -e
9090
export npm_config_arch=$(VSCODE_ARCH)

build/azure-pipelines/darwin/product-build-darwin.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,13 @@ steps:
7171
git pull --no-rebase https://github.com/$(VSCODE_MIXIN_REPO).git $(node -p "require('./package.json').distro")
7272
displayName: Merge distro
7373
74+
- script: node build/setup-npm-registry.js $NPM_REGISTRY
75+
condition: and(succeeded(), ne(variables['NPM_REGISTRY'], 'none'))
76+
displayName: Setup NPM Registry
77+
7478
- script: |
7579
mkdir -p .build
76-
node build/azure-pipelines/common/computeNodeModulesCacheKey.js $VSCODE_ARCH $NPM_REGISTRY > .build/yarnlockhash
80+
node build/azure-pipelines/common/computeNodeModulesCacheKey.js $VSCODE_ARCH > .build/yarnlockhash
7781
node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash
7882
displayName: Prepare yarn cache flags
7983
@@ -110,10 +114,6 @@ steps:
110114
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
111115
displayName: Setup NPM Authentication
112116

113-
- script: node build/setup-npm-registry.js $NPM_REGISTRY
114-
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
115-
displayName: Setup NPM Registry
116-
117117
- script: |
118118
set -e
119119
export npm_config_arch=$(VSCODE_ARCH)

build/azure-pipelines/linux/product-build-alpine.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,13 @@ steps:
5555
git pull --no-rebase https://github.com/$(VSCODE_MIXIN_REPO).git $(node -p "require('./package.json').distro")
5656
displayName: Merge distro
5757
58+
- script: node build/setup-npm-registry.js $NPM_REGISTRY
59+
condition: and(succeeded(), ne(variables['NPM_REGISTRY'], 'none'))
60+
displayName: Setup NPM Registry
61+
5862
- script: |
5963
mkdir -p .build
60-
node build/azure-pipelines/common/computeNodeModulesCacheKey.js "alpine" $NPM_REGISTRY > .build/yarnlockhash
64+
node build/azure-pipelines/common/computeNodeModulesCacheKey.js "alpine" > .build/yarnlockhash
6165
node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash
6266
displayName: Prepare yarn cache flags
6367
@@ -94,10 +98,6 @@ steps:
9498
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
9599
displayName: Setup NPM Authentication
96100

97-
- script: node build/setup-npm-registry.js $NPM_REGISTRY
98-
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
99-
displayName: Setup NPM Registry
100-
101101
- script: |
102102
set -e
103103
for i in {1..3}; do # try 3 times

build/azure-pipelines/linux/product-build-linux-client.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,13 @@ steps:
9090
git pull --no-rebase https://github.com/$(VSCODE_MIXIN_REPO).git $(node -p "require('./package.json').distro")
9191
displayName: Merge distro
9292
93+
- script: node build/setup-npm-registry.js $NPM_REGISTRY
94+
condition: and(succeeded(), ne(variables['NPM_REGISTRY'], 'none'))
95+
displayName: Setup NPM Registry
96+
9397
- script: |
9498
mkdir -p .build
95-
node build/azure-pipelines/common/computeNodeModulesCacheKey.js $VSCODE_ARCH $NPM_REGISTRY > .build/yarnlockhash
99+
node build/azure-pipelines/common/computeNodeModulesCacheKey.js $VSCODE_ARCH > .build/yarnlockhash
96100
node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash
97101
displayName: Prepare yarn cache flags
98102
@@ -138,10 +142,6 @@ steps:
138142
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
139143
displayName: Setup NPM Authentication
140144

141-
- script: node build/setup-npm-registry.js $NPM_REGISTRY
142-
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
143-
displayName: Setup NPM Registry
144-
145145
- script: |
146146
set -e
147147
node build/npm/setupBuildYarnrc

build/azure-pipelines/product-build-pr-cache.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ steps:
77
inputs:
88
versionSpec: "16.x"
99

10+
- script: node build/setup-npm-registry.js $NPM_REGISTRY
11+
condition: and(succeeded(), ne(variables['NPM_REGISTRY'], 'none'))
12+
displayName: Setup NPM Registry
13+
1014
- script: |
1115
mkdir -p .build
12-
node build/azure-pipelines/common/computeNodeModulesCacheKey.js $VSCODE_ARCH $NPM_REGISTRY > .build/yarnlockhash
16+
node build/azure-pipelines/common/computeNodeModulesCacheKey.js $VSCODE_ARCH > .build/yarnlockhash
1317
node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash
1418
displayName: Prepare yarn cache flags
1519
@@ -46,10 +50,6 @@ steps:
4650
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
4751
displayName: Setup NPM Authentication
4852

49-
- script: node build/setup-npm-registry.js $NPM_REGISTRY
50-
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
51-
displayName: Setup NPM Registry
52-
5353
- script: |
5454
set -e
5555
for i in {1..3}; do # try 3 times

build/azure-pipelines/product-compile.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@ steps:
1111
parameters:
1212
VSCODE_QUALITY: ${{ parameters.VSCODE_QUALITY }}
1313

14+
- script: node build/setup-npm-registry.js $NPM_REGISTRY
15+
condition: and(succeeded(), ne(variables['NPM_REGISTRY'], 'none'))
16+
displayName: Setup NPM Registry
17+
1418
- script: |
1519
mkdir -p .build
16-
node build/azure-pipelines/common/computeNodeModulesCacheKey.js $VSCODE_ARCH $NPM_REGISTRY > .build/yarnlockhash
20+
node build/azure-pipelines/common/computeNodeModulesCacheKey.js $VSCODE_ARCH > .build/yarnlockhash
1721
node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash
1822
displayName: Prepare yarn cache flags
1923
@@ -52,10 +56,6 @@ steps:
5256
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
5357
displayName: Setup NPM Authentication
5458

55-
- script: node build/setup-npm-registry.js $NPM_REGISTRY
56-
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
57-
displayName: Setup NPM Registry
58-
5959
- script: |
6060
set -e
6161
sudo apt update -y

build/azure-pipelines/web/product-build-web.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,13 @@ steps:
4646
git pull --no-rebase https://github.com/$(VSCODE_MIXIN_REPO).git $(node -p "require('./package.json').distro")
4747
displayName: Merge distro
4848
49+
- script: node build/setup-npm-registry.js $NPM_REGISTRY
50+
condition: and(succeeded(), ne(variables['NPM_REGISTRY'], 'none'))
51+
displayName: Setup NPM Registry
52+
4953
- script: |
5054
mkdir -p .build
51-
node build/azure-pipelines/common/computeNodeModulesCacheKey.js "web" $NPM_REGISTRY > .build/yarnlockhash
55+
node build/azure-pipelines/common/computeNodeModulesCacheKey.js "web" > .build/yarnlockhash
5256
node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash
5357
displayName: Prepare yarn cache flags
5458
@@ -85,10 +89,6 @@ steps:
8589
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
8690
displayName: Setup NPM Authentication
8791

88-
- script: node build/setup-npm-registry.js $NPM_REGISTRY
89-
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
90-
displayName: Setup NPM Registry
91-
9292
- script: |
9393
set -e
9494
for i in {1..3}; do # try 3 times

build/azure-pipelines/win32/product-build-win32.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,23 @@ steps:
7777
exec { git pull --no-rebase https://github.com/$(VSCODE_MIXIN_REPO).git $(node -p "require('./package.json').distro") }
7878
displayName: Merge distro
7979
80+
- powershell: |
81+
. build/azure-pipelines/win32/exec.ps1
82+
$ErrorActionPreference = "Stop"
83+
exec { node build/setup-npm-registry.js $env:NPM_REGISTRY }
84+
condition: and(succeeded(), ne(variables['NPM_REGISTRY'], 'none'))
85+
displayName: Setup NPM Registry
86+
8087
- powershell: |
8188
if (!(Test-Path ".build")) { New-Item -Path ".build" -ItemType Directory }
8289
"$(VSCODE_ARCH)" | Out-File -Encoding ascii -NoNewLine .build\arch
83-
"$env:NPM_REGISTRY" | Out-File -Encoding ascii -NoNewLine .build\npm_registry
8490
node build/azure-pipelines/common/computeNodeModulesCacheKey.js > .build/yarnlockhash
8591
node build/azure-pipelines/common/computeBuiltInDepsCacheKey.js > .build/builtindepshash
8692
displayName: Prepare yarn cache flags
8793
8894
- task: Cache@2
8995
inputs:
90-
key: "nodeModules | $(Agent.OS) | .build/arch, .build/npm_registry, .build/yarnlockhash"
96+
key: "nodeModules | $(Agent.OS) | .build/arch, .build/yarnlockhash"
9197
path: .build/node_modules_cache
9298
cacheHitVar: NODE_MODULES_RESTORED
9399
displayName: Restore node_modules cache
@@ -120,13 +126,6 @@ steps:
120126
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
121127
displayName: Setup NPM Authentication
122128

123-
- powershell: |
124-
. build/azure-pipelines/win32/exec.ps1
125-
$ErrorActionPreference = "Stop"
126-
exec { node build/setup-npm-registry.js $env:NPM_REGISTRY }
127-
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
128-
displayName: Setup NPM Registry
129-
130129
- powershell: |
131130
. build/azure-pipelines/win32/exec.ps1
132131
. build/azure-pipelines/win32/retry.ps1

0 commit comments

Comments
 (0)