Skip to content

Commit

Permalink
fix Alpine builds with npm custom registry (#165137)
Browse files Browse the repository at this point in the history
fixes #165135
  • Loading branch information
joaomoreno authored Nov 1, 2022
1 parent ceaf7a4 commit b0da2ea
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions build/azure-pipelines/linux/product-build-alpine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,23 @@ steps:
condition: and(succeeded(), ne(variables['NPM_REGISTRY'], 'none'))
displayName: Setup NPM Registry

# In Alpine, we always want to setup and authenticate against the NPM_REGISTRY
# because of the Prebuild step, since it always runs `yarn` from inside an alpine
# container
- script: |
set -e
npm config set registry "$NPM_REGISTRY" --location=project
npm config set always-auth=true --location=project
yarn config set registry "$NPM_REGISTRY"
condition: and(succeeded(), ne(variables['NPM_REGISTRY'], 'none'))
displayName: Setup NPM & Yarn
- task: npmAuthenticate@0
inputs:
workingFile: .npmrc
condition: and(succeeded(), ne(variables['NPM_REGISTRY'], 'none'))
displayName: Setup NPM Authentication

- script: |
mkdir -p .build
node build/azure-pipelines/common/computeNodeModulesCacheKey.js "alpine" > .build/yarnlockhash
Expand All @@ -84,20 +101,6 @@ steps:
condition: and(succeeded(), eq(variables.NODE_MODULES_RESTORED, 'true'))
displayName: Extract node_modules cache
- script: |
set -e
npm config set registry "$NPM_REGISTRY" --location=project
npm config set always-auth=true --location=project
yarn config set registry "$NPM_REGISTRY"
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
displayName: Setup NPM & Yarn
- task: npmAuthenticate@0
inputs:
workingFile: .npmrc
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'), ne(variables['NPM_REGISTRY'], 'none'))
displayName: Setup NPM Authentication

- script: |
set -e
for i in {1..3}; do # try 3 times
Expand Down

0 comments on commit b0da2ea

Please sign in to comment.