-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.yml
171 lines (163 loc) · 6.52 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
jobs:
- job: Windows_MustPass
strategy:
maxParallel: 10
matrix:
Node 4.9:
NODE_VERSION: '4.9'
continueOnError: false
pool:
vmImage: 'vs2017-win2016'
steps:
# - task: NodeTool@0
# displayName: "Use Node $(NODE_VERSION)"
# inputs:
# versionSpec: $(NODE_VERSION)
# checkLatest: true
#- powershell: |
# if(Test-Path -Path "C:\Program Files (x86)\Nodejs")
# {
# Remove-Item -Recurse -Force "C:\Program Files (x86)\Nodejs"
# }
# if(Test-Path -Path "C:\Program Files\Nodejs")
# {
# Remove-Item -Recurse -Force "C:\Program Files\Nodejs"
# }
# if(Test-Path -Path "C:\Users\VssAdministrator\AppData\Roaming\npm")
# {
# Remove-Item -Recurse -Force "C:\Users\VssAdministrator\AppData\Roaming\npm"
# }
# if(Test-Path -Path "C:\Users\VssAdministrator\AppData\Roaming\npm-cache")
# {
# Remove-Item -Recurse -Force "C:\Users\VssAdministrator\AppData\Roaming\npm-cache"
# }
# if(Test-Path -Path "C:\Users\VssAdministrator\.npmrc")
# {
# Remove-Item -Recurse -Force "C:\Users\VssAdministrator\.npmrc"
# }
# if(Test-Path -Path "C:\Users\VssAdministrator\npmrc")
# {
# Remove-Item -Recurse -Force "C:\Users\VssAdministrator\npmrc"
# }
# if(Test-Path -Path "C:\Users\VssAdministrator\AppData\Local\Temp\npm-*")
# {
# Remove-Item -Recurse -Force "C:\Users\VssAdministrator\AppData\Local\Temp\npm-*"
# }
#- powershell: |
# $removeThis = ";C:\Program Files\nodejs\;"
# $oldPath = "$env:Path"
# $newPath = $oldPath.Replace("$removeThis",";")
# $finalPath = "$newPath"
# $finalPath
# Write-Host "##vso[task.setvariable variable=PATH;]$finalPath";
# $env:Path
# displayName: "remove Node From Path"
#- script: 'where node'
# displayName: 'Command Line Script'
- powershell: |
#get-wmiobject Win32_Product | Format-Table IdentifyingNumber, Name, LocalPackage -AutoSize
#{58108C5E-FC5E-4464-8363-BE20821E480B} Node.js
#$currentNodeVersion = node --version
#$nodejsUrl = "https://nodejs.org/dist/index.json"
#$nodejsList = Invoke-WebRequest -Uri $nodejsUrl
#$nodejsConverted = ConvertFrom-Json -InputObject $nodejsList
#$matchValues = $nodejsConverted | Where-Object {$_.version -match "$currentNodeVersion"}
#$ver = $matchValues[0].version
#$ver
#$msi = "node-$ver-x64.msi"
#$msi
#$nodejsUrl = "https://nodejs.org/dist/$ver/$msi"
#$nodejsUrl
#$file = Join-Path "$(agent.tempDirectory)" "$msi"
#Invoke-WebRequest -Uri $nodejsUrl -OutFile $file
#dir $(agent.tempDirectory)
##Set variables and attempt to install
#Write-Output ("Please work")
# dir "c:\windows\installer"
#$logFile = Join-Path "$(agent.tempDirectory)" "install.log"
#$targetDir = "$(agent.tempDirectory)"
#$MSIArguments = @("/i", "$file", "/qn", "/norestart", "/L*v", $logFile, "ADDLOCAL=ALL", "REMOVE=NodePerfCtrSupport,NodeEtwSupport")
#$MSIArguments = @("/x", "$file", "/qn", "/norestart", "/L", $logFile)
##$MSIArguments = @("/x", "{58108C5E-FC5E-4464-8363-BE20821E480B}", "/qn", "/norestart", "/L*v", $logFile)
#Start-Process "msiexec.exe" -ArgumentList $MSIArguments -Wait -NoNewWindow
#dir $(agent.tempDirectory)
#$iojsDir = "c:\Program Files\iojs"
#dir "$iojsDir"
#more $logFile
#displayName: "uninstalling current version"
- powershell: |
node --version
$currentNodeVersion = node --version
$currentNodeVersion
$env:Path
$env:PROCESSOR_ARCHITECTURE
$iojsValues = '1.8','2.5','3.3'
if ($(NODE_VERSION) -In $iojsValues)
{
Write-Information ("iojs")
$iojsUrl = "https://iojs.org/dist/index.json"
$iojsList = Invoke-WebRequest -Uri $iojsUrl
$iojsConverted = ConvertFrom-Json -InputObject $iojsList
$matchValues = $iojsConverted | Where-Object {$_.version -match "v$(NODE_VERSION)"}
$ver = $matchValues[0].version
$ver
$msi = "iojs-$ver-x64.msi"
$msi
$iojsUrl = "https://iojs.org/dist/$ver/$msi"
$iojsUrl
$file = Join-Path "$(agent.tempDirectory)" "$msi"
Invoke-WebRequest -Uri $iojsUrl -OutFile $file
dir $(agent.tempDirectory)
##Set variables and attempt to install
$logFile = Join-Path "$(agent.tempDirectory)" "install.log"
#$targetDir = "$(agent.tempDirectory)"
$MSIArguments = @("/i", "$file", "/qn", "/norestart", "/L*v", $logFile, "ADDLOCAL=ALL", "REMOVE=NodePerfCtrSupport,NodeEtwSupport")
Start-Process "msiexec.exe" -ArgumentList $MSIArguments -Wait -NoNewWindow
dir $(agent.tempDirectory)
$iojsDir = "c:\Program Files\iojs"
#dir "$iojsDir"
more $logFile
$newPath = "$iojsDir;$env:Path"
$newPath
Write-Host "##vso[task.setvariable variable=PATH;]$newPath";
$env:Path
node --version
}
else
{
Write-Information ("nodejsjs")
$nodejsDir = "c:\Program Files\nodejs"
#dir "$nodejsDir"
#Remove-Item -Recurse -Force "$nodejsDir"
$nodejsUrl = "https://nodejs.org/dist/index.json"
$nodejsList = Invoke-WebRequest -Uri $nodejsUrl
$nodejsConverted = ConvertFrom-Json -InputObject $nodejsList
$matchValues = $nodejsConverted | Where-Object {$_.version -match "v$(NODE_VERSION)"}
$ver = $matchValues[0].version
$ver
$msi = "node-$ver-x64.msi"
$msi
$nodejsUrl = "https://nodejs.org/dist/$ver/$msi"
$nodejsUrl
$file = Join-Path "$(agent.tempDirectory)" "$msi"
Invoke-WebRequest -Uri $nodejsUrl -OutFile $file
dir $(agent.tempDirectory)
##Set variables and attempt to install
$logFile = Join-Path "$(agent.tempDirectory)" "install.log"
#$targetDir = "$(agent.tempDirectory)"
$MSIArguments = @("/i", "$file", "/qn", "/norestart", "/L", $logFile, "ADDLOCAL=ALL", "REMOVE=NodePerfCtrSupport,NodeEtwSupport")
#$MSIArguments = @("/x", "$file", "/qn", "/norestart", "/L*v", $logFile)
Start-Process "msiexec.exe" -ArgumentList $MSIArguments -Wait -NoNewWindow
dir $(agent.tempDirectory)
#$iojsDir = "c:\Program Files\iojs"
#dir "$iojsDir"
more $logFile
#newPath = "$nodejsDir;$env:Path"
#$newPath
#Write-Host "##vso[task.setvariable variable=PATH;]$newPath";
$env:Path
node --version
}
- powershell: |
$env:Path
node --version