Verify node version after install (#9498)
This commit is contained in:
Родитель
146cb7a62b
Коммит
b037d6e63e
|
@ -46,10 +46,7 @@ jobs:
|
|||
value: "@{ storageEndpointSuffix = 'core.chinacloudapi.cn'; azureCloud = 'AzureChinaCloud'; }"
|
||||
|
||||
steps:
|
||||
- task: NodeTool@0
|
||||
displayName: Use Node $(NodeVersion)
|
||||
inputs:
|
||||
versionSpec: $(NodeVersion)
|
||||
- template: ../../eng/pipelines/templates/steps/common.yml
|
||||
|
||||
- task: Npm@1
|
||||
inputs:
|
||||
|
|
|
@ -8,11 +8,4 @@ steps:
|
|||
|
||||
- template: /eng/common/pipelines/templates/steps/verify-agent-os.yml
|
||||
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "$(NodeVersion)"
|
||||
displayName: "Use NodeJS $(NodeVersion)"
|
||||
|
||||
- script: |
|
||||
node --version && npm --version
|
||||
displayName: Node versions
|
||||
- template: use-node-version.yml
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: $(NodeTestVersion)
|
||||
displayName: "Use NodeJS $(NodeTestVersion)"
|
||||
parameters:
|
||||
NodeTestVersion: $(NodeTestVersion)
|
||||
|
||||
- script: |
|
||||
node --version && npm --version
|
||||
displayName: Node versions
|
||||
steps:
|
||||
- template: use-node-version.yml
|
||||
parameters:
|
||||
NodeVersion: $(NodeTestVersion)
|
||||
|
||||
# Packages with native dependencies must be reinstalled after changing Node versions
|
||||
- pwsh: |
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
parameters:
|
||||
NodeVersion: $(NodeVersion)
|
||||
|
||||
steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: ${{ parameters.NodeVersion }}
|
||||
displayName: "Use Node ${{ parameters.NodeVersion }}"
|
||||
|
||||
- pwsh: |
|
||||
$expectedVersion = "${{ parameters.NodeVersion }}"
|
||||
Write-Host "Expected Node Version: $expectedVersion"
|
||||
|
||||
$actualVersion = (node --version).Substring(1)
|
||||
Write-Host "Actual Node Version: $actualVersion"
|
||||
Write-Host "Actual NPM Version: $(npm --version)"
|
||||
|
||||
$expectedMajorVersion = $expectedVersion.Split(".")[0]
|
||||
$actualMajorVersion = $actualVersion.Split(".")[0]
|
||||
if ($expectedMajorVersion -ne $actualMajorVersion) {
|
||||
Write-Host "Error: Expected node version does not match actual node version"
|
||||
exit 1
|
||||
}
|
||||
displayName: "Verify Node Version"
|
Загрузка…
Ссылка в новой задаче