Skip to content

Commit 7144ff7

Browse files
authored
Release port: fix Alpine builds with npm custom registry (microsoft#165151)
fix Alpine builds with npm custom registry fixes microsoft#165135
1 parent d57c199 commit 7144ff7

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

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

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,23 @@ steps:
5959
condition: and(succeeded(), ne(variables['NPM_REGISTRY'], 'none'))
6060
displayName: Setup NPM Registry
6161

62+
# In Alpine, we always want to setup and authenticate against the NPM_REGISTRY
63+
# because of the Prebuild step, since it always runs `yarn` from inside an alpine
64+
# container
65+
- script: |
66+
set -e
67+
npm config set registry "$NPM_REGISTRY" --location=project
68+
npm config set always-auth=true --location=project
69+
yarn config set registry "$NPM_REGISTRY"
70+
condition: and(succeeded(), ne(variables['NPM_REGISTRY'], 'none'))
71+
displayName: Setup NPM & Yarn
72+
73+
- task: npmAuthenticate@0
74+
inputs:
75+
workingFile: .npmrc
76+
condition: and(succeeded(), ne(variables['NPM_REGISTRY'], 'none'))
77+
displayName: Setup NPM Authentication
78+
6279
- script: |
6380
mkdir -p .build
6481
node build/azure-pipelines/common/computeNodeModulesCacheKey.js "alpine" > .build/yarnlockhash
@@ -84,20 +101,6 @@ steps:
84101
condition: and(succeeded(), eq(variables.NODE_MODULES_RESTORED, 'true'))
85102
displayName: Extract node_modules cache
86103
87-
- script: |
88-
set -e
89-
npm config set registry "$NPM_REGISTRY" --location=project
90-
npm config set always-auth=true --location=project
91-
yarn config set registry "$NPM_REGISTRY"
92-
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
93-
displayName: Setup NPM & Yarn
94-
95-
- task: npmAuthenticate@0
96-
inputs:
97-
workingFile: .npmrc
98-
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
99-
displayName: Setup NPM Authentication
100-
101104
- script: |
102105
set -e
103106
for i in {1..3}; do # try 3 times

0 commit comments

Comments
 (0)