|
57 | 57 | pool: ${{ parameters.poolBuild }} |
58 | 58 | timeoutInMinutes: ${{ parameters.timeoutInMinutes }} |
59 | 59 | variables: |
| 60 | + - group: ado-feeds |
60 | 61 | # We use 'chalk' to colorize output, which auto-detects color support in the |
61 | 62 | # running terminal. The log output shown in Azure DevOps job runs only has |
62 | 63 | # basic ANSI color support though, so force that in the pipeline |
|
67 | 68 | - name: testPackageFilePattern |
68 | 69 | value: ${{ replace(replace(parameters.testPackage, '@', '' ), '/', '-') }}-*.tgz |
69 | 70 | - name: testPackagePathPattern |
70 | | - value: $(Pipeline.Workspace)/client/pack/scoped/${{ variables.testPackageFilePattern }} |
| 71 | + value: $(Pipeline.Workspace)/client/pack/tarballs/${{ variables.testPackageFilePattern }} |
71 | 72 | - name: skipComponentGovernanceDetection |
72 | 73 | value: true |
73 | 74 | - ${{ if startsWith(variables['Build.SourceBranch'], 'refs/heads/test/') }}: |
@@ -129,16 +130,15 @@ jobs: |
129 | 130 |
|
130 | 131 | # Install |
131 | 132 | - task: UseNode@1 |
132 | | - displayName: Use Node 20.15.1 |
| 133 | + displayName: Use Node 20.19.0 |
133 | 134 | inputs: |
134 | | - version: 20.15.1 |
135 | | - - task: Npm@1 |
136 | | - displayName: Install npm 10 |
137 | | - retryCountOnTaskFailure: 4 |
138 | | - inputs: |
139 | | - command: 'custom' |
140 | | - customCommand: 'install --global npm@^10' |
141 | | - customRegistry: 'useNpmrc' |
| 135 | + version: 20.19.0 |
| 136 | + |
| 137 | + - template: /tools/pipelines/templates/include-install-pnpm.yml@self |
| 138 | + parameters: |
| 139 | + buildDirectory: $(Pipeline.Workspace) |
| 140 | + |
| 141 | + - template: /tools/pipelines/templates/include-setup-npmrc-for-download.yml@self |
142 | 142 |
|
143 | 143 | # Download artifact |
144 | 144 | - task: DownloadPipelineArtifact@2 |
@@ -169,43 +169,51 @@ jobs: |
169 | 169 | targetType: 'inline' |
170 | 170 | workingDirectory: ${{ parameters.testWorkspace }} |
171 | 171 | script: | |
172 | | - echo Initialize package |
173 | | - npm init --yes |
174 | | -
|
175 | | - echo Generating .npmrc |
176 | | - echo "registry=https://registry.npmjs.org" >> ./.npmrc |
177 | | - echo "always-auth=false" >> ./.npmrc |
178 | | -
|
179 | | - echo "@fluidframework:registry=${{ variables.feed }}" >> ./.npmrc |
180 | | - echo "@fluid-experimental:registry=${{ variables.feed }}" >> ./.npmrc |
181 | | - echo "@fluid-internal:registry=${{ variables.feed }}" >> ./.npmrc |
182 | | - echo "@ff-internal:registry=https://pkgs.dev.azure.com/fluidframework/internal/_packaging/build/npm/registry/" >> ./.npmrc |
183 | | - echo "@microsoft:registry=https://pkgs.dev.azure.com/fluidframework/internal/_packaging/office/npm/registry/" >> ./.npmrc |
184 | | - echo "always-auth=true" >> ./.npmrc |
185 | | - cat .npmrc |
186 | | -
|
| 172 | + set -eu -o pipefail |
187 | 173 | if [[ `ls -1 ${{ variables.testPackagePathPattern }} | wc -l` -eq 1 ]]; then |
188 | 174 | echo "##vso[task.setvariable variable=testPackageTgz;isOutput=true]`ls ${{ variables.testPackagePathPattern }}`" |
189 | 175 | else |
190 | 176 | ls -1 ${{ variables.testPackagePathPattern }} |
191 | 177 | echo "##vso[task.logissue type=error]Test package '${{ parameters.testPackage }}' not found, or there are more then one found" |
192 | 178 | fi |
193 | 179 |
|
194 | | - # Auth to internal feed |
195 | | - - task: npmAuthenticate@0 |
196 | | - displayName: 'npm authenticate (internal feed)' |
| 180 | +
|
| 181 | + # Pin oteljs to a version that doesn't depend on packages that cause issues in our LTS branch |
| 182 | + # because they expect everything to be ESM, which we're not using yet in LTS (we probably can't make such a big |
| 183 | + # change to how the packages work in LTS, it would almost certainly result in some breaking changes). |
| 184 | + # Note that it needs to be done before running `pnpm install` so that the override is respected during installation. |
| 185 | + - task: Bash@3 |
| 186 | + displayName: 'Add pnpm override for @microsoft/[email protected]' |
197 | 187 | inputs: |
198 | | - workingFile: ${{ parameters.testWorkspace }}/.npmrc |
| 188 | + targetType: 'inline' |
| 189 | + workingDirectory: ${{ parameters.testWorkspace }} |
| 190 | + script: | |
| 191 | + # Init first so package.json exists. |
| 192 | + pnpm init |
| 193 | + # Apply override |
| 194 | + node -e " |
| 195 | + const fs = require('fs'); |
| 196 | + const pkgPath = './package.json'; |
| 197 | + const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8')); |
| 198 | + pkg.pnpm = pkg.pnpm || {}; |
| 199 | + pkg.pnpm.overrides = pkg.pnpm.overrides || {}; |
| 200 | + pkg.pnpm.overrides['@microsoft/oteljs'] = '4.20.30'; |
| 201 | + fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2)); |
| 202 | + " |
199 | 203 |
|
200 | 204 | # Install test and logger package |
201 | | - - task: Npm@1 |
202 | | - displayName: 'npm install' |
203 | | - retryCountOnTaskFailure: 4 |
| 205 | + # Use a Bash@3 task instead of Npm@1 so we can use pnpm, which will respect the .npmrc file configured globally earlier |
| 206 | + - task: Bash@3 |
| 207 | + displayName: 'pnpm install' |
| 208 | + # ADO feeds have latency on the order of minutes before packages are available downstream. See: |
| 209 | + # https://learn.microsoft.com/en-us/azure/devops/artifacts/concepts/upstream-sources?view=azure-devops#upstream-sources-health-status |
| 210 | + # This pipeline installs packages which were published very recently relative to its runtime, hence the rather high retry count here. |
| 211 | + retryCountOnTaskFailure: 10 |
204 | 212 | inputs: |
205 | | - command: 'custom' |
206 | | - workingDir: ${{ parameters.testWorkspace }} |
207 | | - customCommand: 'install $(Initialize.testPackageTgz) @ff-internal/aria-logger' |
208 | | - customRegistry: 'useNpmrc' |
| 213 | + targetType: 'inline' |
| 214 | + workingDirectory: ${{ parameters.testWorkspace }} |
| 215 | + script: | |
| 216 | + pnpm install $(Initialize.testPackageTgz) @ff-internal/aria-logger |
209 | 217 |
|
210 | 218 | # Download Test Files & Install Extra Dependencies |
211 | 219 | # These steps are intended to include extra dependencies that are not available as |
@@ -238,14 +246,14 @@ jobs: |
238 | 246 |
|
239 | 247 | - ${{ if ne(parameters.extraDependencies, 'null') }}: |
240 | 248 | # Install extra dependencies for test files |
241 | | - - task: Npm@1 |
242 | | - displayName: 'npm install - extra dependencies for test files' |
| 249 | + # Use a Bash@3 task instead of Npm@1 so we can use pnpm, which will respect the .npmrc file configured globally earlier |
| 250 | + - task: Bash@3 |
| 251 | + displayName: 'pnpm install - extra dependencies for test files' |
243 | 252 | retryCountOnTaskFailure: 4 |
244 | 253 | inputs: |
245 | | - command: 'custom' |
246 | | - workingDir: ${{ parameters.testWorkspace }} |
247 | | - customCommand: 'install ${{ parameters.extraDependencies }}' |
248 | | - customRegistry: 'useNpmrc' |
| 254 | + targetType: 'inline' |
| 255 | + workingDirectory: ${{ parameters.testWorkspace }} |
| 256 | + script: 'pnpm install ${{ parameters.extraDependencies }}' |
249 | 257 |
|
250 | 258 | # run the test |
251 | 259 | - task: Npm@1 |
|
0 commit comments